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

raj-tools

v1.0.5

Published

My toolset

Downloads

33

Readme

Raj - Toolset DANGER! Build Status Coverage Status

My toolset of day a day, in a simple library.

UNDER F*CKING CONSTRUCTION!!!

Made with love :heart:

Dancing

Indian Installation

npm install --save raj-tools

Arrays Indian Helpers

Difference between 2 arrays

let array1 = [1, 2, 3, 4];
let array2 = [3, 4, 5, 6];

let diff = raj.diff(array1, array2);

console.log(diff);

// [ 1, 2, 5, 6 ]

Difference between base array and comparator array

let arrayBase = [1, 2, 3, 4];
let arrayComparator = [3, 4, 5, 6];

let diff = raj.diffBase(arrayBase, arrayComparator)

console.log(diff);

// [ 1, 2 ]

Common itens between Arrays

let arr1 = [1, 2, 3, 4];
let arr2 = [4, 5, 6];

let common = raj.common(arr1, arr2);

console.log(common);

// [ 4 ]

Array Sum

let array = [5, 5, 10, 30];

let sum = raj.sumArray(array);

console.log(sum);

// 50

Random Item in Array

let array = [5, 5, 10, 30];

let rand = raj.randItem(array);

console.log(rand);

// 5...

Split arrays on x arrays

This sh*t save my life on batch parallel processing

let array = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17];
let numberOfItems = 5;

let batch = raj.split(array, numberOfItems);

console.log(batch);

// [ [ 1, 2, 3, 4, 5 ],
//  [ 6, 7, 8, 9, 10 ],
//  [ 11, 12, 13, 14, 15 ],
//  [ 16, 17 ] ]

Split arrays by determinate object key item

This shit save my life in parallel processing


let expendables = [
    {queue: "a", data: "Barney Ross"},
    {queue: "a", data: "Lee Christmas"},
    {queue: "b", data: "Yin Yang"},
    {queue: "c", data: "Gunnar Jensen"},
    {queue: "c", data: "Paine"}
];

let queues = raj.plop(expendables, 'queue');

console.log(queues);

// { 
//     a: [ { queue: 'a', data: 'Barney Ross' },
//      { queue: 'a', data: 'Lee Christmas' }],
//     b: [ { queue: 'b', data: 'Yin Yang' } ],
//     c: [ { queue: 'c', data: 'Gunnar Jensen' },
//      { queue: 'c', data: 'Paine' } ] 
// }

Math Indian Helpers

Coming soon...

Objects Indian Helpers

Select from object

const object = {
    name: 'hello',
    id: 3123423,
    lorem: 'ipsum',
    music: 'hello darkness my old friend',
    raj: 'http://awesome'
}

raj.selectFromObject(object, ['name', 'id']) // {name: 'hello', id: 3123423}

Copy Objects

const obj = {a: 'b', c: 'd'};
const copy = raj.copy(obj);

Merge Objects

const object1 =  { food: 'pizza', car: 'ford' };
const object2 =  { animal: 'dog' };

const object3 = raj.merge(object1, object2);

console.log(object3);

// { food: 'pizza', car: 'ford', animal: 'dog' }

Extend objects values

const defaultValues = { host: "127.0.0.1", port: "6379", database: "default"};
const connectionValus = { host: "54.178.12.44", database: "raj"};

const newobject = raj.extend(defaultValues, connectionValus);

console.log(newobject)

// { host: '54.178.12.44', port: '6379', database: 'raj' }

Clean Objects (empty and undefined values)

const objectReference = {a: undefined, b: "", c: "value"};
const objectToTest = {c: "value"};
const cleanObject = raj.cleanObject(objectReference);

console.log(cleanObject); 

// {c: 'value'}

Validation Indian Helpers

Is string

const result = raj.isString('hello');

const string = 'hello'
const number = 12321

raj.isString(string); // true
raj.isString(number); // false

Is Object

const string = 'hello';
const object = {a:1};

raj.isObject(string); // false
raj.isObject(object); // true

Is Number

const string = 'hello'
const number = 12321

raj.isNumber(string); // false
raj.isNumber(number); // true

Is Array

const string = "Hello";

const object = {
    hello: "value"
};

const array = [1, 2, 3];

raj.isArray(string); //false
raj.isArray(object); //false
raj.isArray(array); //true