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

isdo

v0.0.2

Published

Simple, basic, but robust javascript utilities.

Downloads

33

Readme

isdo

A simple, basic, and robust set of utilities for javascript - inspired by, but not copied from, lodash.

Table of Contents

  1. Installation
  2. Examples
  3. Usage
  4. Roadmap

Installation

$ npm i -S isdo

Examples

const { is } = require('isdo');

let foo;
is.defined(foo); // => false
is.missing(foo); // => true

foo = null;
is.defined(foo) // => true
is.missing(foo) // => true

const arry = [];
is.array(arry); // => true
is.empty(arry); // => true

arry.push(1);
is.empty(arry); // => false

Usage

is

Extending is

You can add your own useful comparisons and checks by using is.extend.

type comparisons

presence checks

quality checks

truthy/falsey checks

extending with custom methods

is.all

presence checks

truthy/falsey checks

is.any

presence checks

truthy/falsey checks


is

is.array(target)

Returns

true if target is an array, otherwise false.

is.boolean(target)

Returns

true if target is a boolean, otherwise false.

is.float(target)

Returns

true if target is a float, otherwise false.

is.function(target)

Returns

true if target is a function, otherwise false.

is.integer(target)

Returns

true if target is an integer, otherwise false.

is.iterable(target)

Returns

true if target conforms to the iterable protocol, otherwise false.

is.map(target)

Returns

true if target is a map, otherwise false.

is.number(target)

Returns

true if target is a number (integer or float), otherwise false.

is.object(target)

Returns

true if target is a plain object, otherwise false.

is.set(target)

Returns

true if target is a set, otherwise false.

is.string(target)

Returns

true if target is a string, otherwise false.

is.defined(target)

Returns

true if target is NOT undefined, otherwise false.

is.missing(target)

Returns

true if target is either undefined or null, otherwise false.

is.notNull(target)

Returns

true if target is anything other than null, even undefined, otherwise false.

is.present(target)

Returns

true if target is both defined and not null, otherwise false.

is.blank(target)

Returns

true if target string is missing or has length < 1, otherwise false.

is.empty(target)

Returns

true if target's length < 1, otherwise false.

If target is an array or string, length = target.length, if target is a map or set, length = target.size, if target is an object, length = number of keys in target, otherwise length = 0.

is.true(target)

Returns

true if target is a string and is one of ["t", "true", "1"], or if target is a number and is > 0, or if target is a boolean and is true, otherwise returns false.

Ignores capitalization.

is.false(target)

Returns

true if target is a string and is one of ["f", "false", "0"], or if target is a number and is <= 0, or if target is a boolean and is false, otherwise returns false.

Ignores capitalization.

is.extend(source)

Transfers functions and nested functions from source to is.

Example

const moment = require('moment');
const isdo = require('is');

const is = isdo.is.extend({
  date: obj => moment.isDate(obj),
});

is.date('foo'); // => false
is.date(new Date()); // => true

is.all

is.all.defined(targets)

Returns

true if all targets are defined, otherwise false.

is.all.undefined(targets)

Returns

true if all targets are undefined, otherwise false.

is.all.present(targets)

Returns

true if all targets are neither null nor undefined, otherwise false.

is.all.missing(targets)

Returns

true if all targets are null or undefined, otherwise false.

is.all.true(targets)

Returns

true if all targets are truthy, otherwise false.

is.all.false(targets)

Returns

true if all targets are falsey, otherwise false.

is.any

is.any.defined(targets)

Returns

true if at least one of targets are defined, otherwise false.

is.any.undefined(targets)

Returns

true if at least one of targets are undefined, otherwise false.

is.any.present(targets)

Returns

true if at least one of targets are neither null nor undefined, otherwise false.

is.any.missing(targets)

Returns

true if at least one of targets are null or undefined, otherwise false.

is.any.true(targets)

Returns

true if at least one of targets are truthy, otherwise false.

is.any.false(targets)

Returns

true if at least one of targets are falsey, otherwise false.

Roadmap

  • [x] is module for common comparisons and checks i/e undefined, null, object, etc
  • [ ] do module for common functions i/e merge, get, etc
  • [ ] Get feedback and iterate