shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
map
Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.object
This is the same function as the “Array.map” but for objects. It will iterate over all the properties of the passed object and pass the value to your process function. It will then save the property with your processed value
Params
- object*-Object
The object to process
- processor*-Function
The processor function that will take as parameters the current property value and the property name
Return
- -Object
The processed object
Example
import { map } from '@blackbyte/sugar/object';
const myObject = {
hello: 'world',
cat: 'Nelson'
};
map(myObject, ({value, prop}) => {
return prop === 'hello' ? 'universe' : value;
});
{
hello: 'universe',
cat: 'Nelson'
}Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space