0.0.26 • Published 4 years ago
@bilalkhanpro/superjs v0.0.26
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/superjsimport 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).lengthto 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
4 years ago
0.0.23
4 years ago
0.0.24
4 years ago
0.0.25
4 years ago
0.0.26
4 years ago
0.0.20
4 years ago
0.0.21
4 years ago
0.0.19
4 years ago
0.0.18
4 years ago
0.0.10
4 years ago
0.0.11
4 years ago
0.0.12
4 years ago
0.0.13
4 years ago
0.0.15
4 years ago
0.0.9
4 years ago
0.0.16
4 years ago
0.0.17
4 years ago
0.0.8
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago
1.0.0
4 years ago