mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Don't expose _.forIn or _.forOwn if underscore build modifier is present and include doesn't contain forIn or forOwn.
Former-commit-id: 6ebd0bc61d3ae6e2d0506fe72dd22ed59c601c70
This commit is contained in:
15
build.js
15
build.js
@@ -263,8 +263,8 @@
|
||||
];
|
||||
|
||||
/** Collections of method names */
|
||||
var excludeMethods,
|
||||
includeMethods,
|
||||
var excludeMethods = [],
|
||||
includeMethods = [],
|
||||
allMethods = Object.keys(dependencyMap);
|
||||
|
||||
var underscoreMethods = lodash.without.apply(lodash, [allMethods].concat([
|
||||
@@ -720,6 +720,17 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// don't expose `_.forIn` or `_.forOwn` if `isUnderscore` is `true` unless
|
||||
// requested by `include`
|
||||
if (isUnderscore) {
|
||||
if (includeMethods.indexOf('forIn') == -1) {
|
||||
source = source.replace(/ *lodash\.forIn *=.+\n/, '');
|
||||
}
|
||||
if (includeMethods.indexOf('forOwn') == -1) {
|
||||
source = source.replace(/ *lodash\.forOwn *=.+\n/, '');
|
||||
}
|
||||
}
|
||||
|
||||
// add methods required by Backbone or Underscore
|
||||
[
|
||||
{ 'flag': isBackbone, 'methodNames': backboneDependencies },
|
||||
|
||||
Reference in New Issue
Block a user