/clairity

:wrench: Claire's Utility JS functions

Primary LanguageJavaScriptMIT LicenseMIT

clairity NPM version Build Status Dependency Status Coverage percentage

Claire's Utility JavaScript functions. 🔩🔧

Inspired by 1-liners - even though they aren't 1-liners.

Installation

From the command line, on a computer with node installed:

npm i clairity

Usage

The package is made up of the following four functions. You can use them one-by-one as shown below:

var ifThen = require('clairity').ifThen;
ifThen('3 > 4', 'foo');
// 'foo'
var howMany = require('clairity').howMany;
howMany(['a', 'b', 'a'], 'a');
// 2
var itContains = require('clairity').itContains;
itContains('foobar' 'oo');
// true
var replaceWhitespace = require('clairity').replaceWhitespace;
replaceWhitespace('foo bar', '-');
// 'foo-bar'

Or you can pull in the entire module and use functions when required.

var c = require('clairity');
c.ifThen('4 > 2', 'wah');

Run the tests

Clone the repo, install the dependencies and then from the command line:

npm test

Code of conduct

Here. 🌟👫☀️

License

MIT © Claire Parker