UNPKG

motion

Version:

motion - moving development forward

88 lines (87 loc) 5.78 kB
{ "_args": [ [ "i@https://registry.npmjs.org/i/-/i-0.3.4.tgz", "/Users/nw/flint/packages/flint" ] ], "_from": "i@>=0.3.0 <0.4.0", "_id": "i@0.3.4", "_inCache": true, "_location": "/i", "_phantomChildren": {}, "_requested": { "name": "i", "raw": "i@https://registry.npmjs.org/i/-/i-0.3.4.tgz", "rawSpec": "https://registry.npmjs.org/i/-/i-0.3.4.tgz", "scope": null, "spec": "https://registry.npmjs.org/i/-/i-0.3.4.tgz", "type": "remote" }, "_requiredBy": [ "/utile" ], "_resolved": "https://registry.npmjs.org/i/-/i-0.3.4.tgz", "_shasum": "e1918d417b363a544e0e4a9b83c36dce1f85c91d", "_shrinkwrap": null, "_spec": "i@https://registry.npmjs.org/i/-/i-0.3.4.tgz", "_where": "/Users/nw/flint/packages/flint", "author": { "email": "pavan.sss1991@gmail.com", "name": "Pavan Kumar Sunkara", "url": "pksunkara.github.com" }, "bugs": { "url": "https://github.com/pksunkara/inflect/issues" }, "contributors": [ { "name": "Pavan Kumar Sunkara", "email": "pavan.sss1991@gmail.com" } ], "dependencies": {}, "description": "custom inflections for nodejs", "devDependencies": { "vows": "0.7.0" }, "engines": { "node": ">=0.4" }, "homepage": "http://pksunkara.github.com/inflect", "keywords": [ "camelize", "classify", "dasherize", "demodulize", "foreign_key", "ordinalize", "plural", "pluralize", "singular", "singularize", "tableize", "titleize", "uncountable", "underscore" ], "licenses": [ { "type": "MIT", "url": "https://github.com/pksunkara/inflect/raw/master/LICENSE" } ], "main": "./lib/inflect", "name": "i", "optionalDependencies": {}, "readme": "# inflect\n\ncustomizable inflections for nodejs\n\n**NOTE: 0.3.2 was accidentally unpublished from the server and npm doesn't allow me to publish it back. Please upgrade to 0.3.3**\n\n## Installation\n\n```bash\nnpm install i\n```\n\n## Usage\n\nRequire the module before using\n\n```js\nvar inflect = require('i')();\n```\n\nAll the below api functions can be called directly on a string\n\n```js\ninflect.titleize('messages to store') // === 'Messages To Store'\n'messages to store'.titleize // === 'Messages To Store'\n```\n\nonly if `true` is passed while initiating\n\n```js\nvar inflect = require('i')(true);\n```\n\n### Pluralize\n\n```js\ninflect.pluralize('person'); // === 'people'\ninflect.pluralize('octopus'); // === 'octopi'\ninflect.pluralize('Hat'); // === 'Hats'\n```\n\n### Singularize\n\n```js\ninflect.singularize('people'); // === 'person'\ninflect.singularize('octopi'); // === 'octopus'\ninflect.singularize('Hats'); // === 'Hat'\n```\n\n### Camelize\n\n```js\ninflect.camelize('message_properties'); // === 'MessageProperties'\ninflect.camelize('message_properties', false); // === 'messageProperties'\n```\n\n### Underscore\n\n```js\ninflect.underscore('MessageProperties'); // === 'message_properties'\ninflect.underscore('messageProperties'); // === 'message_properties'\n```\n\n### Humanize\n\n```js\ninflect.humanize('message_id'); // === 'Message'\n```\n\n### Dasherize\n\n```js\ninflect.dasherize('message_properties'); // === 'message-properties'\ninflect.dasherize('Message Properties'); // === 'Message Properties'\n```\n\n### Titleize\n\n```js\ninflect.titleize('message_properties'); // === 'Message Properties'\ninflect.titleize('message properties to keep'); // === 'Message Properties to Keep'\n```\n\n### Demodulize\n\n```js\ninflect.demodulize('Message.Bus.Properties'); // === 'Properties'\n```\n\n### Tableize\n\n```js\ninflect.tableize('MessageBusProperty'); // === 'message_bus_properties'\n```\n\n### Classify\n\n```js\ninflect.classify('message_bus_properties'); // === 'MessageBusProperty'\n```\n\n### Foreign key\n\n```js\ninflect.foreign_key('MessageBusProperty'); // === 'message_bus_property_id'\ninflect.foreign_key('MessageBusProperty', false); // === 'message_bus_propertyid'\n```\n\n### Ordinalize\n\n```js\ninflect.ordinalize( '1' ); // === '1st'\n```\n\n## Custom rules for inflection\n\n### Custom plural\n\nWe can use regexp in any of these custom rules\n\n```js\ninflect.inflections.plural('person', 'guys');\ninflect.pluralize('person'); // === 'guys'\ninflect.singularize('guys'); // === 'guy'\n```\n\n### Custom singular\n\n```js\ninflect.inflections.singular('guys', 'person')\ninflect.singularize('guys'); // === 'person'\ninflect.pluralize('person'); // === 'people'\n```\n\n### Custom irregular\n\n```js\ninflect.inflections.irregular('person', 'guys')\ninflect.pluralize('person'); // === 'guys'\ninflect.singularize('guys'); // === 'person'\n```\n\n### Custom human\n\n```js\ninflect.inflections.human(/^(.*)_cnt$/i, '$1_count');\ninflect.inflections.humanize('jargon_cnt'); // === 'Jargon count'\n```\n\n### Custom uncountable\n\n```js\ninflect.inflections.uncountable('oil')\ninflect.pluralize('oil'); // === 'oil'\ninflect.singularize('oil'); // === 'oil'\n```\n\n## Contributors\nHere is a list of [Contributors](http://github.com/pksunkara/inflect/contributors)\n\n### TODO\n\n- More obscure test cases\n\n__I accept pull requests and guarantee a reply back within a day__\n\n## License\nMIT/X11\n\n## Bug Reports\nReport [here](http://github.com/pksunkara/inflect/issues). __Guaranteed reply within a day__.\n\n## Contact\nPavan Kumar Sunkara (pavan.sss1991@gmail.com)\n\nFollow me on [github](https://github.com/users/follow?target=pksunkara), [twitter](http://twitter.com/pksunkara)\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git://github.com/pksunkara/inflect.git" }, "scripts": { "test": "vows --spec $(find test -name '*-test.js')" }, "version": "0.3.4" }