diff options
author | 2017-05-04 07:48:42 -0400 | |
---|---|---|
committer | 2017-05-04 12:28:17 -0400 | |
commit | b54df0ddd0c6a0372327c5aa3668e5a6458fcd64 (patch) | |
tree | e69cfa9b314a801bd187cf0145d1d4306436229c /ecomp-portal-FE/client/bower_components/lodash/lib/fp/build-modules.js | |
parent | 39d1e62c84041831bfc52cca73b5ed5efaf57d27 (diff) |
[PORTAL-7] Rebase
This rebasing includes common libraries and common overlays projects
abstraction of components
Change-Id: I9a24a338665c7cd058978e8636bc412d9e2fdce8
Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-portal-FE/client/bower_components/lodash/lib/fp/build-modules.js')
-rw-r--r-- | ecomp-portal-FE/client/bower_components/lodash/lib/fp/build-modules.js | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/ecomp-portal-FE/client/bower_components/lodash/lib/fp/build-modules.js b/ecomp-portal-FE/client/bower_components/lodash/lib/fp/build-modules.js deleted file mode 100644 index 43902e01..00000000 --- a/ecomp-portal-FE/client/bower_components/lodash/lib/fp/build-modules.js +++ /dev/null @@ -1,120 +0,0 @@ -'use strict'; - -var _ = require('lodash'), - async = require('async'), - glob = require('glob'), - path = require('path'); - -var file = require('../common/file'), - mapping = require('../common/mapping'); - -var templatePath = path.join(__dirname, 'template/modules'), - template = file.globTemplate(path.join(templatePath, '*.jst')); - -var aryMethods = _.union( - mapping.aryMethod[1], - mapping.aryMethod[2], - mapping.aryMethod[3], - mapping.aryMethod[4] -); - -var categories = [ - 'array', - 'collection', - 'date', - 'function', - 'lang', - 'math', - 'number', - 'object', - 'seq', - 'string', - 'util' -]; - -var ignored = [ - '_*.js', - 'core.js', - 'core.min.js', - 'fp.js', - 'index.js', - 'lodash.js', - 'lodash.min.js' -]; - -function isAlias(funcName) { - return _.has(mapping.aliasToReal, funcName); -} - -function isCategory(funcName) { - return _.includes(categories, funcName); -} - -function isThru(funcName) { - return !_.includes(aryMethods, funcName); -} - -function getTemplate(moduleName) { - var data = { - 'name': _.result(mapping.aliasToReal, moduleName, moduleName), - 'mapping': mapping - }; - - if (isAlias(moduleName)) { - return template.alias(data); - } - if (isCategory(moduleName)) { - return template.category(data); - } - if (isThru(moduleName)) { - return template.thru(data); - } - return template.module(data); -} - -/*----------------------------------------------------------------------------*/ - -function onComplete(error) { - if (error) { - throw error; - } -} - -function build(target) { - target = path.resolve(target); - - var fpPath = path.join(target, 'fp'); - - // Glob existing lodash module paths. - var modulePaths = glob.sync(path.join(target, '*.js'), { - 'nodir': true, - 'ignore': ignored.map(function(filename) { - return path.join(target, filename); - }) - }); - - // Add FP alias and remapped module paths. - _.each([mapping.aliasToReal, mapping.remap], function(data) { - _.forOwn(data, function(realName, alias) { - var modulePath = path.join(target, alias + '.js'); - if (!_.includes(modulePaths, modulePath)) { - modulePaths.push(modulePath); - } - }); - }); - - var actions = modulePaths.map(function(modulePath) { - var moduleName = path.basename(modulePath, '.js'); - return file.write(path.join(fpPath, moduleName + '.js'), getTemplate(moduleName)); - }); - - actions.unshift(file.copy(path.join(__dirname, '../../fp'), fpPath)); - actions.push(file.write(path.join(fpPath, '_falseOptions.js'), template._falseOptions())); - actions.push(file.write(path.join(fpPath, '_util.js'), template._util())); - actions.push(file.write(path.join(target, 'fp.js'), template.fp())); - actions.push(file.write(path.join(fpPath, 'convert.js'), template.convert())); - - async.series(actions, onComplete); -} - -build(_.last(process.argv)); |