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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jocam/js

v1.0.0

Published

Javascript tools

Readme

@jocam/js

Javascript utility library used across @jocam projects.

TOC

const { clone } = require('@jocam/js');
//or
const clone = require('@jocam/js/clone'); //lodash way (less memory consumption)
> const clone = require('@jocam/js/clone');
undefined
> const a = { a: 1}
undefined
> const b = clone(a)
undefined
> a === b
false

removeNulls

Creates a copy of the object removing the null values in the process

Parameters

  • obj object object to remove nulls from
  • options object?
    • options.doProcessArrays boolean (optional, default false)
    • options.maxDepth number?

Examples

const removeNulls = require('@jocam/js/remove-nulls');
// or
const { removeNulls } = require('@jocam/js');
// or (if you are in frontend)
import removeNulls from '@jocam/is';

removeNulls({ a: null }); // {}
removeNulls({ a: { b: null } }); // {}
removeNulls({ a: 'a', b: null }); // { a: 'a' }
removeNulls({ a: 'a', b: { c: 'c', d: null } }); // { a: 'a', b: { c: 'c' }}

Returns object

Type validations

checkType

returns the type of value

Parameters:

  • value any value to check

Examples:

const { checkType } = require('@jocam/js');
//lodash style (reduce memory consumption)
const checkType = require('@jocam/js/checkType');
// or if you are in frontend:
import { checkType } from '@jocam/js';

console.log(check(1)); // number
console.log(check(false)); // boolean
console.log(check('1')); // string

Returns string

isBoolean

check if value type is boolean

Parameters:

Examples:

const { isBoolean } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isBoolean = require('@jocam/js/isBoolean');
// or if you are in frontend:
import { isBoolean } from '@jocam/js';

console.log(isBoolean(0)); // false
console.log(isBoolean(1)); // false
console.log(isBoolean(true)); // true
console.log(isBoolean(false)); // true
console.log(isBoolean(!!0)); // true

Returns boolean

isString

check if value type is string

Parameters:

Examples:

const { isString } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isString = require('@jocam/js/isString');
// or if you are in frontend:
import { isString } from '@jocam/js';

console.log(isString(0)); // false
console.log(isString(1)); // false
console.log(isString('true')); // true
console.log(isString('false')); // true

Returns boolean

isDate

check if value type is date

Parameters:

  • value date value to check

Examples:

const { isDate } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isDate = require('@jocam/js/isDate');
// or if you are in frontend:
import { isDate } from '@jocam/js';

const today = new Date();
const now = Date.now();

console.log(isDate()); // false
console.log(isDate(now)); // false
console.log(isDate(today)); // true

Returns boolean

isNumber

check if value type is number

Parameters:

Examples:

const { isNumber } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isNumber = require('@jocam/js/isNumber');
// or if you are in frontend:
import { isNumber } from '@jocam/js';

const now = Date.now();

console.log(isNumber(!!0)); // false
console.log(isNumber('pepe')); // false
console.log(isNumber(0)); // true
console.log(isNumber(now)); // true

Returns boolean

isUndefined

check if value is undefined

Parameters:

Examples:

const { isUndefined } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isUndefined = require('@jocam/js/isUndefined');
// or if you are in frontend:
import { isUndefined } from '@jocam/js';

console.log(isUndefined()); // true
console.log(isUndefined(undefined)); // true
console.log(isUndefined(null)); // false

Returns boolean

isNull

check if value is null

Parameters:

  • value null value to check

Examples:

const { isNull } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isNull = require('@jocam/js/isNull');
// or if you are in frontend:
import { isNull } from '@jocam/js';

console.log(isNull()); // false
console.log(isNull(undefined)); // false
console.log(isNull(null)); // true

Returns boolean

isObject

check if value type is object

Parameters:

Examples:

const { isObject } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isObject = require('@jocam/js/isObject');
// or if you are in frontend:
import { isObject } from '@jocam/js';

console.log(isObject(0)); // false
console.log(isObject({ a: 1 })); // true
console.log(isObject({})); // true

Returns boolean

isArray

check if value type is array

Parameters:

  • value array value to check

Examples:

const { isArray } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isArray = require('@jocam/js/isArray');
// or if you are in frontend:
import { isArray } from '@jocam/js';

console.log(isArray('pepe')); // false
console.log(isArray(['pepe'])); // true
console.log(isArray([])); // true

Returns boolean

isError

check if value type is error

Parameters:

  • value error value to check

Examples:

const { isError } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isError = require('@jocam/js/isError');
// or if you are in frontend:
import { isError } from '@jocam/js';

const error = new Error('pepe');

console.log(isError()); // false
console.log(isError({ code: 'A', message: 'B' })); // false
console.log(isError(error)); // true

Returns boolean

isFunction

check if value type is function

Parameters:

Examples:

const { isFunction } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isFunction = require('@jocam/js/isFunction');
// or if you are in frontend:
import { isFunction } from '@jocam/js';

console.log(isFunction(a => a)); // true

Returns boolean

isEmpty

check if value is an empty string, object or array

Parameters:

Examples:

const { isEmpty } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isEmpty = require('@jocam/js/isEmpty');
// or if you are in frontend:
import { isEmpty } from '@jocam/js';

console.log(isEmpty()); // false
console.log(isEmpty({ a: 1 })); // false
console.log(isEmpty('hi!')); // false
console.log(isEmpty([1, 2])); // false
console.log(isEmpty({})); // true
console.log(isEmpty('')); // true
console.log(isEmpty([])); // true

Returns boolean

isRegExp

check if value type is a Regular Expression

Parameters:

Examples:

const { isRegExp } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isRegExp = require('@jocam/js/isRegExp');
// or if you are in frontend:
import { isRegExp } from '@jocam/js';

Returns boolean

isSymbol

check if value type is Symbol

:Parameters

Examples:

const { isSymbol } = equire('@jocam/js');
//lodash style (reduce memory consumption)
const isSymbol = require('@jocam/js/isSymbol');
// or if you are in frontend:
import { isSymbol } from '@jocam/js';

Returns boolean