@isaacadams/extensions
v1.1.1
Published
[![Build Status](https://travis-ci.org/isaacadams/extensions.svg?branch=master)](https://travis-ci.org/isaacadams/extensions) [![Coverage Status](https://coveralls.io/repos/github/isaacadams/extensions/badge.svg)](https://coveralls.io/github/isaacadams/e
Downloads
3
Readme
extensions
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