Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "inflected", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A port of ActiveSupport's inflector to Node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/umd/inflected.js", |
@@ -14,3 +14,15 @@ # inflected | ||
Or via yarn: | ||
```bash | ||
% yarn add inflected | ||
``` | ||
The UMD build is also available on [unpkg](https://unpkg.com/), adding a `Inflector` object to the global scope. | ||
```html | ||
<script src="https://unpkg.com/inflected/dist/umd/inflected.min.js"></script> | ||
``` | ||
## Usage | ||
@@ -26,2 +38,10 @@ | ||
If using ES modules, you can cherry-pick only the functions you're interested in: | ||
```js | ||
import { pluralize } from 'inflected'; | ||
pluralize('Category') // => 'Categories' | ||
``` | ||
Here is the complete API reference: | ||
@@ -41,8 +61,8 @@ | ||
```js | ||
Inflector.pluralize('post') // => 'posts' | ||
Inflector.pluralize('octopus') // => 'octopi' | ||
Inflector.pluralize('sheep') // => 'sheep' | ||
Inflector.pluralize('words') // => 'words' | ||
Inflector.pluralize('CamelOctopus') // => 'CamelOctopi' | ||
Inflector.pluralize('ley', 'es') // => 'leyes' | ||
Inflector.pluralize('post') // => 'posts' | ||
Inflector.pluralize('octopus') // => 'octopi' | ||
Inflector.pluralize('sheep') // => 'sheep' | ||
Inflector.pluralize('words') // => 'words' | ||
Inflector.pluralize('CamelOctopus') // => 'CamelOctopi' | ||
Inflector.pluralize('ley', 'es') // => 'leyes' | ||
``` | ||
@@ -62,8 +82,8 @@ | ||
```js | ||
Inflector.singularize('posts') // => 'post' | ||
Inflector.singularize('octopi') // => 'octopus' | ||
Inflector.singularize('sheep') // => 'sheep' | ||
Inflector.singularize('word') // => 'word' | ||
Inflector.singularize('CamelOctopi') // => 'CamelOctopus' | ||
Inflector.singularize('leyes', 'es') // => 'ley' | ||
Inflector.singularize('posts') // => 'post' | ||
Inflector.singularize('octopi') // => 'octopus' | ||
Inflector.singularize('sheep') // => 'sheep' | ||
Inflector.singularize('word') // => 'word' | ||
Inflector.singularize('CamelOctopi') // => 'CamelOctopus' | ||
Inflector.singularize('leyes', 'es') // => 'ley' | ||
``` | ||
@@ -81,4 +101,4 @@ | ||
```js | ||
Inflector.camelize('foo_bar') // => 'FooBar' | ||
Inflector.camelize('foo_bar', false) // => 'fooBar' | ||
Inflector.camelize('foo_bar') // => 'FooBar' | ||
Inflector.camelize('foo_bar', false) // => 'fooBar' | ||
``` | ||
@@ -89,3 +109,3 @@ | ||
```js | ||
Inflector.camelize(Inflector.underscore('SSLError')) //=> 'SslError' | ||
Inflector.camelize(Inflector.underscore('SSLError')) // => 'SslError' | ||
``` | ||
@@ -102,3 +122,3 @@ | ||
```js | ||
Inflector.underscore('FooBar') // => 'foo_bar' | ||
Inflector.underscore('FooBar') // => 'foo_bar' | ||
``` | ||
@@ -109,3 +129,3 @@ | ||
```js | ||
Inflector.camelize(Inflector.underscore('SSLError')) //=> 'SslError' | ||
Inflector.camelize(Inflector.underscore('SSLError')) // => 'SslError' | ||
``` | ||
@@ -180,3 +200,3 @@ | ||
```js | ||
Inflector.classify('business') // => 'Busines' | ||
Inflector.classify('business') // => 'Busines' | ||
``` | ||
@@ -204,3 +224,3 @@ | ||
Creates a foreign key name from a class name. `separateClassNameAndIdWithUnderscore` sets whether the method should put "_" between the name and "id". | ||
Creates a foreign key name from a class name. `separateClassNameAndIdWithUnderscore` sets whether the method should put "_" between the name and "id" (default: `true`). | ||
@@ -284,4 +304,3 @@ ```js | ||
Default approximations are provided for Western/Latin characters, | ||
e.g, "ø", "ñ", "é", "ß", etc. | ||
Default approximations are provided for Western/Latin characters, e.g, "ø", "ñ", "é", "ß", etc. | ||
@@ -326,9 +345,5 @@ This method is I18n-aware, so you can set up custom approximations for a locale. This can be useful, for example, to transliterate German's "ü" and "ö" to "ue" and "oe", or to add support for transliterating Russian to ASCII. | ||
1. Fork the repo and `make install`. | ||
2. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: `make test`. | ||
3. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or are fixing a bug, we need a test! | ||
4. Make the test pass. | ||
5. Push to your fork and submit a pull request. | ||
@@ -335,0 +350,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
153156
31
343
0