I am getting an es linting error for this line of code below, saying I need to use object destructuring.
const myTest = require('chai').myTest;
How do I do this for requiring a library?
只需将库表达式放在赋值运算符的右侧,对require
销毁就与对任何对象进行销毁没有区别:
const { myTest } = require('chai');
您应该使用分解。
const { myTest } = require('chai');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.