0.0.1 • Published 6 years ago
lakca-helper v0.0.1
helper
some helper functions.
Documentation
- Newest, maybe is unstable.
- Look up available docs of different versions, which are stable.
- Preview different versions doc with link
https://lakca.github.io/helper/docs/@lakca/helper/${version}
API
assignWithin
const obj = helper.assignWithin({}, {
a: 1,
b: 2,
c: 3
}, [
'a',
['b', 'x'],
['c', 'c', v => v + 1]
]);
/*
obj = {
a: 1,
x: 2,
c: 4
}
*/
assignWithout
const obj = helper.assignWithout({}, {
a: 1,
b: 2,
c: 3
}, ['c']);
/*
obj = {
a: 1,
b: 2
}
*/
convert
const obj = helper.convert({
a: 1,
b: 2,
c: 3
}, [
['c', v => v + 1]
]);
/*
obj = {
a: 1,
b: 2,
c: 4
}
*/
deundefined
const obj = helper.deundefined({
a: 1,
b: 2,
c: undefined
});
/*
obj = {
a: 1,
b: 2
}
*/
deempty
const obj = helper.deempty({
a: 1,
b: 2,
c: {}
});
/*
obj = {
a: 1,
b: 2
}
*/
ownKeys
same as
Reflect.ownKeys
in es6 spec.
const c = Symbol('sym');
const keys = helper.ownKeys({
a: 1,
b: 2,
[c]: 3
});
/*
keys = ['a', 'b', c];
*/
Dependency
None
License
0.0.1
6 years ago