摘要: node.js中通过require()来引用其他文件,那如果想要被其他文件所引用,就得用到exports或者module.exports。首先,每个文件都会默认有一个module对象,测试一下console.log(module);结果是:{ id: '.', exports: {}, parent: null, filename: 'D:\\mytest\\test.js', loaded: false, children: [], paths: [ 'D:\\mytest\\test\\node_modules', 'D:\\myte 阅读全文
posted @ 2014-03-25 16:01 邪邪 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 这里提供了一些node.js类型检查的方法function isArray(ar) { return Array.isArray(ar);}exports.isArray = isArray;function isBoolean(arg) { return typeof arg === 'boolean';}exports.isBoolean = isBoolean;function isNull(arg) { return arg === null;}exports.isNull = isNull;function isNullOrUndefined(arg) { r... 阅读全文
posted @ 2014-03-25 13:56 邪邪 阅读(634) 评论(0) 推荐(0) 编辑