lixy

0.0.4 • Public • Published

lixy is live lazy proxy

Live means that it lives wonderful and unpredictable life.

While you call to proxied object it stays a proxy unless you get a primitive value.

const lixy = require('lixy');

const math = {
  add (a, b) {
    return a + b;
  }
};

const { add } = lixy.lazy(() => math);

add(5, 3); // 8

math.add = (a, b) => a - b;

add(5, 3); // 2

If the root object will not change, the example above can be simplified:

const { add } = lixy(math);

Note: proxified objects will always have the type function to handle the case when you need to replace the source object with a function, eg math = eval. If you want to change this behaviour pass the second argument lixy(getter, { safeType: false }).

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.41latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.41
0.0.30
0.0.20
0.0.10
0.0.00

Package Sidebar

Install

npm i lixy

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

4.95 kB

Total Files

5

Last publish

Collaborators

  • termosa