0.0.26 • Published 3 years ago

@bilalkhanpro/superjs v0.0.26

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Array/Object Enhancments

Did you miss array.remove(0) or array.remove("item3") function then your desire is full fill now by installing this package.

npm i @bilalkhanpro/superjs
import UpgradeJs from '@bilalkhanpro/superjs';
UpgradeJs();

Usage

Array Usage

Remove By Value

Array.remove case sensitive function

const userNames = ["Bilal", "Ahsan", "Waheed", "Arsalan"];
userNames.u_remove("Waheed");

Remove By Index

Provide negative number for removing item in reverse order

const userNames = ["Bilal", "Ahsan", "Waheed", "Arsalan"];
userNames.u_removeAt(2);

Object Usage

Now you don't have to use either of the following methodologies:-

  • Object.keys(obj).length to calculate length of an object,
  • Object.keys(obj) to extract keys from an object,
  • Object.values(obj) to extract values from an object,

Now you can directly use properties like length, keys, values rather than above complax ways

Object Length

const userDetails = {name:"bilal", qualification:"BS", country:"Pakistan"};
userDetails.length;

Object Keys

const userDetails = {name:"bilal", qualification:"BS", country:"Pakistan"};
userDetails.keys;

Object values

const userDetails = {name:"bilal", qualification:"BS", country:"Pakistan"};
userDetails.values;

Object map function

const userDetails = {name:"bilal", qualification:"BS", country:"Pakistan"};

const tempMapObj = userDetails.umap((key,value,index)=>{
    console.log("key::", key," value::", value, " index::", index)
    return value;
})

console.log(tempMapObj);
// *output :* 
// key:: name  value:: bilal  index:: 0
// key:: qualification  value:: BS  index:: 1       
// key:: country  value:: Pakistan  index:: 2       
// [ 'bilal', 'BS', 'Pakistan' ]
0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.15

3 years ago

0.0.9

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

1.0.0

3 years ago