NODEJS
准备重写nodejs专栏,希望对大家有用。
dongmelon
抟扶摇直上九万里
展开
-
手写 Bitmap
【代码】手写 Bitmap。原创 2023-02-12 16:27:15 · 207 阅读 · 0 评论 -
typescript泛型
我们平常是对值编程,而泛型是对类型编程一、初识泛型1.1keyof1.2in1.3infer1.4Partial1.5Required1.6Readonly1.7Record1.8Pick1.9extends1.10 Exclude1.11Extract1.12 Omit二、类型2.1联合类型满足其中之一的类型就可以了。interface NAS { host: string; port: number;...原创 2022-05-25 23:06:25 · 347 阅读 · 0 评论 -
koa-compose重点解析
源码: return function (context, next) { // last called middleware # let index = -1 return dispatch(0) function dispatch (i) { if (i <= index) return Promise.reject(new Error('next() called multiple times')) index = i原创 2022-05-23 23:13:02 · 194 阅读 · 0 评论 -
手写Promise
class MyPromise { PENDING = 'pending' FULFILLED = 'fulfilled' REJECTED = 'rejected' status = null value = null resolveCallbacks = [] rejectCallbacks = [] constructor(executor) { this.status = this.PENDING .原创 2022-04-17 12:45:58 · 187 阅读 · 0 评论 -
ESM(ESModule)和CJS(CommonJS)
目录一、ESM1.1 import1.2 export二、CJS2.1 require2.2 exports 和 module.exports一、ESM1.1 import1.2 export二、CJS2.1 require2.2 exports 和 module.exports原创 2022-03-20 23:24:57 · 503 阅读 · 0 评论