这样你就能实现一些有趣的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()