Skip to content

Commit

Permalink
Update docs and package scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ackle-dev committed Jun 4, 2023
1 parent 44b8ba0 commit 77dc78f
Show file tree
Hide file tree
Showing 38 changed files with 3,837 additions and 313 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_module
node_modules
.devcontainer
.github
dist
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

<br>

![package-version-npm](https://img.shields.io/npm/v/pronouns.js)
![npm-downloads](https://img.shields.io/npm/dt/pronouns.js)
![npm-dependency-versions](https://img.shields.io/librariesio/release/npm/pronouns.js)
![github-latest-commit](https://img.shields.io/github/last-commit/akpi816218/pronouns.js)
![github-stars](https://img.shields.io/github/stars/akpi816218/pronouns.js?style=social)
![license-npm](https://img.shields.io/npm/l/pronouns.js)
[![package-version-npm](https://img.shields.io/npm/v/pronouns.js?logo=npm) ![npm-downloads](https://img.shields.io/npm/dt/pronouns.js?logo=npm)](https://npmjs.com/package/pronouns.js)
[![npm-dependency-versions](https://img.shields.io/librariesio/release/npm/pronouns.js?logo=npm)](https://www.npmjs.com/package/pronouns.js?activeTab=dependencies)
![license-npm](https://img.shields.io/npm/l/pronouns.js?logo=npm)
![npm-types](https://img.shields.io/npm/types/pronouns.js?logo=npm)
[![github-latest-commit](https://img.shields.io/github/last-commit/akpi816218/pronouns.js?logo=github)](https://github.com/akpi816218/pronouns.js/commits/gitmaster)
[![github-release](https://img.shields.io/github/v/release/akpi816218/pronouns.js?logo=github) ![github-stars](https://img.shields.io/github/stars/akpi816218/pronouns.js?style=social)](https://github.com/akpi816218/pronouns.js)

A simple system to keep track of pronouns — and genders — with JavaScript and TypeScript.

Expand All @@ -22,7 +22,7 @@ I got carried away one day and now this library also has genders.

Contibutions welcome.

The documentation is available [here](/?api).
The documentation is available [here](/?api). Built using [Docma](https://onury.io/docma).

## Installation

Expand Down
54 changes: 27 additions & 27 deletions dist/gender/Gender.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,78 +19,78 @@ export class Gender {
transgender;
/**
* Create a Gender
* @constructor
* @param {...GenderCodes[]} bits - The GenderBitField to use
* @param {...GenderCodes[]} bits - The GenderCodes to use
*/
constructor(...bits) {
/**
* The GenderBitField of this Gender
* @type {GenderBitField}
* The GenderCodes of this Gender
* @property {GenderBitField} bits
*/
this.bits = bits;
/**
* Whether the person is AMAB
* @type {boolean}
* @property {boolean} amab
*/
this.amab = bits.includes(GenderCodes.amab);
/**
* Whether the person was AFAB
* @type {boolean}
* Whether the person is AFAB
* @property {boolean} afab
*/
this.afab = bits.includes(GenderCodes.afab);
/**
* Whether the person identifies as agender
* @type {boolean}
* Whether the person is agender
* @property {boolean} agender
*/
this.agender = bits.includes(GenderCodes.agender);
/**
* Whether the person identifies as cisgender
* @type {boolean}
* Whether the person is cisgender
* @property {boolean} cisgender
*/
this.cisgender = bits.includes(GenderCodes.cisgender);
/**
* Whether the person identifies as demigender
* @type {boolean}
* Whether the person is demigender
* @property {boolean} demigender
*/
this.demigender = bits.includes(GenderCodes.demigender);
/**
* Whether the person identifies as female
* @type {boolean}
* Whether the person is female
* @property {boolean} female
*/
this.female = bits.includes(GenderCodes.female);
/**
* Whether the person identifies as genderfluid
* @type {boolean}
* Whether the person is genderfluid
* @property {boolean} genderfluid
*/
this.genderfluid = bits.includes(GenderCodes.genderfluid);
/**
* Whether the person identifies as male
* @type {boolean}
* Whether the person is male
* @property {boolean} male
*/
this.male = bits.includes(GenderCodes.male);
/**
* Whether the person identifies as nonbinary
* @type {boolean}
* Whether the person is nonbinary
* @property {boolean} nonbinary
*/
this.nonbinary = bits.includes(GenderCodes.nonbinary);
/**
* Whether the person identifies as polygender
* @type {boolean}
* Whether the person is polygender
* @property {boolean} polygender
*/
this.polygender = bits.includes(GenderCodes.polygender);
/**
* Whether the person identifies as genderqueer
* @type {boolean}
* Whether the person is genderqueer
* @property {boolean} queer
*/
this.queer = bits.includes(GenderCodes.queer);
/**
* Whether the person identifies as transgender
* @type {boolean}
* Whether the person is transgender
* @property {boolean} transgender
*/
this.transgender = bits.includes(GenderCodes.transgender);
}
/**
* Create a new Gender from a GenderObject
* @static
* @param {{ bits: GenderCodes[] }} object - The GenderObject to use
* @returns {Gender}
*/
Expand Down
71 changes: 63 additions & 8 deletions dist/gender/GenderCodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,75 @@
/**
* Codes to denote gender identities
* @enum {string}
* @readonly
* @example
* new Gender(GenderCodes.afab, GenderCodes.cisgender)
*/
export var GenderCodes;
(function (GenderCodes) {
GenderCodes["amab"] = "amab";
/**
* Assigned Female At Birth
* @type {string}
*/
GenderCodes["afab"] = "afab";
GenderCodes["male"] = "male";
GenderCodes["female"] = "female";
GenderCodes["nonbinary"] = "nonbinary";
/**
* Agender
* @type {string}
*/
GenderCodes["agender"] = "agender";
/**
* Assigned Male At Birth
* @type {string}
*/
GenderCodes["amab"] = "amab";
/**
* Cisgender
* @type {string}
*/
GenderCodes["cisgender"] = "cisgender";
/**
* Demigender
* @type {string}
*/
GenderCodes["demigender"] = "demigender";
GenderCodes["polygender"] = "polygender";
/**
* Female
* @type {string}
*/
GenderCodes["female"] = "female";
/**
* Genderfluid
* @type {string}
*/
GenderCodes["genderfluid"] = "genderfluid";
GenderCodes["cisgender"] = "cisgender";
GenderCodes["transgender"] = "transgender";
GenderCodes["queer"] = "queer";
/**
* Male
* @type {string}
*/
GenderCodes["male"] = "male";
/**
* Nonbinary/Enby
* @type {string}
*/
GenderCodes["nonbinary"] = "nonbinary";
/**
* Other (not specified/not found here)
* @type {string}
*/
GenderCodes["other"] = "other";
/**
* Polygender
* @type {string}
*/
GenderCodes["polygender"] = "polygender";
/**
* Genderqueer
* @type {string}
*/
GenderCodes["queer"] = "queer";
/**
* Transgender
* @type {string}
*/
GenderCodes["transgender"] = "transgender";
})(GenderCodes || (GenderCodes = {}));
15 changes: 9 additions & 6 deletions dist/pronouns/DefaultPronouns.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ import { Pronoun } from './Pronoun.js';
import { PronounCodes } from './PronounCodes.js';
/**
* @namespace DefaultPronouns
* @description The most common pronouns
* @example
* new Pronoun(DefaultPronouns.theyThem)
* @readonly
* @property {Pronoun} any - The pronoun "any"
* @property {Pronoun} heHim - The pronoun "he/him"
* @property {Pronoun} other - The pronoun "other"
* @property {Pronoun} sheHer - The pronoun "she/her"
* @property {Pronoun} theyThem - The pronoun "they/them"
* @readonly
*/
export var DefaultPronouns;
(function (DefaultPronouns) {
any: new Pronoun(PronounCodes.any);
heHim: new Pronoun(PronounCodes.heHim);
other: new Pronoun(PronounCodes.other);
sheHer: new Pronoun(PronounCodes.sheHer);
theyThem: new Pronoun(PronounCodes.theyThem);
DefaultPronouns.any = new Pronoun(PronounCodes.any);
DefaultPronouns.heHim = new Pronoun(PronounCodes.heHim);
DefaultPronouns.other = new Pronoun(PronounCodes.other);
DefaultPronouns.sheHer = new Pronoun(PronounCodes.sheHer);
DefaultPronouns.theyThem = new Pronoun(PronounCodes.theyThem);
})(DefaultPronouns || (DefaultPronouns = {}));
28 changes: 17 additions & 11 deletions dist/pronouns/Pronoun.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,8 @@ import { PronounCodes } from './PronounCodes.js';
* @class Pronoun
*/
export class Pronoun {
/**
* @property {PronounCode} code - The code for this Pronoun
*/
code;
/**
* @property {boolean} custom - Whether or not this Pronoun is custom
*/
custom;
/**
* @property {PronounValue} value - The value for this Pronoun
*/
value;
/**
* Create a new Pronoun
Expand All @@ -23,12 +14,27 @@ export class Pronoun {
* @param {PronounValue} [value] - A custom PronounValue
*/
constructor(code, value) {
/**
* The code of this Pronoun
* @readonly
* @property {PronounCode} code
*/
this.code = code;
if (value && this.code != PronounCodes.other)
throw new Error("Cannot accept 'value' parameter because 'code' parameter is not equal to 'PronounCodes.other'");
else {
/**
* The value of this Pronoun
* @readonly
* @property {PronounValue} value
*/
this.value = value || this.code;
}
/**
* Whether this Pronoun is custom
* @readonly
* @property {boolean} custom
*/
this.custom = !!value;
}
/**
Expand All @@ -53,12 +59,12 @@ export class Pronoun {
return this.custom
? {
code: this.code,
custom: this.custom,
custom: true,
value: this.value
}
: {
code: this.code,
custom: this.custom
custom: false
};
}
/**
Expand Down
23 changes: 23 additions & 0 deletions dist/pronouns/PronounCodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,36 @@
/**
* Codes to denote pronoun types
* @enum {string}
* @readonly
* @example
* new Pronoun(PronounCodes.theyThem)
*/
export var PronounCodes;
(function (PronounCodes) {
// When changing this also change list in `type PronounCode` in `src/pronouns/Util.ts
/**
* Any pronouns
* @type {string}
*/
PronounCodes["any"] = "Any";
/**
* He/Him
* @type {string}
*/
PronounCodes["heHim"] = "He/Him";
/**
* Other (custom pronouns / not specified / not found here)
* @type {string}
*/
PronounCodes["other"] = "Other";
/**
* She/Her
* @type {string}
*/
PronounCodes["sheHer"] = "She/Her";
/**
* They/Them
* @type {string}
*/
PronounCodes["theyThem"] = "They/Them";
})(PronounCodes || (PronounCodes = {}));
11 changes: 11 additions & 0 deletions dist/pronouns/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { PronounCodes } from './PronounCodes.js';
/**
* Determine if a string is a PronounCode
* @function isPronounCode
* @example
* isPronounCode('He/Him') // true
* isPronounCode('asdf') // false
* @param {string} string - The string to check
* @returns {boolean}
*/
Expand All @@ -12,6 +15,10 @@ export function isPronounCode(string) {
/**
* Determine if a string is a PronounValue
* @function isPronounValue
* @example
* isPronounValue('He/Him') // true
* isPronounValue('CustomPronoun:Ze/Zir') // true
* isPronounValue('asdf') // false
* @param {string} string - The string to check
* @returns {boolean}
*/
Expand All @@ -23,6 +30,10 @@ export function isPronounValue(string) {
/**
* Determine if an object is a PronounObject
* @function isPronounObject
* @example
* isPronounObject({ code: 'He/Him', custom: false }) // true
* isPronounObject({ code: 'Other', custom: true, value: 'CustomPronoun:Ze/Zir' }) // true
* isPronounObject({ code: 'asdf', custom: false }) // false
* @param {any} object - The object to check
* @returns {boolean}
*/
Expand Down
6 changes: 2 additions & 4 deletions docma.config.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"server": "static",
"title": "pronouns.js"
},
"assets": [
"./files/*.*"
],
"assets": ["./files/*.*"],
"dest": "docs",
"markdown": {
"gfm": true,
Expand Down Expand Up @@ -66,4 +64,4 @@
"title": "pronouns.js"
}
}
}
}
Loading

0 comments on commit 77dc78f

Please sign in to comment.