@atsjj/inflector
v0.1.0
Published
Inflector is a library that is compatible with ActiveSupport::Inflector.
Downloads
1
Readme
Inflector
Inflector is a library that is compatible with ActiveSupport::Inflector. Inflector has first-class support for Deno and TypeScript, but also ships with support for Node CommonJS and ES Modules.
Inflector is based on the work of Ember Inflector and Ember.js.
Install (Node)
npm install --save @atsjj/inflector;
Usage
Deno
import { pluralize, singularize } from "https://deno.land/x/inflector/mod.ts";
console.log(pluralize("cat")) // "cats"
console.log(singularize("searches")) // "search"
Browser
<script type="module">
import { pluralize, singularize } from "https://cdn.skypack.dev/@atsjj/inflector";
console.log(pluralize("cat")) // "cats"
console.log(singularize("searches")) // "search"
</script>
Node / ESM
import { pluralize, singularize } from "@atsjj/inflector";
console.log(pluralize("cat")) // "cats"
console.log(singularize("searches")) // "search"
Node / CJS
const { pluralize, singularize } = require("@atsjj/inflector");
console.log(pluralize("cat")) // "cats"
console.log(singularize("searches")) // "search"