Getting Started
Layout
Components
Design
Object
- null_delete_keys_from_object: This function will remove keys with their values in object and return a new object. It takes two arguments, the first one is an array of keys you want to delete, the second is the object you want to delete keys from.
const obj = {
id: 1,
firstName: "Jack",
age: 20,
country: "USA"
};
const keysToDelete = ["id", "age"];
const newObj = null_delete_keys_from_object(keysToDelete, obj);
console.log(newObj); //{country: "USA", firstName: "Jack"}
- null_get_min_max_value_from_object: This function will return the minimum or maximum value in an object. It takes two arguments, the first one is the object to search, and the second is the type of value to return: "min" | "max".
/* Function Call */
const values = {
a: 1,
b: 7,
c: 22,
d: 23,
f: 6
};
const maxValue = null_get_min_max_value_from_object(values, "min");
console.log(maxValue); // 1
/* Function Call */
const values = {
a: 1,
b: 7,
c: 22,
d: 23,
f: 6
};
const maxValue = null_get_min_max_value_from_object(values, "max");
console.log(maxValue); // 23
- null_exclude_keys_from_object: This Function will exclude keys and their values from an object. It takes two arguments, the first one is the object that you want to start excluding keys, and the second is array of values to be excluded.
const nullObject = {
_id: 1234,
firstName: 'John',
lastName: 'Smith',
age:30,
country:"Usa"
};
var nullKeys = ["_id","country"];
// Export nullKeys to new object with their values
var nullNewObject = null_exclude_keys_from_object(nullObject, nullKeys);
console.log(nullNewObject); // {firstName:'John', lastName:'Smith', age:30 }
- null_include_keys_to_object: This function will include keys with their values to an object. It takes two arguments, the first one is the object that you want to start including keys, and the second is an object contains keys and values.
const nullObject = {
_id: 1234,
firstName: 'John',
lastName: 'Smith',
age:30,
country:"Usa"
};
const nullKeys = {
middleName : "Wick",
salary:1200
};
const nullNewObject = null_include_keys_to_object(nullObject, nullKeys);
console.log(nullNewObject);
/*
{
_id: 1234,
firstName: 'John',
lastName: 'Smith',
age: 30,
country: 'Usa',
middleName: 'Wick',
salary: 1200
}
*/