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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@webther/util

v1.0.14

Published

Util JavaScript Helper Functions.

Readme

Util JavaScript Functions

List of functions

Validator

  • isBlank()
  • isBoolean()
  • usEmail()
  • isJson()

Array

  • getEleByKeys()

String

  • toLowerCase()
  • toUpperCase()
  • toCamelCase()
  • toPascalCase()
  • toSlugCase()

Setup the node module

Install the node module to your project.

$ cd PATH_TO_YOUR_PROJECT
$ npm i @webther/util

Load the '@webther/util' module.

var util = require("@webther/util");

or

import util from '@webther/util';

Validator functions usage

  • isBlank()
util.isBlank(); // true
util.isBlank(''); // true
util.isBlank(null); // true
util.isBlank(undefined); // true
util.isBlank([]); // true
util.isBlank({}); // true

util.isBlank('0'); // false
util.isBlank('1'); // false
util.isBlank(0); // false
util.isBlank(1); // false
util.isBlank(true); // false
util.isBlank(false); // false

util.isBlank([1, 2, 3]); // false
util.isBlank({name: 'Jay'}); // false
util.isBlank(function() {}); // false
  • isBoolean()
util.isBoolean(); // false
util.isBoolean(''); // false
util.isBoolean(null); // false
util.isBoolean(undefined); // false

util.isBoolean(true); // true
util.isBoolean(false); // true
util.isBoolean('true', true); // true
util.isBoolean('false', true); // true
util.isBoolean('true', false); // false
util.isBoolean('false', false); // false

util.isBoolean(1); // false
util.isBoolean(0); // false
  • isEmail()
util.isEmail(); // false
util.isEmail(''); // false
util.isEmail(null); // false
util.isEmail(undefined); // false

util.isEmail('@gmail.com'); // false
util.isEmail('abc@gmail'); // false
util.isEmail('[email protected]'); // false
util.isEmail('[email protected]'); // false
util.isEmail('[email protected]'); // false

util.isEmail('[email protected]'); // true
  • isJson()
util.isJson(); // false
util.isJson(''); // false
util.isJson(null); // false
util.isJson(undefined); // false
util.isJson('[ [ "name": "Jay" ] ]'); // false
util.isJson('{ { "name": "Jay" } }'); // false

util.isJson('""'); // true
util.isJson('[]'); // true
util.isJson('{}'); // true
util.isJson('[{"name": "Jay"}]'); // true
util.isJson('{"name": "Jay"}'); // true

Array functions usage

  • getEleByKeys()
var person = {
  name: 'Jay',
  gender: 'Male',
  skills: [
    'JavaScript',
    'Angular',
    'Vuejs'
  ],
  ssn: '111-11-1111'
};
util.getEleByKeys(person, 'name'); // Jay
util.getEleByKeys(person, 'gender'); // Male
util.getEleByKeys(person, 'skills'); // ['JavaScript', 'Angular', 'Vuejs']
util.getEleByKeys(person, 'skills|0'); // JavaScript

util.getEleByKeys(person, 'age'); // ''
util.getEleByKeys(person, 'skills|10'); // ''
var people = [{
  name: 'Jay',
  gender: 'Male'
}];
for (var i = 0; i < people.length; i++) {
  util.getEleByKeys(people[i], 'name'); // Jay
  util.getEleByKeys(people[i], 'gender'); // Male
}

util.getEleByKeys(people, '0|name'); // Jay
util.getEleByKeys(people, '0|gender'); // Male

String functions usage

  • toLowerCase()
util.toLowerCase('Hello World'); // hello world
util.toLowerCase('123'); // 123
util.toLowerCase(123); // 123
util.toLowerCase(0.25); // 0.25
  • toUpperCase()
util.toUpperCase('Hello World'); // HELLO WORLD
util.toUpperCase('123'); // 123
util.toUpperCase(123); // 123
util.toUpperCase(0.25); // 0.25
  • toCamelCase()
util.toCamelCase(''); // ''
util.toCamelCase(null); // ''
util.toCamelCase(undefined); // ''

util.toCamelCase(123); // 123
util.toCamelCase('123 45 6789'); // 123456789
util.toCamelCase('123 abc 6789'); // 123Abc6789
util.toCamelCase('123 45 abc'); // 12345Abc

util.toCamelCase('a'); // a
util.toCamelCase('HELLOWORLD'); // helloworld
util.toCamelCase('HELLOWorld'); // helloWorld
util.toCamelCase('HelloWorld'); // helloWorld
util.toCamelCase('helloWORLD'); // helloWorld

util.toCamelCase('Hello World'); // helloWorld
util.toCamelCase('--Hello--World--'); // helloWorld
util.toCamelCase('__Hello__World__'); // helloWorld
  • toPascalCase()
util.toPascalCase(); // ''
util.toPascalCase(''); // ''
util.toPascalCase(null); // ''
util.toPascalCase(undefined); // ''

util.toPascalCase(123); // 123
util.toPascalCase('123 45 6789'); // 123456789
util.toPascalCase('123 abc 6789'); // 123Abc6789
util.toPascalCase('123 45 abc'); // 12345Abc

util.toPascalCase('a'); // A
util.toPascalCase('HELLOWORLD'); // Helloworld
util.toPascalCase('HELLOWorld'); // HelloWorld
util.toPascalCase('HelloWorld'); // HelloWorld
util.toPascalCase('helloWORLD'); // HelloWorld

util.toPascalCase('Hello World'); // HelloWorld
util.toPascalCase('--Hello--World--'); // HelloWorld
util.toPascalCase('__Hello__World__'); // HelloWorld
  • toSlugCase()
util.toSlugCase('123 45 6789'); // 123456789
util.toSlugCase('Hello World'); // hello-world
util.toSlugCase('--hello--world--'); // hello-world
util.toSlugCase('..hello..world..'); // hello-world
util.toSlugCase('  hello  world  '); // hello-world
util.toSlugCase('helloWorld'); // hello-world
util.toSlugCase('HelloWorld'); // hello-world