refactor: util

This commit is contained in:
cha0s 2021-01-31 02:17:51 -06:00
parent 8f9adad958
commit 1bdbf8a0b4

View File

@ -2,33 +2,28 @@ import merge from 'deepmerge';
export default {
makeArray: (...args) => {
// No context!
args.pop();
return args;
},
makeObject: (...args) => {
// No context!
args.pop();
const object = {};
while (args.length > 0) {
const key = args.shift();
const value = args.shift();
object[key] = value;
}
return object;
},
describe: () => ({
children: {
log: {
label: 'log',
type: 'void',
args: [
{
label: 'value',
type: 'any',
},
],
vararg: true,
},
},
type: 'object',
}),
log: (...args) => {
// eslint-disable-next-line no-console
console.log(...args);
},
merge: (...args) => {
// No context!
args.pop();
return merge(...args);
},
merge: (l, r) => merge(l, r),
};