Skip to content

isaacadams/extensions

Repository files navigation

extensions

Build Status Coverage Status

helpful extensions methods for javascript objects

Arrays

[ 1, 3, 5, 8, 21 ].take(3); // returns [ 1, 3, 5]
[ 1, 3, 5, 8, 21 ].takeFromEnd(2); // returns [ 8, 21 ]
[ 1, 3, 5, 8, 21 ].takeRandomly(4); // returns an array of length 4 with randomly selected items from the original array

Strings

"".isNullOrWhitespace(); // returns true
"   ".isNullOrWhitespace(); // returns true
"hello world".isNullOrWhitespace(); // returns false

fs

/// if the directory at the given path already exists, this function will return true
/// if the directory & subdirectories do not exist, this function will create them and return true
/// if anything goes wrong, it will return false
let result = fs.ensureDirectoryExists('./path/to/directory'); // returns true/false

About

a collection of javascript extension methods

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published