Truncates all strings in an array to the minimum length required to keep them unique.
Uses UMD module declaration.
The module will load as a single global function "truncated" in a browser. Will return as a node module function in node. Works with AMD.
const truncated = require('truncated');
const longArray = ['monday', 'tuesday', 'wednesday'];
const short = truncated(longArray);
// ['m', 't', 'w'] 🙌
const truncated = require('truncated');
const longArray = ['monday', 'tuesday', 'wednesday', 'thursday'];
const short = truncated(longArray);
// ['mo', 'tu', 'we', 'th'] 🙌
truncated
is taking in all arguments passed as an array, and returning the first minimum instance in which each index is unique.
$ yarn add truncated
$ yarn test
- Henry Kaufman - Designer and Developer
- Jake Billings - Full-stack Web Developer
MIT © Henry Kaufman