Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

pronouns

1.3.3 • Public • Published

pronouns.js

personal pronoun helper module. fork of pronoun.is.

pronouns.js aims to be an easy way to handle numerous personal pronouns in English. It remains open-ended to allow for myriad use cases. One possible application could be in a social media service in which users can add their pronoun(s) and the interface can refer to them properly.

Play the demo here.

Basic usage

npm i --save pronouns

const pronouns = require('pronouns');
const my = pronouns('they/them');
 
console.log(my.pronouns);
// ['they', 'them', 'their', 'theirs', 'themself']
 
console.log(my.subject);
// 'they'
 
console.log(pronouns.table);
// [
//   ["she", "her", "her", "hers", "herself"],
//   ["he", "him", "his", "his", "himself"],
//   ["they", "them", "their", "theirs", "themself"],
//   ["ze", "hir", "hir", "hirs", "hirself"],
//   ["ze", "zir", "zir", "zirs", "zirself"],
//   ["xey", "xem", "xyr", "xyrs", "xemself"],
//   ...
// ]

The database

The pronouns "database" is an array of arrays meant to represent a table, located in resources/pronouns.json, with fields and example values as follows:

subject object possessive-determiner possessive-pronoun reflexive
they them their theirs themself

The code

util.js has most of what was translated from the original Clojure code. These functions are mostly meant for accessing rows in a table or formatting strings and is not needed for typical users, but is exposed nonetheless as pronouns.util.

index.js is the main program. pronouns is both a function you can call with a string parameter, and an object with references to the table and a few methods.

All of the following are valid inputs to the pronouns function:

  • she
  • he/him
  • ze/hir or they/.../themselves
  • she/her, they/them, it/its, or sie/hir

Tests

The test/ directory contains unit tests for index.js and util.js. Please run the tests and confirm that everything passes before merging changes, and please include tests with any new logic you introduce in a PR!

Contributing

Issues and pull/merge requests regarding the code are very much welcome! If you would like to request pronouns to be added to the table there is an issue template for doing so. You should also consider doing the same with the original repository.

To do

  • Autocomplete!
  • Interactive demos and examples
  • Parse even shorter multi-pronoun inputs like "they/she" or "she/him"
  • Handle "any/all", unknown, or badly formatted inputs better
    • Should default to they/them
  • Allow modifying an existing object (how would that work?)
  • More comprehensive documentation

Install

npm i pronouns

DownloadsWeekly Downloads

11

Version

1.3.3

License

AGPL-3.0

Unpacked Size

75.4 kB

Total Files

17

Last publish

Collaborators

  • avatar