npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

beedrill

v1.1.1

Published

A tiny library of utility functions

Downloads

3

Readme

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

  • [ ] expand types that can be cloned using https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm

| 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,]