@activeprospect/indexer 中文文档教程
Indexer
此 Node.JS 模块需要一个 JavaScript(或 CoffeeScript)文件目录,并使相关模块可用。 它可以用于扩展指定的模块。
Usage
假设以下目录结构:
zoo
|-- ape.js
|-- donkey.js
|-- zebra.js
添加一个索引文件 (zoo/index.js
) 委托给索引器模块:
var path = require('path');
var index = require('indexer');
// index all the files in the same directory and extend this module
index(__dirname, module);
然后使用 zoo
模块:
var zoo = require('zoo');
zoo.ape // returns the module defined in zoo/ape.js
zoo.donkey // returns the module defined in zoo/donkey.js
zoo.zebra // returns the module defined in zoo/zebra.js
Reference
该模块导出具有以下参数的单个函数:
dirname
— the directory of files to index (.js and .coffee files will be indexed)module
— (optional) export each module indirname
to this module.ignoreModules
— the rest of the parameters passed to the function are module names to ignore (i.e.index(__dirname, module 'ape', 'donkey')
will only export thezebra
module)
函数返回的对象对 dirname
中的每个模块都有一个属性。
Indexer
This Node.JS module requires a directory of JavaScript (or CoffeeScript) files and makes the associated modules available. It can be used to extend a specified module.
Usage
Assume the following directory structure:
zoo
|-- ape.js
|-- donkey.js
|-- zebra.js
Add an index file (zoo/index.js
) which delegates to the indexer module:
var path = require('path');
var index = require('indexer');
// index all the files in the same directory and extend this module
index(__dirname, module);
Then to use the zoo
module:
var zoo = require('zoo');
zoo.ape // returns the module defined in zoo/ape.js
zoo.donkey // returns the module defined in zoo/donkey.js
zoo.zebra // returns the module defined in zoo/zebra.js
Reference
This module exports a single function with the following parameters:
dirname
— the directory of files to index (.js and .coffee files will be indexed)module
— (optional) export each module indirname
to this module.ignoreModules
— the rest of the parameters passed to the function are module names to ignore (i.e.index(__dirname, module 'ape', 'donkey')
will only export thezebra
module)
The object returned by the function has a property for each module in the dirname
.
更多
你可能也喜欢
- 10minutemail 中文文档教程
- @4lch4/discord.js-docgen 中文文档教程
- @6river/rosbag 中文文档教程
- @8trhieu/ckeditor5-build-classic-custom 中文文档教程
- @9renpoto/textlint-config-ja 中文文档教程
- @abdevs/console-manager 中文文档教程
- @abelmokadem/tap-spec 中文文档教程
- @abneroliveira/business-rules-engine 中文文档教程
- @abtnode/cli 中文文档教程
- @acala-network/contracts 中文文档教程