futile
Collection of low level ECMAScript helper functions targeting language primitives and native objects


Import the library
const futile = require('@fiverr/futile');
futile.shuffle([1, 2, 3]);
futile.interpolate('Hello, ${name}', {name: 'Martin'});
Import individual methods
const shuffle = require('@fiverr/futile/lib/shuffle');
const interpolate = require('@fiverr/futile/lib/interpolate');
shuffle([1, 2, 3]);
interpolate('Hello, ${name}', {name: 'Martin'});
Working with futile repo
Playground
The "playground" directory is a place you can write test modules, and include futile as a module.
It's node_modules contains a symlink to the parent directory so you're working with your actual work files.
The content of this directory is gitignored (short of example file and futile virtual module) so feel free to add your sandbox files there
Tests and builds
Lint code
npm run lint
Test some
npm test interpolate
npm test interpolate shuffle
Test all
npm test
Benchmark some
npm run benchmark uri
Benchmark all
npm run benchmark
Coverage
npm run coverage
Rebuild docs
npm run doc
Contributing to futile repo
Each module contains an index file - the exported module, and a test file.
Modules should be commented in JSDoc so the automated documentation is up to date.
The lib
's index should expose all the collection.
Version management
The version number specify major
.minor
.patch
Type | Content | Example |
---|
patch | Internal fix | Bug fix, Performance improvements, tests, small tweaks |
minor | Interface change with full backward compatibility | Adding new features, Full backwards compatibility |
major | Interface change without full backward compatibility | Changing a function name or interface, Removing a function |