Raj - Toolset DANGER!
My toolset of day a day, in a simple library.
UNDER F*CKING CONSTRUCTION!!!
Made with love ❤️
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; console; // [ 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 console; // [ 1, 2 ]
Common itens between Arrays
let arr1 = 1 2 3 4;let arr2 = 4 5 6; let common = raj; console; // [ 4 ]
Array Sum
let array = 5 5 10 30; let sum = raj; console; // 50
Random Item in Array
let array = 5 5 10 30; let rand = raj; console; // 5...
Split arrays on x arrays
This sh*t save my life on batch parallel processing
let array = 1234567891011121314151617;let numberOfItems = 5; let batch = raj; console; // [ [ 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; console; // { // 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 // {name: 'hello', id: 3123423}
Copy Objects
const obj = a: 'b' c: 'd';const copy = raj;
Merge Objects
const object1 = food: 'pizza' car: 'ford' ;const object2 = animal: 'dog' ; const object3 = raj; console; // { 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; console // { 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; console; // {c: 'value'}
Validation Indian Helpers
Is string
const result = raj; const string = 'hello'const number = 12321 raj; // trueraj; // false
Is Object
const string = 'hello';const object = a:1; raj; // falseraj; // true
Is Number
const string = 'hello'const number = 12321 raj; // falseraj; // true
Is Array
const string = "Hello"; const object = hello: "value"; const array = 1 2 3; raj; //falseraj; //falseraj; //true