init source
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
*.sock
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
# History
|
||||
|
||||
## 1.12.0 / 2017-01-27
|
||||
- [update packages] mocha->3.2.0, should->11.2.0
|
||||
- [bug fix] `minus` plural & singular form
|
||||
- [bug fix] `save` plural & singular form
|
||||
|
||||
|
||||
|
||||
## 1.11.0 / 2016-04-20
|
||||
- [update packages] mocha->3.0.2, should->11.1.0
|
||||
- [bug fix] `inflection.transform` in ES6
|
||||
|
||||
|
||||
|
||||
## 1.10.0 / 2016-04-20
|
||||
- [update packages] should->8.3.1
|
||||
- [bug fix] `campus` plural & singular form
|
||||
|
||||
|
||||
|
||||
## 1.9.0 / 2016-04-06
|
||||
- [update packages] mocha->2.4.5, should->8.3.0
|
||||
- [bug fix] `genus` plural & singular form
|
||||
|
||||
|
||||
|
||||
## 1.8.0 / 2015-11-22
|
||||
- [update packages] mocha->2.3.4, should->7.1.1
|
||||
- [bug fix] `criterion` plural & singular form
|
||||
|
||||
|
||||
|
||||
## 1.7.2 / 2015-10-11
|
||||
- [update packages] mocha->2.3.3, should->7.1.0
|
||||
|
||||
|
||||
|
||||
## 1.7.1 / 2015-03-25
|
||||
- [bug fix] `woman` plural & singular form
|
||||
|
||||
|
||||
|
||||
## 1.7.0 / 2015-03-25
|
||||
- [bug fix] `canvas` plural & singular form
|
||||
- [update packages] mocha->2.2.1, should->5.2.0
|
||||
|
||||
|
||||
|
||||
## 1.6.0 / 2014-12-06
|
||||
|
||||
- [bug fix] Special rules for index, vertex, and matrix masked by general rule x
|
||||
- [update packages] mocha->2.1.0, should->4.6.5
|
||||
|
||||
|
||||
|
||||
## 1.5.3 / 2014-12-06
|
||||
|
||||
- [bug fix] Remove invalid uncountable words
|
||||
|
||||
|
||||
|
||||
## 1.5.2 / 2014-11-14
|
||||
|
||||
- [bug fix] `business` & `access` plural form
|
||||
|
||||
|
||||
|
||||
## 1.5.1 / 2014-09-23
|
||||
|
||||
- [bug fix] Fix `whereas` plural & singular form
|
||||
|
||||
|
||||
|
||||
## 1.5.0 / 2014-09-23
|
||||
|
||||
- [refactor] Add more rules and uncountable nouns
|
||||
|
||||
|
||||
|
||||
## 1.4.2 / 2014-09-05
|
||||
|
||||
- [bug fix] Fix wrong implementation of `goose`, `tooth` & `foot`
|
||||
|
||||
|
||||
|
||||
## 1.4.1 / 2014-08-31
|
||||
|
||||
- [bug fix] Fix `goose`, `tooth` & `foot` plural & singular form
|
||||
|
||||
|
||||
|
||||
## 1.4.0 / 2014-08-23
|
||||
|
||||
- [new feature] Adds support for an `inflect` method that will choose to pluralize or singularize a noun based on an integer value
|
||||
|
||||
|
||||
|
||||
## 1.3.8 / 2014-07-03
|
||||
|
||||
- [others] Syntax tuning
|
||||
|
||||
|
||||
|
||||
## 1.3.7 / 2014-06-25
|
||||
|
||||
- [refactor] Adopt UMD import to work in a variety of different situations
|
||||
- [update packages] should->4.0.4
|
||||
|
||||
|
||||
|
||||
## 1.3.6 / 2014-06-07
|
||||
|
||||
- [bug fix] Rearrange rules. `movies`->`movy`
|
||||
|
||||
|
||||
|
||||
## 1.3.5 / 2014-02-12
|
||||
|
||||
- Unable to publsih v1.3.4 therefore jump to v1.3.5
|
||||
|
||||
|
||||
|
||||
## 1.3.4 / 2014-02-12
|
||||
|
||||
- [update packages] should->3.1.2
|
||||
- [refactor] Use `mocha` instead of hard coding tests
|
||||
|
||||
|
||||
|
||||
## 1.3.3 / 2014-01-22
|
||||
|
||||
- [update packages] should->3.0.1
|
||||
- Added brower.json
|
||||
|
||||
|
||||
|
||||
## 1.3.2 / 2013-12-12
|
||||
|
||||
- [update packages] node.flow->1.2.3
|
||||
|
||||
|
||||
|
||||
## 1.3.1 / 2013-12-12
|
||||
|
||||
- [refactor] Support `Requirejs`
|
||||
|
||||
|
||||
|
||||
## 1.3.0 / 2013-12-11
|
||||
|
||||
- [refactor] Move `var` out of loops
|
||||
- [refactor] Change the way `camelize` acts to mimic 100% `Rails ActiveSupport Inflector camelize`
|
||||
|
||||
|
||||
|
||||
## 1.2.7 / 2013-12-11
|
||||
|
||||
- [new feature] Added transform, thnaks to `luk3thomas`
|
||||
- [update packages] should->v2.1.1
|
||||
|
||||
|
||||
|
||||
## 1.2.6 / 2013-05-24
|
||||
|
||||
- [bug fix] Use instance instead of `this`
|
||||
|
||||
|
||||
|
||||
## 1.2.5 / 2013-01-09
|
||||
|
||||
- [refactor] Allow all caps strings to be returned from underscore
|
||||
|
||||
|
||||
|
||||
## 1.2.4 / 2013-01-06
|
||||
|
||||
- [bug fix] window obj does not have `call` method
|
||||
|
||||
|
||||
|
||||
## 1.2.3 / 2012-08-02
|
||||
|
||||
- [bug fix] Singularize `status` produces `statu`
|
||||
- [update packages] should->v1.1.0
|
||||
|
||||
|
||||
|
||||
## 1.2.2 / 2012-07-23
|
||||
|
||||
- [update packages] node.flow->v1.1.3 & should->v1.0.0
|
||||
|
||||
|
||||
|
||||
## 1.2.1 / 2012-06-22
|
||||
|
||||
- [bug fix] Singularize `address` produces `addres`
|
||||
|
||||
|
||||
|
||||
## 1.2.0 / 2012-04-10
|
||||
|
||||
- [new feature] Browser support
|
||||
- [update packages] node.flow->v1.1.1
|
||||
|
||||
|
||||
|
||||
## 1.1.1 / 2012-02-13
|
||||
|
||||
- [update packages] node.flow->v1.1.0
|
||||
|
||||
|
||||
|
||||
## 1.1.0 / 2012-02-13
|
||||
|
||||
- [update packages] node.flow->v1.0.0
|
||||
- [refactor] Read version number from package.json
|
||||
|
||||
|
||||
|
||||
## 1.0.0 / 2012-02-08
|
||||
|
||||
- Remove make file
|
||||
- Add pluralize rules
|
||||
- Add pluralize tests
|
||||
- [refactor] Use object.jey instead of for in
|
||||
|
||||
|
||||
|
||||
## 0.0.1 / 2012-01-16
|
||||
|
||||
- Initial release
|
||||
+504
@@ -0,0 +1,504 @@
|
||||
# inflection
|
||||
|
||||
A port of inflection-js to node.js module
|
||||
|
||||
|
||||
|
||||
## Description
|
||||
[inflection-js](http://code.google.com/p/inflection-js/) is a port of the functionality from Ruby on Rails' Active Support Inflection classes into Javascript. `inflection` is a port of `inflection-js` to node.js npm package. Instead of [extending JavaScript native](http://wonko.com/post/extending-javascript-natives) String object like `inflection-js` does, `inflection` separate the methods to a independent package to avoid unexpected behaviors.
|
||||
|
||||
Note: This library uses [Wiktionary](http://en.wiktionary.org) as its reference.
|
||||
|
||||
|
||||
|
||||
## Requires
|
||||
|
||||
Checkout `package.json` for dependencies.
|
||||
|
||||
|
||||
|
||||
## Angular Support
|
||||
|
||||
Checkout [ngInflection](https://github.com/konsumer/ngInflection) from [konsumer](https://github.com/konsumer)
|
||||
|
||||
|
||||
|
||||
## Meteor Support
|
||||
|
||||
Checkout [Meteor Inflector](https://github.com/katrotz/meteor-inflector) from [Veaceslav Cotruta](https://github.com/katrotz)
|
||||
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Install inflection through npm
|
||||
|
||||
npm install inflection
|
||||
|
||||
|
||||
|
||||
## API
|
||||
|
||||
- inflection.indexOf( arr, item, from_index, compare_func );
|
||||
- inflection.pluralize( str, plural );
|
||||
- inflection.singularize( str, singular );
|
||||
- inflection.inflect( str, count, singular, plural );
|
||||
- inflection.camelize( str, low_first_letter );
|
||||
- inflection.underscore( str, all_upper_case );
|
||||
- inflection.humanize( str, low_first_letter );
|
||||
- inflection.capitalize( str );
|
||||
- inflection.dasherize( str );
|
||||
- inflection.titleize( str );
|
||||
- inflection.demodulize( str );
|
||||
- inflection.tableize( str );
|
||||
- inflection.classify( str );
|
||||
- inflection.foreign_key( str, drop_id_ubar );
|
||||
- inflection.ordinalize( str );
|
||||
- inflection.transform( str, arr );
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
> Require the module before using
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
|
||||
|
||||
### inflection.indexOf( arr, item, from_index, compare_func );
|
||||
|
||||
This lets us detect if an Array contains a given element.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> arr
|
||||
|
||||
type: Array
|
||||
desc: The subject array.
|
||||
|
||||
> item
|
||||
|
||||
type: Object
|
||||
desc: Object to locate in the Array.
|
||||
|
||||
> from_index
|
||||
|
||||
type: Number
|
||||
desc: Starts checking from this position in the Array.(optional)
|
||||
|
||||
> compare_func
|
||||
|
||||
type: Function
|
||||
desc: Function used to compare Array item vs passed item.(optional)
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.indexOf([ 'hi','there' ], 'guys' ); // === -1
|
||||
inflection.indexOf([ 'hi','there' ], 'hi' ); // === 0
|
||||
|
||||
|
||||
|
||||
### inflection.pluralize( str, plural );
|
||||
|
||||
This function adds pluralization support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
> plural
|
||||
|
||||
type: String
|
||||
desc: Overrides normal output with said String.(optional)
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.pluralize( 'person' ); // === 'people'
|
||||
inflection.pluralize( 'octopus' ); // === "octopi"
|
||||
inflection.pluralize( 'Hat' ); // === 'Hats'
|
||||
inflection.pluralize( 'person', 'guys' ); // === 'guys'
|
||||
|
||||
|
||||
|
||||
### inflection.singularize( str, singular );
|
||||
|
||||
This function adds singularization support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
> singular
|
||||
|
||||
type: String
|
||||
desc: Overrides normal output with said String.(optional)
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.singularize( 'people' ); // === 'person'
|
||||
inflection.singularize( 'octopi' ); // === "octopus"
|
||||
inflection.singularize( 'Hats' ); // === 'Hat'
|
||||
inflection.singularize( 'guys', 'person' ); // === 'person'
|
||||
|
||||
|
||||
|
||||
### inflection.inflect( str, count, singular, plural );
|
||||
|
||||
This function will pluralize or singularlize a String appropriately based on an integer value.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
> count
|
||||
type: Number
|
||||
desc: The number to base pluralization off of.
|
||||
|
||||
> singular
|
||||
|
||||
type: String
|
||||
desc: Overrides normal output with said String.(optional)
|
||||
|
||||
> plural
|
||||
|
||||
type: String
|
||||
desc: Overrides normal output with said String.(optional)
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.inflect( 'people' 1 ); // === 'person'
|
||||
inflection.inflect( 'octopi' 1 ); // === 'octopus'
|
||||
inflection.inflect( 'Hats' 1 ); // === 'Hat'
|
||||
inflection.inflect( 'guys', 1 , 'person' ); // === 'person'
|
||||
inflection.inflect( 'person', 2 ); // === 'people'
|
||||
inflection.inflect( 'octopus', 2 ); // === 'octopi'
|
||||
inflection.inflect( 'Hat', 2 ); // === 'Hats'
|
||||
inflection.inflect( 'person', 2, null, 'guys' ); // === 'guys'
|
||||
|
||||
|
||||
|
||||
### inflection.camelize( str, low_first_letter );
|
||||
|
||||
This function transforms String object from underscore to camelcase.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
> low_first_letter
|
||||
|
||||
type: Boolean
|
||||
desc: Default is to capitalize the first letter of the results. Passing true will lowercase it. (optional)
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.camelize( 'message_properties' ); // === 'MessageProperties'
|
||||
inflection.camelize( 'message_properties', true ); // === 'messageProperties'
|
||||
|
||||
|
||||
|
||||
### inflection.underscore( str, all_upper_case );
|
||||
|
||||
This function transforms String object from camelcase to underscore.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
> all_upper_case
|
||||
|
||||
type: Boolean
|
||||
desc: Default is to lowercase and add underscore prefix
|
||||
|
||||
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.underscore( 'MessageProperties' ); // === 'message_properties'
|
||||
inflection.underscore( 'messageProperties' ); // === 'message_properties'
|
||||
inflection.underscore( 'MP' ); // === 'm_p'
|
||||
inflection.underscore( 'MP', true ); // === 'MP'
|
||||
|
||||
|
||||
|
||||
### inflection.humanize( str, low_first_letter );
|
||||
|
||||
This function adds humanize support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
> low_first_letter
|
||||
|
||||
type: Boolean
|
||||
desc: Default is to capitalize the first letter of the results. Passing true will lowercase it. (optional)
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.humanize( 'message_properties' ); // === 'Message properties'
|
||||
inflection.humanize( 'message_properties', true ); // === 'message properties'
|
||||
|
||||
|
||||
|
||||
### inflection.capitalize( str );
|
||||
|
||||
This function adds capitalization support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.capitalize( 'message_properties' ); // === 'Message_properties'
|
||||
inflection.capitalize( 'message properties', true ); // === 'Message properties'
|
||||
|
||||
|
||||
|
||||
### inflection.dasherize( str );
|
||||
|
||||
This function replaces underscores with dashes in the string.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.dasherize( 'message_properties' ); // === 'message-properties'
|
||||
inflection.dasherize( 'Message Properties' ); // === 'Message-Properties'
|
||||
|
||||
|
||||
|
||||
### inflection.titleize( str );
|
||||
|
||||
This function adds titleize support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.titleize( 'message_properties' ); // === 'Message Properties'
|
||||
inflection.titleize( 'message properties to keep' ); // === 'Message Properties to Keep'
|
||||
|
||||
|
||||
|
||||
### inflection.demodulize( str );
|
||||
|
||||
This function adds demodulize support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.demodulize( 'Message::Bus::Properties' ); // === 'Properties'
|
||||
|
||||
|
||||
|
||||
### inflection.tableize( str );
|
||||
|
||||
This function adds tableize support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.tableize( 'MessageBusProperty' ); // === 'message_bus_properties'
|
||||
|
||||
|
||||
|
||||
### inflection.classify( str );
|
||||
|
||||
This function adds classification support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.classify( 'message_bus_properties' ); // === 'MessageBusProperty'
|
||||
|
||||
|
||||
|
||||
### inflection.foreign_key( str, drop_id_ubar );
|
||||
|
||||
This function adds foreign key support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
> low_first_letter
|
||||
|
||||
type: Boolean
|
||||
desc: Default is to seperate id with an underbar at the end of the class name, you can pass true to skip it.(optional)
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.foreign_key( 'MessageBusProperty' ); // === 'message_bus_property_id'
|
||||
inflection.foreign_key( 'MessageBusProperty', true ); // === 'message_bus_propertyid'
|
||||
|
||||
|
||||
|
||||
### inflection.ordinalize( str );
|
||||
|
||||
This function adds ordinalize support to every String object.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.ordinalize( 'the 1 pitch' ); // === 'the 1st pitch'
|
||||
|
||||
|
||||
|
||||
### inflection.transform( str, arr );
|
||||
|
||||
This function performs multiple inflection methods on a string.
|
||||
|
||||
#### Arguments
|
||||
|
||||
> str
|
||||
|
||||
type: String
|
||||
desc: The subject string.
|
||||
|
||||
> arr
|
||||
|
||||
type: Array
|
||||
desc: An array of inflection methods.
|
||||
|
||||
#### Example code
|
||||
|
||||
var inflection = require( 'inflection' );
|
||||
|
||||
inflection.transform( 'all job', [ 'pluralize', 'capitalize', 'dasherize' ]); // === 'All-jobs'
|
||||
|
||||
|
||||
|
||||
## Credit
|
||||
|
||||
- Ryan Schuft <ryan.schuft@gmail.com>
|
||||
- Lance Pollard <lancejpollard@gmail.com> (Browser support)
|
||||
- Dane O'Connor <dane.oconnor@gmail.com>
|
||||
- brandondewitt
|
||||
- luk3thomas
|
||||
- Marcel Klehr
|
||||
- Raymond Feng
|
||||
- Kane Cohen <kanecohen@gmail.com>
|
||||
- Gianni Chiappetta <gianni@runlevel6.org>
|
||||
- Eric Brody
|
||||
- overlookmotel
|
||||
- Patrick Mowrer
|
||||
- Greger Olsson
|
||||
- Jason Crawford <jason@jasoncrawford.org>
|
||||
- Ray Myers <ray.myers@gmail.com>
|
||||
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 dreamerslab <ben@dreamerslab.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "inflection",
|
||||
"version": "1.12.0",
|
||||
"homepage": "https://github.com/dreamerslab/node.inflection",
|
||||
"description": "JavaScript Inflection Support",
|
||||
"authors": [
|
||||
"ben <ben@dreamerslab.com>"
|
||||
],
|
||||
"contributors": [
|
||||
{ "name": "Ryan Schuft", "email": "ryan.schuft@gmail.com" },
|
||||
{ "name": "Ben Lin", "email": "ben@dreamerslab.com" },
|
||||
{ "name": "Lance Pollard", "email": "lancejpollard@gmail.com" },
|
||||
{ "name": "Dane O'Connor", "email": "dane.oconnor@gmail.com" },
|
||||
{ "name": "David Miró", "email": "lite.3engine@gmail.com" },
|
||||
{ "name": "brandondewitt" },
|
||||
{ "name": "luk3thomas" },
|
||||
{ "name": "Marcel Klehr" },
|
||||
{ "name": "Raymond Feng" },
|
||||
{ "name": "Kane Cohen", "email": "kanecohen@gmail.com" },
|
||||
{ "name": "Gianni Chiappetta", "email": "gianni@runlevel6.org" },
|
||||
{ "name": "Eric Brody" },
|
||||
{ "name": "overlookmotel" },
|
||||
{ "name": "Patrick Mowrer" },
|
||||
{ "name": "Greger Olsson" },
|
||||
{ "name": "Jason Crawford", "email": "jason@jasoncrawford.org" },
|
||||
{ "name": "Ray Myers", "email": "ray.myers@gmail.com" },
|
||||
{ "name": "Dillon Shook", "email": "dshook@alumni.nmt.edu" }
|
||||
|
||||
],
|
||||
"main": "lib/inflection.js",
|
||||
"keywords": [
|
||||
"inflection",
|
||||
"inflections",
|
||||
"inflection-js",
|
||||
"pluralize",
|
||||
"singularize",
|
||||
"inflect",
|
||||
"camelize",
|
||||
"underscore",
|
||||
"humanize",
|
||||
"capitalize",
|
||||
"dasherize",
|
||||
"titleize",
|
||||
"demodulize",
|
||||
"tableize",
|
||||
"classify",
|
||||
"foreign_key",
|
||||
"ordinalize"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "inflection",
|
||||
"version": "1.12.0",
|
||||
"repo": "dreamerslab/node.inflection",
|
||||
"description": "A port of inflection-js to node.js module",
|
||||
"keywords" : [
|
||||
"inflection", "inflections", "inflection-js", "pluralize" , "singularize",
|
||||
"camelize", "underscore", "humanize", "capitalize", "dasherize", "titleize",
|
||||
"demodulize", "tableize", "classify", "foreign_key", "ordinalize"
|
||||
],
|
||||
"author": "dreamerslab <ben@dreamerslab.com>",
|
||||
"contributors": [
|
||||
{ "name": "Ryan Schuft", "email": "ryan.schuft@gmail.com" },
|
||||
{ "name": "Ben Lin", "email": "ben@dreamerslab.com" },
|
||||
{ "name": "Lance Pollard", "email": "lancejpollard@gmail.com" },
|
||||
{ "name": "Dane O'Connor", "email": "dane.oconnor@gmail.com" },
|
||||
{ "name": "David Miró", "email": "lite.3engine@gmail.com" },
|
||||
{ "name": "brandondewitt" },
|
||||
{ "name": "luk3thomas" },
|
||||
{ "name": "Marcel Klehr" },
|
||||
{ "name": "Raymond Feng" },
|
||||
{ "name": "Kane Cohen", "email": "kanecohen@gmail.com" },
|
||||
{ "name": "Gianni Chiappetta", "email": "gianni@runlevel6.org" },
|
||||
{ "name": "Eric Brody" },
|
||||
{ "name": "overlookmotel" },
|
||||
{ "name": "Patrick Mowrer" },
|
||||
{ "name": "Greger Olsson" },
|
||||
{ "name": "Jason Crawford", "email": "jason@jasoncrawford.org" },
|
||||
{ "name": "Ray Myers", "email": "ray.myers@gmail.com" },
|
||||
{ "name": "Dillon Shook", "email": "dshook@alumni.nmt.edu" }
|
||||
],
|
||||
"dependencies": {},
|
||||
"license": "MIT",
|
||||
"main": "./lib/inflection.js",
|
||||
"scripts": ["./lib/inflection.js"]
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*!
|
||||
* inflection
|
||||
* Copyright(c) 2011 Ben Lin <ben@dreamerslab.com>
|
||||
* MIT Licensed
|
||||
*
|
||||
* @fileoverview
|
||||
* A port of inflection-js to node.js module.
|
||||
*/
|
||||
(function(a,b){if(typeof define==="function"&&define.amd){define([],b);
|
||||
}else{if(typeof exports==="object"){module.exports=b();}else{a.inflection=b();}}}(this,function(){var d=["accommodation","adulthood","advertising","advice","aggression","aid","air","aircraft","alcohol","anger","applause","arithmetic","assistance","athletics","bacon","baggage","beef","biology","blood","botany","bread","butter","carbon","cardboard","cash","chalk","chaos","chess","crossroads","countryside","dancing","deer","dignity","dirt","dust","economics","education","electricity","engineering","enjoyment","envy","equipment","ethics","evidence","evolution","fame","fiction","flour","flu","food","fuel","fun","furniture","gallows","garbage","garlic","genetics","gold","golf","gossip","grammar","gratitude","grief","guilt","gymnastics","happiness","hardware","harm","hate","hatred","health","heat","help","homework","honesty","honey","hospitality","housework","humour","hunger","hydrogen","ice","importance","inflation","information","innocence","iron","irony","jam","jewelry","judo","karate","knowledge","lack","laughter","lava","leather","leisure","lightning","linguine","linguini","linguistics","literature","litter","livestock","logic","loneliness","luck","luggage","macaroni","machinery","magic","management","mankind","marble","mathematics","mayonnaise","measles","methane","milk","minus","money","mud","music","mumps","nature","news","nitrogen","nonsense","nurture","nutrition","obedience","obesity","oxygen","pasta","patience","physics","poetry","pollution","poverty","pride","psychology","publicity","punctuation","quartz","racism","relaxation","reliability","research","respect","revenge","rice","rubbish","rum","safety","scenery","seafood","seaside","series","shame","sheep","shopping","sleep","smoke","smoking","snow","soap","software","soil","spaghetti","species","steam","stuff","stupidity","sunshine","symmetry","tennis","thirst","thunder","timber","traffic","transportation","trust","underwear","unemployment","unity","validity","veal","vegetation","vegetarianism","vengeance","violence","vitality","warmth","wealth","weather","welfare","wheat","wildlife","wisdom","yoga","zinc","zoology"];
|
||||
var i={plural:{men:new RegExp("^(m|wom)en$","gi"),people:new RegExp("(pe)ople$","gi"),children:new RegExp("(child)ren$","gi"),tia:new RegExp("([ti])a$","gi"),analyses:new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),hives:new RegExp("(hi|ti)ves$","gi"),curves:new RegExp("(curve)s$","gi"),lrves:new RegExp("([lr])ves$","gi"),aves:new RegExp("([a])ves$","gi"),foves:new RegExp("([^fo])ves$","gi"),movies:new RegExp("(m)ovies$","gi"),aeiouyies:new RegExp("([^aeiouy]|qu)ies$","gi"),series:new RegExp("(s)eries$","gi"),xes:new RegExp("(x|ch|ss|sh)es$","gi"),mice:new RegExp("([m|l])ice$","gi"),buses:new RegExp("(bus)es$","gi"),oes:new RegExp("(o)es$","gi"),shoes:new RegExp("(shoe)s$","gi"),crises:new RegExp("(cris|ax|test)es$","gi"),octopi:new RegExp("(octop|vir)i$","gi"),aliases:new RegExp("(alias|canvas|status|campus)es$","gi"),summonses:new RegExp("^(summons)es$","gi"),oxen:new RegExp("^(ox)en","gi"),matrices:new RegExp("(matr)ices$","gi"),vertices:new RegExp("(vert|ind)ices$","gi"),feet:new RegExp("^feet$","gi"),teeth:new RegExp("^teeth$","gi"),geese:new RegExp("^geese$","gi"),quizzes:new RegExp("(quiz)zes$","gi"),whereases:new RegExp("^(whereas)es$","gi"),criteria:new RegExp("^(criteri)a$","gi"),genera:new RegExp("^genera$","gi"),ss:new RegExp("ss$","gi"),s:new RegExp("s$","gi")},singular:{man:new RegExp("^(m|wom)an$","gi"),person:new RegExp("(pe)rson$","gi"),child:new RegExp("(child)$","gi"),ox:new RegExp("^(ox)$","gi"),axis:new RegExp("(ax|test)is$","gi"),octopus:new RegExp("(octop|vir)us$","gi"),alias:new RegExp("(alias|status|canvas|campus)$","gi"),summons:new RegExp("^(summons)$","gi"),bus:new RegExp("(bu)s$","gi"),buffalo:new RegExp("(buffal|tomat|potat)o$","gi"),tium:new RegExp("([ti])um$","gi"),sis:new RegExp("sis$","gi"),ffe:new RegExp("(?:([^f])fe|([lr])f)$","gi"),hive:new RegExp("(hi|ti)ve$","gi"),aeiouyy:new RegExp("([^aeiouy]|qu)y$","gi"),x:new RegExp("(x|ch|ss|sh)$","gi"),matrix:new RegExp("(matr)ix$","gi"),vertex:new RegExp("(vert|ind)ex$","gi"),mouse:new RegExp("([m|l])ouse$","gi"),foot:new RegExp("^foot$","gi"),tooth:new RegExp("^tooth$","gi"),goose:new RegExp("^goose$","gi"),quiz:new RegExp("(quiz)$","gi"),whereas:new RegExp("^(whereas)$","gi"),criterion:new RegExp("^(criteri)on$","gi"),genus:new RegExp("^genus$","gi"),s:new RegExp("s$","gi"),common:new RegExp("$","gi")}};
|
||||
var g=[[i.plural.men],[i.plural.people],[i.plural.children],[i.plural.tia],[i.plural.analyses],[i.plural.hives],[i.plural.curves],[i.plural.lrves],[i.plural.foves],[i.plural.aeiouyies],[i.plural.series],[i.plural.movies],[i.plural.xes],[i.plural.mice],[i.plural.buses],[i.plural.oes],[i.plural.shoes],[i.plural.crises],[i.plural.octopi],[i.plural.aliases],[i.plural.summonses],[i.plural.oxen],[i.plural.matrices],[i.plural.feet],[i.plural.teeth],[i.plural.geese],[i.plural.quizzes],[i.plural.whereases],[i.plural.criteria],[i.plural.genera],[i.singular.man,"$1en"],[i.singular.person,"$1ople"],[i.singular.child,"$1ren"],[i.singular.ox,"$1en"],[i.singular.axis,"$1es"],[i.singular.octopus,"$1i"],[i.singular.alias,"$1es"],[i.singular.summons,"$1es"],[i.singular.bus,"$1ses"],[i.singular.buffalo,"$1oes"],[i.singular.tium,"$1a"],[i.singular.sis,"ses"],[i.singular.ffe,"$1$2ves"],[i.singular.hive,"$1ves"],[i.singular.aeiouyy,"$1ies"],[i.singular.matrix,"$1ices"],[i.singular.vertex,"$1ices"],[i.singular.x,"$1es"],[i.singular.mouse,"$1ice"],[i.singular.foot,"feet"],[i.singular.tooth,"teeth"],[i.singular.goose,"geese"],[i.singular.quiz,"$1zes"],[i.singular.whereas,"$1es"],[i.singular.criterion,"$1a"],[i.singular.genus,"genera"],[i.singular.s,"s"],[i.singular.common,"s"]];
|
||||
var a=[[i.singular.man],[i.singular.person],[i.singular.child],[i.singular.ox],[i.singular.axis],[i.singular.octopus],[i.singular.alias],[i.singular.summons],[i.singular.bus],[i.singular.buffalo],[i.singular.tium],[i.singular.sis],[i.singular.ffe],[i.singular.hive],[i.singular.aeiouyy],[i.singular.x],[i.singular.matrix],[i.singular.mouse],[i.singular.foot],[i.singular.tooth],[i.singular.goose],[i.singular.quiz],[i.singular.whereas],[i.singular.criterion],[i.singular.genus],[i.plural.men,"$1an"],[i.plural.people,"$1rson"],[i.plural.children,"$1"],[i.plural.genera,"genus"],[i.plural.criteria,"$1on"],[i.plural.tia,"$1um"],[i.plural.analyses,"$1$2sis"],[i.plural.hives,"$1ve"],[i.plural.curves,"$1"],[i.plural.lrves,"$1f"],[i.plural.aves,"$1ve"],[i.plural.foves,"$1fe"],[i.plural.movies,"$1ovie"],[i.plural.aeiouyies,"$1y"],[i.plural.series,"$1eries"],[i.plural.xes,"$1"],[i.plural.mice,"$1ouse"],[i.plural.buses,"$1"],[i.plural.oes,"$1"],[i.plural.shoes,"$1"],[i.plural.crises,"$1is"],[i.plural.octopi,"$1us"],[i.plural.aliases,"$1"],[i.plural.summonses,"$1"],[i.plural.oxen,"$1"],[i.plural.matrices,"$1ix"],[i.plural.vertices,"$1ex"],[i.plural.feet,"foot"],[i.plural.teeth,"tooth"],[i.plural.geese,"goose"],[i.plural.quizzes,"$1"],[i.plural.whereases,"$1"],[i.plural.ss,"ss"],[i.plural.s,""]];
|
||||
var c=["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"];var k=new RegExp("(_ids|_id)$","g");
|
||||
var f=new RegExp("_","g");var j=new RegExp("[ _]","g");var e=new RegExp("([A-Z])","g");var h=new RegExp("^_");var b={_apply_rules:function(q,p,o,n){if(n){q=n;
|
||||
}else{var r=(b.indexOf(o,q.toLowerCase())>-1);if(!r){var m=0;var l=p.length;for(;m<l;m++){if(q.match(p[m][0])){if(p[m][1]!==undefined){q=q.replace(p[m][0],p[m][1]);
|
||||
}break;}}}}return q;},indexOf:function(l,r,q,m){if(!q){q=-1;}var o=-1;var p=q;var n=l.length;for(;p<n;p++){if(l[p]===r||m&&m(l[p],r)){o=p;break;}}return o;
|
||||
},pluralize:function(m,l){return b._apply_rules(m,g,d,l);},singularize:function(m,l){return b._apply_rules(m,a,d,l);},inflect:function(o,n,m,l){n=parseInt(n,10);
|
||||
if(isNaN(n)){return o;}if(n===0||n>1){return b._apply_rules(o,g,d,l);}else{return b._apply_rules(o,a,d,m);}},camelize:function(t,o){var v=t.split("/");
|
||||
var r=0;var q=v.length;var u,m,p,n,s;for(;r<q;r++){u=v[r].split("_");p=0;n=u.length;for(;p<n;p++){if(p!==0){u[p]=u[p].toLowerCase();}s=u[p].charAt(0);s=o&&r===0&&p===0?s.toLowerCase():s.toUpperCase();
|
||||
u[p]=s+u[p].substring(1);}v[r]=u.join("");}return v.join("::");},underscore:function(o,p){if(p&&o===o.toUpperCase()){return o;}var l=o.split("::");var n=0;
|
||||
var m=l.length;for(;n<m;n++){l[n]=l[n].replace(e,"_$1");l[n]=l[n].replace(h,"");}return l.join("/").toLowerCase();},humanize:function(m,l){m=m.toLowerCase();
|
||||
m=m.replace(k,"");m=m.replace(f," ");if(!l){m=b.capitalize(m);}return m;},capitalize:function(l){l=l.toLowerCase();return l.substring(0,1).toUpperCase()+l.substring(1);
|
||||
},dasherize:function(l){return l.replace(j,"-");},titleize:function(s){s=s.toLowerCase().replace(f," ");var q=s.split(" ");var p=0;var o=q.length;var r,n,m;
|
||||
for(;p<o;p++){r=q[p].split("-");n=0;m=r.length;for(;n<m;n++){if(b.indexOf(c,r[n].toLowerCase())<0){r[n]=b.capitalize(r[n]);}}q[p]=r.join("-");}s=q.join(" ");
|
||||
s=s.substring(0,1).toUpperCase()+s.substring(1);return s;},demodulize:function(m){var l=m.split("::");return l[l.length-1];},tableize:function(l){l=b.underscore(l);
|
||||
l=b.pluralize(l);return l;},classify:function(l){l=b.camelize(l);l=b.singularize(l);return l;},foreign_key:function(m,l){m=b.demodulize(m);m=b.underscore(m)+((l)?(""):("_"))+"id";
|
||||
return m;},ordinalize:function(s){var q=s.split(" ");var o=0;var n=q.length;for(;o<n;o++){var m=parseInt(q[o],10);if(!isNaN(m)){var r=q[o].substring(q[o].length-2);
|
||||
var p=q[o].substring(q[o].length-1);var l="th";if(r!="11"&&r!="12"&&r!="13"){if(p==="1"){l="st";}else{if(p==="2"){l="nd";}else{if(p==="3"){l="rd";}}}}q[o]+=l;
|
||||
}}return q.join(" ");},transform:function(o,l){var n=0;var m=l.length;for(;n<m;n++){var p=l[n];if(b.hasOwnProperty(p)){o=b[p](o);}}return o;}};b.version="1.12.0";
|
||||
return b;}));
|
||||
+1086
File diff suppressed because it is too large
Load Diff
+142
@@ -0,0 +1,142 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"inflection@1.12.0",
|
||||
"/home/app"
|
||||
]
|
||||
],
|
||||
"_from": "inflection@1.12.0",
|
||||
"_id": "inflection@1.12.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-ogCTVlbW9fa8TcdQLhrstwMihBY=",
|
||||
"_location": "/inflection",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "inflection@1.12.0",
|
||||
"name": "inflection",
|
||||
"escapedName": "inflection",
|
||||
"rawSpec": "1.12.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.12.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sequelize"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/inflection/-/inflection-1.12.0.tgz",
|
||||
"_spec": "1.12.0",
|
||||
"_where": "/home/app",
|
||||
"author": {
|
||||
"name": "dreamerslab",
|
||||
"email": "ben@dreamerslab.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/dreamerslab/node.inflection/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Ryan Schuft",
|
||||
"email": "ryan.schuft@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Ben Lin",
|
||||
"email": "ben@dreamerslab.com"
|
||||
},
|
||||
{
|
||||
"name": "Lance Pollard",
|
||||
"email": "lancejpollard@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Dane O'Connor",
|
||||
"email": "dane.oconnor@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "David Miró",
|
||||
"email": "lite.3engine@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "brandondewitt"
|
||||
},
|
||||
{
|
||||
"name": "luk3thomas"
|
||||
},
|
||||
{
|
||||
"name": "Marcel Klehr"
|
||||
},
|
||||
{
|
||||
"name": "Raymond Feng"
|
||||
},
|
||||
{
|
||||
"name": "Kane Cohen",
|
||||
"email": "kanecohen@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Gianni Chiappetta",
|
||||
"email": "gianni@runlevel6.org"
|
||||
},
|
||||
{
|
||||
"name": "Eric Brody"
|
||||
},
|
||||
{
|
||||
"name": "overlookmotel"
|
||||
},
|
||||
{
|
||||
"name": "Patrick Mowrer"
|
||||
},
|
||||
{
|
||||
"name": "Greger Olsson"
|
||||
},
|
||||
{
|
||||
"name": "Jason Crawford",
|
||||
"email": "jason@jasoncrawford.org"
|
||||
},
|
||||
{
|
||||
"name": "Ray Myers",
|
||||
"email": "ray.myers@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Dillon Shook",
|
||||
"email": "dshook@alumni.nmt.edu"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "A port of inflection-js to node.js module",
|
||||
"devDependencies": {
|
||||
"mocha": "3.2.0",
|
||||
"should": "11.2.0"
|
||||
},
|
||||
"engines": [
|
||||
"node >= 0.4.0"
|
||||
],
|
||||
"homepage": "https://github.com/dreamerslab/node.inflection#readme",
|
||||
"keywords": [
|
||||
"inflection",
|
||||
"inflections",
|
||||
"inflection-js",
|
||||
"pluralize",
|
||||
"singularize",
|
||||
"camelize",
|
||||
"underscore",
|
||||
"humanize",
|
||||
"capitalize",
|
||||
"dasherize",
|
||||
"titleize",
|
||||
"demodulize",
|
||||
"tableize",
|
||||
"classify",
|
||||
"foreign_key",
|
||||
"ordinalize"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/inflection.js",
|
||||
"name": "inflection",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/dreamerslab/node.inflection.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha -R spec"
|
||||
},
|
||||
"version": "1.12.0"
|
||||
}
|
||||
Reference in New Issue
Block a user