proxy-keypath

1.0.3 • Public • Published

proxy-keypath

创建一个能追踪当前keypath的特殊对象

这样你就能实现一些有趣的api设计,例如

const keypath = require('proxy-keypath');
const fetch = require('node-fetch');

async function main() {
  const www = keypath('https://www', {
    async get() {
      return fetch(`${this}`);
    },
  });

  const resp = await www.google.com.get();
  const text = await resp.text();
  console.log(text);
}

main()

Readme

Keywords

Package Sidebar

Install

npm i proxy-keypath

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

2.25 kB

Total Files

5

Last publish

Collaborators

  • lizzz