Ai
2 Star 0 Fork 0

mirrors_WebReflection/next-resolver

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test.mjs 783 Bytes
一键复制 编辑 原始数据 按行查看 历史
webreflection 提交于 2025-04-25 16:13 +08:00 . first commit
import nextResolver from './index.js';
const [nid, nresolve] = nextResolver();
let [id, promise] = nid();
console.assert(typeof id === 'number');
console.assert(promise instanceof Promise);
promise.then(value => {
console.assert(value === 'number');
});
nresolve(id, 'number');
const [sid, sresolve] = nextResolver(String);
[id, promise] = sid(String);
console.assert(typeof id === 'string');
console.assert(promise instanceof Promise);
promise.then(value => {
console.assert(value === 'string');
});
sresolve(id, 'string');
[id, promise] = sid(String);
promise.then(
() => {
throw new Error('this should not happen');
},
error => {
console.assert(error === 'error');
console.log('OK');
}
);
sresolve(id, null, 'error');
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_WebReflection/next-resolver.git
git@gitee.com:mirrors_WebReflection/next-resolver.git
mirrors_WebReflection
next-resolver
next-resolver
main

搜索帮助