From 012bff97e0aca3ecd22053de9b16ce2d5d8e8e03 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 2 Apr 2016 10:57:29 -0700 Subject: [PATCH] Add fp/placeholder module. --- fp/_baseConvert.js | 2 +- fp/placeholder.js | 6 ++++++ lib/fp/build-modules.js | 3 +-- lib/fp/template/modules/module.jst | 7 +++++-- 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 fp/placeholder.js diff --git a/fp/_baseConvert.js b/fp/_baseConvert.js index eea400d52..a9236f518 100644 --- a/fp/_baseConvert.js +++ b/fp/_baseConvert.js @@ -1,6 +1,6 @@ var mapping = require('./_mapping'), mutateMap = mapping.mutate, - fallbackHolder = {}; + fallbackHolder = require('./placeholder'); /** * The base implementation of `convert` which accepts a `util` object of methods diff --git a/fp/placeholder.js b/fp/placeholder.js new file mode 100644 index 000000000..1ce17393b --- /dev/null +++ b/fp/placeholder.js @@ -0,0 +1,6 @@ +/** + * The default argument placeholder value for methods. + * + * @type {Object} + */ +module.exports = {}; diff --git a/lib/fp/build-modules.js b/lib/fp/build-modules.js index 1704c1359..39894dd9a 100644 --- a/lib/fp/build-modules.js +++ b/lib/fp/build-modules.js @@ -97,8 +97,7 @@ function build(target) { _.each([mapping.aliasToReal, mapping.remap], function(data) { _.forOwn(data, function(realName, alias) { var modulePath = path.join(target, alias + '.js'); - if (!_.startsWith(alias, '_') && - !_.includes(modulePaths, modulePath)) { + if (!_.includes(modulePaths, modulePath)) { modulePaths.push(modulePath); } }); diff --git a/lib/fp/template/modules/module.jst b/lib/fp/template/modules/module.jst index a1ff9f662..289bd2b63 100644 --- a/lib/fp/template/modules/module.jst +++ b/lib/fp/template/modules/module.jst @@ -1,2 +1,5 @@ -var convert = require('./convert'); -module.exports = convert('<%= name %>', require('../<%= _.result(mapping.remap, name, name) %>')); +var convert = require('./convert'), + func = convert('<%= name %>', require('../<%= _.result(mapping.remap, name, name) %>')); + +func.placeholder = require('./placeholder'); +module.exports = func;