Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 544 Bytes

README.md

File metadata and controls

32 lines (22 loc) · 544 Bytes

Javascrpit magic object library

Install

npm install magic-object

Usage

const MagicObject = require('magic-object');
const magicObject = new MagicObject((path, args) => {
    return {path, args};
});

console.log(magicObject.foo.bar(1)); // output: {path: ['foo', 'bar'], args: [1]}

Or Async usage

const magicObject = new MagicObject(async (path, args) => {
    return {path, args};
});

console.log(await magicObject.foo.bar(1)); // output: {path: ['foo', 'bar'], args: [1]}