
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
proto-khamis
Advanced tools
General purpose Library to prototype the Array object to utilize analysing data stored as array of objects
proto-khamis
General purpose Library to prototype the Array object to utilize analysing data stored as array of objects
usage : var proto = require('proto-khamis'); //require the Library proto(); // load the Library var testArray=[{"fName":"Adam","age":22,"rank":3,"lName":"juma"}, {"fName":"salim","age":33,"rank":2,"lName":"juma"}, {"fName":"mohd","age":25,"rank":5,"lName":"rida"}];
Then for any Array of objects within your code you may use the functions as detailed in below examples.
testArray.seek("lName","juma","fname","Adam") //returns :{"fName":"Adam","age":22,"rank":3,"lName":"juma"}
In case more than on object is found it returns an array of the found objects. e.g.: testArray.seek("lName","juma") // note that you may use one or two seek parameters only. it returns :[{"fName":"Adam","age":22,"rank":3,"lName":"juma"}, {"fName":"salim","age":33,"rank":2,"lName":"juma"}]
In case no objects where found it returns -1
if three arguments are used it will return the value of array of values for the third argument in the objects that meet the condition of the first two arguments e.g. :
testArray.seek("lName","rida","fname") //it will return "mohd" testArray.seek("lName","juma","fname") //it will return ["Adam","salim"]
testArray.seekSlim // same as .seek but for the first search condition you may search partially e.g. testArray.seekSlim("lName","ju","fname","Adam") //it returns {"fName":"Adam","age":22,"rank":3,"lName":"juma"} testArray.seekSlim("lName","ri","fname") //it returns "mohd"
testArray.seekA() same as .seek but forces the return of an Array even if one result is found e.g. testArray.seek("lName","juma","fname","Adam") //returns :[{"fName":"Adam","age":22,"rank":3,"lName":"juma"}] it returns -1 if no results are found.
testArray.INDEX() same as seekA but returns the INDEX of the object in the array not the object and always returns an array or -1 e.g.: testArray.INDEX("lName","juma") // it returns :[0,1]
testArray.maxOf() takes odd number of arguments (1,3 or 5) if one argument is provided it seeks the maximum value of this argument.e.g: testArray.maxOf("rank") // returns 5; if 3 or 5 arguments are provided the considered maximum value is the last argument and the others are equivalence conditions e.g. testArray.maxOf("lName","juma","fName","Adam","age") returns 22
testArray.minOf() // same as maxOf but with the minimum value.
testArray.rowOf(columnIndex,value) // It may be replaced by seekSlim() //returns the row that has the same "value" in the property with index that matches "columnIndex" e.g: testArray.rowOf(2,33) returns {"fName":"salim","age":33,"rank":2,"lName":"juma"} testArray.rowOf("age",33) returns {"fName":"salim","age":33,"rank":2,"lName":"juma"} testArray.rowOf("fName","salim") returns {"fName":"salim","age":33,"rank":2,"lName":"juma"} testArray.rowOf("fName","sal") returns {"fName":"salim","age":33,"rank":2,"lName":"juma"} it returns an object if one item is found and an array if many and and empty array if none is found.
.numSort() // Sorts and Array of objects following one Numerical property e.g: testArray.numSort("age") // if no second argument is provided it sorts Ascending . testArray.numSort("age","A") or testArray.numSort("age","D") the second arguments takes only two options : "A" for Ascending and "D" for Descending.
FAQs
General purpose Library to prototype the Array object to utilize analysing data stored as array of objects
The npm package proto-khamis receives a total of 0 weekly downloads. As such, proto-khamis popularity was classified as not popular.
We found that proto-khamis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.