beedrill

1.1.1 • Public • Published

Beedrill

A micro library containing high level utility functions.

Installation

Install beedrill by running:

$ npm install --save beedrill

Documentation

beedrill.isUndefined(value) ⇒ Boolean

Returns a boolean indicating if the value is undefined.

Kind: static method of beedrill
Returns: Boolean - - true if the value is undefined, false otherwise.
Access: public

Param Type Description
value Mixed Value to check.

Example

const B = require('beedrill');

var foo;

B.isUndefined(foo); // --> true

beedrill.isString(value) ⇒ Boolean

Returns a boolean indicating if the value is a string.

Kind: static method of beedrill
Returns: Boolean - - true if the value is a string, false otherwise.
Access: public

Param Type Description
value Mixed Value to check.

Example

const B = require('beedrill');

const foo = 'string';
const bar = 123;

B.isString(foo); // --> true
B.isString(bar); // --> false

beedrill.isArray(value) ⇒ Boolean

Returns a boolean indicating if the value is an array.

Kind: static method of beedrill
Returns: Boolean - - true if the value is an array, false otherwise.
Access: public

Param Type Description
value Mixed Value to check.

Example

const B = require('beedrill');

const foo = 'string';
const bar = [1, 2, 3];

B.isArray(foo); // --> false
B.isArray(bar); // --> true

beedrill.isObject(value) ⇒ Boolean

Returns a boolean indicating if the value is an object literal.

Kind: static method of beedrill
Returns: Boolean - - true if the value is an object, false otherwise.
Access: public

Param Type Description
value Mixed Value to check.

Example

const B = require('beedrill');

const foo = 'string';
const bar = { hello: 'world' };

B.isObject(foo); // --> false
B.isObject(bar); // --> true

beedrill.has(object, key) ⇒ Boolean

Checks if key is a direct property of object.

Kind: static method of beedrill
Returns: Boolean - - Returns true if the key exists, else false.
Access: public

Param Type Description
object Object The object to check.
key String The key to check.

Example

const B = require('beedrill');

const foo = { hello: 'world' };

B.has(foo, 'bar'); // --> false
B.has(foo, 'hello'); // --> true

beedrill.keys(object) ⇒ Array

Creates an array of the own enumerable property names of object.

Kind: static method of beedrill
Returns: Array - - An array of property names.
Access: public

Param Type Description
object Object The object to retrieve property names from.

Example

const B = require('beedrill');

const object = {
  hello: 'world',
  foo: 'bar'
};

B.keys(object); // --> ['hello', 'foo']

beedrill.pick(object, keys) ⇒ Object

Creates an object composed of the picked object properties.

Kind: static method of beedrill
Returns: Object - - The new object.
Access: public

Param Type Description
object Object The source object.
keys String | Array The property keys to pick.

Example

const B = require('beedrill');

const object = {
  foo: 1,
  bar: 2,
  hello: 3
};

B.pick(object, 'foo'); // --> { foo: 1 }
B.pick(object, ['bar', 'hello']); // --> { bar: 2, hello: 3 }

beedrill.clone(value) ⇒ Object

Creates a clone of a simple object

Kind: static method of beedrill
Returns: Object - - The cloned object.
Access: public
Todo

Param Type Description
value Object The object to clone.

Example

const B = require('beedrill');

const object = { foo: 'bar' };

B.clone(object); // --> { foo: 'bar' }

beedrill.random(min, max) ⇒ Number

Returns a random integer between min and max, inclusive.

Kind: static method of beedrill
Returns: Number - - A random number between min and max
Access: public

Param Type Description
min Number The lowest possible random number.
max Number The highest possible random number.

Example

const B = require('beedrill');

const num = B.random(0, 100); // --> 36

beedrill.unique(array) ⇒ Array

Produces a duplicate-free version of the array, using === to test object equality.

Kind: static method of beedrill
Returns: Array - - Returns the new duplicate free array.
Access: public

Param Type Description
array Array The array to inspect

Example

const B = require('beedrill');

const source = [1, 2, 3, 1, 5, 5, 3, 2, 1];

const uniqueSource = B.unique(source); // -->  [1, 2, 3, 5,]

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i beedrill

    Weekly Downloads

    0

    Version

    1.1.1

    License

    MIT

    Last publish

    Collaborators

    • lucianbuzzo