{"_id":"@4lolo/underscore.inflection","_rev":"1-85a594755aeb1d5fe2b47d03070edfe7","name":"@4lolo/underscore.inflection","dist-tags":{"latest":"1.3.5"},"versions":{"1.3.4":{"name":"@4lolo/underscore.inflection","version":"1.3.4","description":"ActiveSupport::Inflector, for underscore!","main":"index.js","browser":"lib/underscore.inflection.js","private":false,"engines":{"node":">0.10.0"},"scripts":{"test":"mocha","browser":"open test/index.html","coverage":"JSCOV=1 mocha -R mocha-lcov-reporter | coveralls","jscov":"gulp jscov","jscs":"gulp jscs","docs":"gulp docs"},"repository":{"type":"git","url":"git://github.com/jeremyruppel/underscore.inflection.git"},"keywords":["underscore","inflection","inflector","activesupport","plural","pluralize"],"author":{"name":"Jeremy Ruppel"},"license":"MIT","bugs":{"url":"https://github.com/jeremyruppel/underscore.inflection/issues"},"homepage":"https://github.com/jeremyruppel/underscore.inflection","devDependencies":{"chai":"~2.3.0","coveralls":"~2.11.2","gulp":"~4.0.2","gulp-contribs":"~0.0.3","gulp-jscoverage":"~0.1.0","gulp-jscs":"~4.1.0","jscoverage":"~0.5.9","mocha":"~2.2.5","mocha-lcov-reporter":"~0.0.2","mversion":"^1.10.1","underscore":"^1.13.6"},"dependencies":{},"gitHead":"30f64edee6d0168d64a6a02f16cbc9cece89a699","_id":"@4lolo/underscore.inflection@1.3.4","_nodeVersion":"18.14.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-oG+BrutHX1G7W3EPven/9Biz+ZyvjJtKEP35ly3T+RkbeO8G8b2JK2XPN4/7WJ57jTGgJHvwc/Q+henWbvr1ow==","shasum":"c38eec8789060708dc05e14cf8a5e3db7b374ee7","tarball":"https://registry.npmjs.org/@4lolo/underscore.inflection/-/underscore.inflection-1.3.4.tgz","fileCount":27,"unpackedSize":32656,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHOyBzVGN1TJxzUyQw9c7gbrDL6BfuSsFMXNtSvo0wxSAiBlX37/BlQYqvAuRBaC2s6uJn/Cw6vYdqMmISaAV6zewg=="}]},"_npmUser":{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"},"directories":{},"maintainers":[{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/underscore.inflection_1.3.4_1687164432451_0.004500403012055898"},"_hasShrinkwrap":false},"1.3.5":{"name":"@4lolo/underscore.inflection","version":"1.3.5","description":"ActiveSupport::Inflector, for underscore!","main":"index.js","browser":"lib/underscore.inflection.js","engines":{"node":">0.10.0"},"scripts":{"test":"mocha","browser":"open test/index.html","coverage":"JSCOV=1 mocha -R mocha-lcov-reporter | coveralls","jscov":"gulp jscov","jscs":"gulp jscs","docs":"gulp docs"},"repository":{"type":"git","url":"git://github.com/jeremyruppel/underscore.inflection.git"},"keywords":["underscore","inflection","inflector","activesupport","plural","pluralize"],"author":{"name":"Jeremy Ruppel"},"license":"MIT","bugs":{"url":"https://github.com/jeremyruppel/underscore.inflection/issues"},"homepage":"https://github.com/jeremyruppel/underscore.inflection","devDependencies":{"chai":"~2.3.0","coveralls":"~2.11.2","gulp":"~4.0.2","gulp-contribs":"~0.0.3","gulp-jscoverage":"~0.1.0","gulp-jscs":"~4.1.0","jscoverage":"~0.5.9","mocha":"~2.2.5","mocha-lcov-reporter":"~0.0.2","mversion":"^1.10.1","underscore":"^1.13.6"},"dependencies":{},"gitHead":"30f64edee6d0168d64a6a02f16cbc9cece89a699","_id":"@4lolo/underscore.inflection@1.3.5","_nodeVersion":"18.14.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-3zpu7QSNI0CF/DUCy8V9h4RgiuCcMzCBN7XILJbpEydS9CR6RLj90Uptu7DBSSdESJWXezGcLE8A4bvgHNW/OQ==","shasum":"9fff8065b7a09c257306103feb5c4eb48b261f9f","tarball":"https://registry.npmjs.org/@4lolo/underscore.inflection/-/underscore.inflection-1.3.5.tgz","fileCount":27,"unpackedSize":32698,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBUbumOm03ICXW7rRA99fkiAf1M8o3h6ona6Dzxm2GmWAiBRNx5I9RrbwkWeNFTEIYZlPcfhxYvZIyZZwPVDgQG5qQ=="}]},"_npmUser":{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"},"directories":{},"maintainers":[{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/underscore.inflection_1.3.5_1687164781580_0.9675298231097311"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-19T08:47:12.396Z","1.3.4":"2023-06-19T08:47:12.642Z","modified":"2023-06-19T08:53:01.884Z","1.3.5":"2023-06-19T08:53:01.786Z"},"maintainers":[{"name":"4lolo","email":"krzysztofwojcicki@gmail.com"}],"description":"ActiveSupport::Inflector, for underscore!","homepage":"https://github.com/jeremyruppel/underscore.inflection","keywords":["underscore","inflection","inflector","activesupport","plural","pluralize"],"repository":{"type":"git","url":"git://github.com/jeremyruppel/underscore.inflection.git"},"author":{"name":"Jeremy Ruppel"},"bugs":{"url":"https://github.com/jeremyruppel/underscore.inflection/issues"},"license":"MIT","readme":"## underscore.inflection\r\n\r\n> [![NPM version][npm-badge]][npm]\r\n> [![Build Status][travis-badge]][travis-ci]\r\n> [![Coverage Status][coveralls-badge]][coveralls]\r\n\r\n**Another javascript inflector?!**\r\n\r\nI'll be the first to say it; this isn't the first port of [ActiveSupport::Inflector][activesupport] to js. Not by a long shot. But I'll definitely take [underscore][underscore] mixins over extending String.prototype or other clunky implementations any day.\r\n\r\nAlso, this one has tests!\r\n\r\nInflections\r\n-----------\r\n\r\nThe methods listed below are the ones you'll be using 99% of the time.\r\n\r\n### pluralize\r\n\r\n**Signature:** `_.pluralize(word)`\r\n\r\n`pluralize` pluralizes the string passed to it.\r\n\r\n\t// functional style\r\n\t_.pluralize('word'); // => 'words'\r\n\r\n\t// object-oriented style\r\n\t_('word').pluralize(); // => 'words'\r\n\r\nIt also can accept a number as the second parameter. If a number is provided, it will pluralize the word to match the number.\r\n\r\n\t_('word').pluralize(0); // => 'words'\r\n\t_('word').pluralize(1); // => 'word'\r\n\t_('word').pluralize(1.5); // => 'words'\r\n\r\nOptionally, you can pass `true` as a third parameter. If found, this will include the count with the output.\r\n\r\n\t_('word').pluralize(0, true); // => '0 words'\r\n\t_('word').pluralize(1, true); // => '1 word'\r\n\r\n### singularize\r\n\r\n**Signature:** `_.singularize(word)`\r\n\r\n`singularize` returns the singular version of the plural passed to it.\r\n\r\n\t// functional style\r\n\t_.singularize('words'); // => 'word'\r\n\r\n\t// object-oriented style\r\n\t_('words').singularize(); // => 'word'\r\n\r\n### gsub\r\n\r\n**Signature:** `_.gsub(word, rule, replacement)`\r\n\r\n`gsub` is a method that is just slightly different than our standard `String#replace`. The main differences are that it matches globally every time, and if no substitution is made it returns `null`. It accepts a string for `word` and `replacement`, and `rule` can be either a string or a regex.\r\n\r\n\t// functional style\r\n\t_.gsub('word', /wo/, 'ne'); // => 'nerd'\r\n\r\n\t// object-oriented style\r\n\t_('word').gsub(/wo/, 'ne'); // => 'nerd'\r\n\r\n### ordinalize\r\n\r\n**Signature:** `_.ordinalize(number)`\r\n\r\n`ordinalize` adds an ordinal suffix to `number`.\r\n\r\n\t_.ordinalize(1);    // => '1st'\r\n\t_.ordinalize(\"5\");  // => '5th'\r\n\t_.ordinalize(11);   // => '11th'\r\n\t_.ordinalize(1033); // => '1033rd'\r\n\t_.ordinalize(-15);  // => '-15th'\r\n\r\n### titleize\r\n\r\n**Signature:** `_.titleize( words )`\r\n\r\n`titleize` capitalizes the first letter of each word in the string `words`. It preserves the existing whitespace.\r\n\r\n\t_.titleize('banana');               // => 'Banana'\r\n\t_.titleize('banana potato fork');   // => 'Banana Potato Fork'\r\n\t_.titleize('banana  potato\\tfork'); // => 'Banana  Potato\\tFork'\r\n\r\n## Configuring the Inflector\r\n\r\nShould you ever need to configure the Inflector beyond the defaults, use these methods to do so:\r\n\r\n### plural\r\n\r\n**Signature:** `_.plural(rule, replacement)`\r\n\r\n`plural` creates a new pluralization rule for the inflector. `rule` can be either a string or a regex.\r\n\r\n\t// functional style with explicit string\r\n\t_.plural('axis', 'axes');\r\n\r\n\t// object-oriented style with explicit string\r\n\t_('axis').plural('axes');\r\n\r\n\t// functional style with regex\r\n\t_.plural(/(ax)is$/i, '$1es');\r\n\r\n\t// object-oriented style with regex\r\n\t_(/(ax)is$/i).plural('$1es');\r\n\r\n### singular\r\n\r\n**Signature:** `_.singular(rule, replacement)`\r\n\r\n`singular` creates a new singularization rule for the inflector. `rule` can be either a string or a regex.\r\n\r\n\t// functional style with explicit string\r\n\t_.singular('data', 'datum');\r\n\r\n\t// object-oriented style with explicit string\r\n\t_('data').singular('datum');\r\n\r\n\t// functional style with regex\r\n\t_.singular(/(t)a$/i, '$1um');\r\n\r\n\t// object-oriented style with regex\r\n\t_(/(t)a$/i).singular('$1um');\r\n\r\n### irregular\r\n\r\n**Signature:** `_.irregular(singular, plural)`\r\n\r\n`irregular` is a shortcut method to create both a pluralization and singularization rule for the word at the same time. You must supply both the singular form and the plural form as explicit strings.\r\n\r\n\t// functional style\r\n\t_.irregular('haxor', 'hax0rs!');\r\n\r\n\t// object-oriented style\r\n\t_('haxor').irregular('hax0rs!');\r\n\r\n### uncountable\r\n\r\n**Signature:** `_.uncountable(word)`\r\n\r\n`uncountable` creates a new uncountable rule for `word`. Uncountable words do not get pluralized or singularized.\r\n\r\n\t// functional style\r\n\t_.uncountable('equipment');\r\n\r\n\t// object-oriented style\r\n\t_('equipment').uncountable();\r\n\r\n### resetInflections\r\n\r\n**Signature:** `_.resetInflections()`\r\n\r\n`resetInflections` resets the inflector's rules to their initial state, clearing out any custom rules that have been added.\r\n\r\n## Thanks to...\r\n\r\nThe [Rails][rails] team for [ActiveSupport][activesupport]\r\n\r\nThe [DocumentCloud][documentcloud] team for [underscore.js][underscore]\r\n\r\nThese other Inflector implementations:\r\n\r\n- [active-support-for-javascript](http://code.google.com/p/active-support-for-javascript/)\r\n- [inflection-js](http://code.google.com/p/inflection-js/)\r\n- [Javascript Rails-like inflector](http://snippets.dzone.com/posts/show/3205)\r\n\r\nThough no code was taken directly from them, they deserve plenty of props for doing it before me. If underscore isn't your thing, check them out!\r\n\r\n## Contributors\r\n\r\n```\r\n    66\tJeremy Ruppel\r\n     7\tLandon Schropp\r\n     2\tJohnathon Sanders\r\n     2\tSeggy Umboh\r\n     1\tSam Dornan\r\n     1\tShane Riley\r\n     1\tbramski\r\n     1\tmaratfakhreev\r\n     1\tDaniel Perez\r\n     1\ttrevor\r\n     1\tDayton Nolan\r\n     1\tJoseph Spens\r\n     1\tKris Neuharth\r\n```\r\n\r\n## License\r\n\r\n[MIT License][LICENSE]\r\n\r\n[npm]: http://badge.fury.io/js/underscore.inflection\r\n[npm-badge]: https://badge.fury.io/js/underscore.inflection.svg\r\n[travis-ci]: https://travis-ci.org/jeremyruppel/underscore.inflection\r\n[travis-badge]: https://travis-ci.org/jeremyruppel/underscore.inflection.svg?branch=master\r\n[coveralls]: https://coveralls.io/r/jeremyruppel/underscore.inflection?branch=master\r\n[coveralls-badge]: https://img.shields.io/coveralls/jeremyruppel/underscore.inflection.svg\r\n[rails]: https://github.com/rails/rails\r\n[activesupport]: https://github.com/rails/rails/tree/master/activesupport\r\n[underscore]: http://documentcloud.github.com/underscore/\r\n[documentcloud]: http://www.documentcloud.org/home\r\n[LICENSE]: https://github.com/jeremyruppel/underscore.inflection/blob/master/LICENSE\r\n","readmeFilename":"README.md"}