Skip to content

Utilities for cli applications and nutty middlewares

License

Notifications You must be signed in to change notification settings

nuttyjs/nutty-util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nutty-util

npm npm npm

Utilities for cli applications and nutty middlewares

Installation

Run the following command on your project folder:

npm install --save nutty-util

API

Include the library on your project:

var util = require('nutty-util');

util.is.{TYPE}(obj)

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

new util.file(path, [ opt])

Returns an instance of a floby object.

var file = new util.file('/path/to/my/file.txt', { encoding: 'utf8' });

util.template(str, obj)

Compile a string template.

var str = util.template('My car is {color}.', { color: 'blue' }); //--> My car is blue.

License

MIT LICENSE © Josemi Juanes.

About

Utilities for cli applications and nutty middlewares

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published