objectplus.js
v3.0.1
Published
An utility for object
Downloads
3
Readme
Object Plus
Requiring Functions
const objectplus = require("objectplus.js");
Object.prototype.push
This will add the discriminator into the new object.
Usage
const obj = {username: "Hyp3r"};
const newObj = obj.push({discriminator: "0001"});
// {username: "Extroonie", discriminator: "0001"}
console.log(newObj)
Object.prototype.remove
This will just simply remove a key and value from an object based on the specified key.
Usage
const obj = {username: "Hyp3r", discriminator: "0001"};
// {username: "Extroonie"}
obj.remove("tag")
Object.prototype.forEach
Loop through the object which return an object, example below.
Usage
const obj = {username: "Hyp3r", discriminator: "0001"};
obj.forEach(object => {
// {key: "username", value: "Hyp3r"}
})