Utilities for cli applications and nutty middlewares
Run the following command on your project folder:
npm install --save nutty-util
Include the library on your project:
var util = require('nutty-util');
Returns true
or false
if the provided object is the specified type.
//Check for undefined
util.is.undef(a); // --> true
//Check for boolean
util.is.boolean(true); // --> true
util.is.boolean(1); // --> false
util.is.boolean('false'); // --> false
//Check for string
util.is.string('my string'); // --> true
util.is.string(0.987); // --> false
//Check if string is in lower or upper case
util.is.lowerCase('my string'); // --> true
util.is.upperCase('MY string'); // --> false
//Check for number
util.is.num('0'); // --> false
//Check for integer
util.is.int(0.12); // --> false
//Check for null
util.is.null(null); // --> true
Returns an instance of a floby object.
var file = new util.file('/path/to/my/file.txt', { encoding: 'utf8' });
Compile a string template.
var str = util.template('My car is {color}.', { color: 'blue' }); //--> My car is blue.
MIT LICENSE © Josemi Juanes.