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

wf_core_nodejs

v1.0.1

Published

core library of reusable code

Readme

WF_Core_NodeJS

core library of reusable code for use in various projects

Installation

npm install @weaverfundraising/wf_core_nodejs

Usage

HTTPS

Send GET Request

const {getRequest} = require('@weaverfundraising/wf_core_nodejs/https');

const options = {
    hostname: 'somedomain.com',
    path: '/api/route/id/1'
};

const headers = {
    "X-App": "my-x-app-token"
}

const result = await getRequest(options.hostname, options.path, headers).catch(err => {});

if (result && typeof result === 'string') {
    try {
        result = JSON.parse(result);
    } catch (err) {}
}

Send POST Request

const {postRequest} = require('@weaverfundraising/wf_core_nodejs/https');

const options = {
    hostname: 'somedomain.com',
    path: '/api/route/id/1'
};

const payload = {
    apiKey: 'my-api-key',
    id: 1,
    name: 'some variable'
};

const headers = {
    "X-App": "my-x-app-token"
}

const result = await postRequest(options.hostname, options.path, payload, headers).catch(err => {});

if (result && typeof result === 'string') {
    try {
        result = JSON.parse(result);
    } catch (err) {}
}

Util

isNull | notNull

const {isNull, notNull} = require('@weaverfundraising/wf_core_nodejs/util');

let myVar = null;

if (isNull(myVar)) { ... }
if (notNull(myVar)) { ... }

isEmpty | notEmpty

const {isEmpty} = require('@weaverfundraising/wf_core_nodejs/util');

const str = 'not empty';
const empty = ' ';
const arr = [1,2,3];
const nil = null;

if (isEmpty(str)) { ... }
if (isEmpty(empty)) { ... }
if (isEmpty(arr)) { ... }
if (isEmpty(nil)) { ... }

if (notEmpty(str)) { ... }
if (notEmpty(empty)) { ... }
if (notEmpty(arr)) { ... }
if (notEmpty(nil)) { ... }

isAFunction

const {isAFunction} = require('@weaverfundraising/wf_core_nodejs/util');

const fn = () => {};
const notAFn = "hello, world!";

if (isAFunction(fn)) { ... }
if (isAFunction(notAFn)) { ... }

toString

const {toString} = require('@weaverfundraising/wf_core_nodejs/util');

const obj = {Desc: "Object to convert to String"};
const str = "String will not change";
const num = 10.45;

const objStr = toString(obj);
const strStr = toString(str);
const numStr = toString(num);

toNumber

const {toNumber} = require('@weaverfundraising/wf_core_nodejs/util');

const num_1 = toNumber("123.45");
const num_2 = toNumber("NaN");
const num_3 = toNumber(35);

toBoolean

const {toBoolean} = require('@weaverfundraising/wf_core_nodejs/util');

const bool_1 = toBoolean(1);
const bool_2 = toBoolean("true");

deepClone

const {deepClone} = require('@weaverfundraising/wf_core_nodejs/util');

const obj1 = {
    value: {
        sub1: {
            deep: "clone"
        },
        sub2: "Weird"
    },
    desc: "something blah blah",
    data: [
        {some: "data"},
        "other data",
        123
    ]
};

const clone = deepClone(obj1);

randomNumber

const {randomNumber} = require('@weaverfundraising/wf_core_nodejs/util');

const num_1 = randomNumber();
const num_2 = randomNumber(50);
const num_3 = randomNumber(100, 1000);

randomString

const {randomString} = require('@weaverfundraising/wf_core_nodejs/util');

const str_1 = randomString();
const str_2 = randomString(50);
const str_3 = randomString(-1);

Validation

Validate Phone Number Format

const {isValidPhone} = require('@weaverfundraising/wf_core_nodejs/validation');

const isValid = isValidPhone('123-456-7890'); 

Validate Email Format

const {isValidEmail} = require('@weaverfundraising/wf_core_nodejs/validation');

const isValid = isValidEmail('[email protected]');

Money

const {WFMoney} = require('@weaverfundraising/wf_core_nodejs/money');

const money_1 = new WFMoney(10.50);
money_1.add(5);
money_1.subtract(1);
const currency = money_1.amount('c');
const pennies = money_1.amount('p');
const value = money_1.value;