yun-zise

1.0.0 • Public • Published

yun-zise

我的第一个NPM模块

CommonJS标准

我们看到上面代码中使用CommonJS标准。一个单独的文件就是一个模块,模块内将需要对外暴露的变量放到exports对象里,可以是任意对象,函数,数组等,未放到exports对象里的都是私有的。用require方法加载模块,即读取模块文件获得exports对象。这里出现的module,exports,require是JS的新语法吗?不是新语法,只是CommonJS的语法糖。

Readme

Keywords

Package Sidebar

Install

npm i yun-zise

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

1.16 kB

Total Files

4

Last publish

Collaborators

  • ziyunse