Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @nathanfaucett/singularize with all npm packages installed. Try it out:

var singularize = require("@nathanfaucett/singularize")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@nathanfaucett/singularize v0.0.1

singularize words, uses global inflector from inflections @nathanfaucett/inflections

singularize

singularize words, uses global inflector from inflections @nathanfaucett/inflections

var singularize = require("@nathanfaucett/singularize"),
    inflections = require("@nathanfaucett/inflections");


var en = inflections("en");

en.singular(/s$/i, "");
en.singular(/(ch|sh|ss|[sxz])es$/i, "$1");
en.singular(/([^aeiouy])ies$/i, "$1y");

singularize("words") === "word";
singularize("skies") === "sky";
singularize("boxes") === "box";
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free