Skip to content

JavaScript library which provides utility functions for JavaScript programming.

Notifications You must be signed in to change notification settings

rao123dk/common-utility.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

common-utility.js

contributions welcome

HitCount

Table of Contents

Array

is Array Empty ?

Code:-

[1,2,3].isEmpty();

Example:-

const array = [];
console.log(array.isEmpty());
Output :- True

Remove duplicate items from array

Code:-

[1,2,3,3].unique()

Example:-

let data = ["a", "f", "e", "w", "r", "e", "o", "j", "j","w"];
console.log(data.unique());
Output :- ["a", "f", "e", "w", "r", "o", "j"]

Remove all falsy values: (undefined, null, 0, false, NaN and "") from array

Code:-

[8, null, undefined,0].clean()

Example:-

let data = [8, null, undefined,0, 6];
console.log(data.clean());
Output :- [8,6]

Deep copy array

Code:-

[8, null, undefined,0].copyArray()

Example:-

let data = [8, null, undefined,0];
let newArray = data.copyArray();
data.push(55)
console.log(newArray);
Output :- [8, null, undefined,0]

Object

String

Number

About

JavaScript library which provides utility functions for JavaScript programming.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published