@@ -586,14 +586,14 @@ convertToFunctionExpression = function convertToFunctionExpression(obj) {
586586 } ) ;
587587 callbackFunc . body . body = body ;
588588 // Returns an array of all return statements
589- returnStatements = _ . where ( body , { 'type' : 'ReturnStatement' } ) ;
590- exportsExpressions = _ . where ( body , {
589+ returnStatements = _ . filter ( body , { 'type' : 'ReturnStatement' } ) ;
590+ exportsExpressions = _ . filter ( body , {
591591 'left' : {
592592 'type' : 'Identifier' ,
593593 'name' : 'exports'
594594 }
595595 } ) ;
596- moduleExportsExpressions = _ . where ( body , {
596+ moduleExportsExpressions = _ . filter ( body , {
597597 'left' : {
598598 'type' : 'MemberExpression' ,
599599 'object' : {
@@ -647,18 +647,18 @@ convertToFunctionExpression = function convertToFunctionExpression(obj) {
647647 } ( ) , hasReturnStatement = function ( ) {
648648 var returns = [ ] ;
649649 if ( callbackFunc && callbackFunc . body && _ . isArray ( callbackFunc . body . body ) ) {
650- returns = _ . where ( callbackFunc . body . body , { 'type' : 'ReturnStatement' } ) ;
650+ returns = _ . filter ( callbackFunc . body . body , { 'type' : 'ReturnStatement' } ) ;
651651 if ( returns . length ) {
652652 return true ;
653653 }
654654 }
655655 return false ;
656656 } ( ) , originalCallbackFuncParams , hasExportsParam = function ( ) {
657657 var cbParams = callbackFunc . params || [ ] ;
658- return _ . where ( cbParams , { 'name' : 'exports' } ) . length ;
658+ return _ . filter ( cbParams , { 'name' : 'exports' } ) . length ;
659659 } ( ) , hasModuleParam = function ( ) {
660660 var cbParams = callbackFunc . params || [ ] ;
661- return _ . where ( cbParams , { 'name' : 'module' } ) . length ;
661+ return _ . filter ( cbParams , { 'name' : 'module' } ) . length ;
662662 } ( ) , normalizeDependencyNames = { } , dependencyNames = function ( ) {
663663 var deps = [ ] , currentName ;
664664 _ . each ( dependencies , function ( currentDependency ) {
@@ -709,7 +709,7 @@ convertToFunctionExpression = function convertToFunctionExpression(obj) {
709709 if ( node . id && node . id . name && node . init && node . init [ 'arguments' ] && node . init [ 'arguments' ] [ 0 ] && node . init [ 'arguments' ] [ 0 ] . value ) {
710710 variableName = node . id . name ;
711711 expressionName = normalizeModuleName . call ( amdclean , utils . normalizeDependencyName ( moduleId , node . init [ 'arguments' ] [ 0 ] . value , moduleId ) ) ;
712- if ( ! _ . contains ( ignoreModules , expressionName ) && variableName === expressionName ) {
712+ if ( ! _ . includes ( ignoreModules , expressionName ) && variableName === expressionName ) {
713713 matchingNames . push ( {
714714 'originalName' : expressionName ,
715715 'newName' : findNewParamName ( expressionName ) ,
@@ -792,7 +792,7 @@ convertToFunctionExpression = function convertToFunctionExpression(obj) {
792792 'count' : 1
793793 } ] ;
794794 } else {
795- mappedParameter = _ . where ( amdclean . callbackParameterMap [ dependencyNames [ iterator ] . name ] , { 'name' : currentName } ) ;
795+ mappedParameter = _ . filter ( amdclean . callbackParameterMap [ dependencyNames [ iterator ] . name ] , { 'name' : currentName } ) ;
796796 if ( mappedParameter . length ) {
797797 mappedParameter = mappedParameter [ 0 ] ;
798798 mappedParameter . count += 1 ;
@@ -852,11 +852,11 @@ convertToFunctionExpression = function convertToFunctionExpression(obj) {
852852 if ( utils . isRequireExpression ( node ) ) {
853853 if ( node [ 'arguments' ] && node [ 'arguments' ] [ 0 ] && node [ 'arguments' ] [ 0 ] . value ) {
854854 normalizedModuleName = normalizeModuleName . call ( amdclean , utils . normalizeDependencyName ( moduleId , node [ 'arguments' ] [ 0 ] . value , moduleId ) ) ;
855- if ( _ . contains ( ignoreModules , normalizedModuleName ) ) {
855+ if ( _ . includes ( ignoreModules , normalizedModuleName ) ) {
856856 return node ;
857857 }
858- if ( _ . where ( matchingRequireExpressionNames , { 'originalName' : normalizedModuleName } ) . length ) {
859- newName = _ . where ( matchingRequireExpressionNames , { 'originalName' : normalizedModuleName } ) [ 0 ] . newName ;
858+ if ( _ . filter ( matchingRequireExpressionNames , { 'originalName' : normalizedModuleName } ) . length ) {
859+ newName = _ . filter ( matchingRequireExpressionNames , { 'originalName' : normalizedModuleName } ) [ 0 ] . newName ;
860860 }
861861 return {
862862 'type' : 'Identifier' ,
@@ -898,13 +898,13 @@ convertToObjectDeclaration = function (obj, type) {
898898 modReturnValue = obj . moduleReturnValue ;
899899 callee = modReturnValue . callee ;
900900 params = callee . params ;
901- if ( params && params . length && _ . isArray ( params ) && _ . where ( params , { 'name' : 'global' } ) ) {
901+ if ( params && params . length && _ . isArray ( params ) && _ . filter ( params , { 'name' : 'global' } ) ) {
902902 if ( _ . isObject ( callee . body ) && _ . isArray ( callee . body . body ) ) {
903- returnStatement = _ . where ( callee . body . body , { 'type' : 'ReturnStatement' } ) [ 0 ] ;
903+ returnStatement = _ . filter ( callee . body . body , { 'type' : 'ReturnStatement' } ) [ 0 ] ;
904904 if ( _ . isObject ( returnStatement ) && _ . isObject ( returnStatement . argument ) && returnStatement . argument . type === 'FunctionExpression' ) {
905905 internalFunctionExpression = returnStatement . argument ;
906906 if ( _ . isObject ( internalFunctionExpression . body ) && _ . isArray ( internalFunctionExpression . body . body ) ) {
907- nestedReturnStatement = _ . where ( internalFunctionExpression . body . body , { 'type' : 'ReturnStatement' } ) [ 0 ] ;
907+ nestedReturnStatement = _ . filter ( internalFunctionExpression . body . body , { 'type' : 'ReturnStatement' } ) [ 0 ] ;
908908 if ( _ . isObject ( nestedReturnStatement . argument ) && _ . isObject ( nestedReturnStatement . argument . right ) && _ . isObject ( nestedReturnStatement . argument . right . property ) ) {
909909 if ( nestedReturnStatement . argument . right . property . name ) {
910910 modReturnValue = {
@@ -1032,7 +1032,7 @@ convertDefinesAndRequires = function convertDefinesAndRequires(node, parent) {
10321032 } else {
10331033 deps = [ ] ;
10341034 }
1035- hasExportsParam = _ . where ( deps , { 'value' : 'exports' } ) . length ;
1035+ hasExportsParam = _ . filter ( deps , { 'value' : 'exports' } ) . length ;
10361036 if ( _ . isArray ( deps ) && deps . length ) {
10371037 _ . each ( deps , function ( currentDependency ) {
10381038 if ( dependencyBlacklist [ currentDependency . value ] && ! shouldOptimize ) {
@@ -1072,7 +1072,7 @@ convertDefinesAndRequires = function convertDefinesAndRequires(node, parent) {
10721072 amdclean . options . ignoreModules . push ( moduleName ) ;
10731073 return node ;
10741074 }
1075- if ( _ . contains ( options . removeModules , moduleName ) ) {
1075+ if ( _ . includes ( options . removeModules , moduleName ) ) {
10761076 // Remove the current module from the source
10771077 return { 'type' : 'EmptyStatement' } ;
10781078 }
@@ -1089,7 +1089,7 @@ convertDefinesAndRequires = function convertDefinesAndRequires(node, parent) {
10891089 } else if ( params . moduleReturnValue && params . moduleReturnValue . type === 'Identifier' ) {
10901090 type = 'functionExpression' ;
10911091 }
1092- if ( _ . contains ( options . ignoreModules , moduleName ) ) {
1092+ if ( _ . includes ( options . ignoreModules , moduleName ) ) {
10931093 return node ;
10941094 } else if ( utils . isFunctionExpression ( moduleReturnValue ) || type === 'functionExpression' ) {
10951095 return convertToFunctionExpression . call ( amdclean , params ) ;
@@ -1116,16 +1116,16 @@ convertDefinesAndRequires = function convertDefinesAndRequires(node, parent) {
11161116 }
11171117 } else {
11181118 // If the node is a function expression that has an exports parameter and does not return anything, return exports
1119- if ( node . type === 'FunctionExpression' && _ . isArray ( node . params ) && _ . where ( node . params , {
1119+ if ( node . type === 'FunctionExpression' && _ . isArray ( node . params ) && _ . filter ( node . params , {
11201120 'type' : 'Identifier' ,
11211121 'name' : 'exports'
1122- } ) . length && _ . isObject ( node . body ) && _ . isArray ( node . body . body ) && ! _ . where ( node . body . body , { 'type' : 'ReturnStatement' } ) . length ) {
1122+ } ) . length && _ . isObject ( node . body ) && _ . isArray ( node . body . body ) && ! _ . filter ( node . body . body , { 'type' : 'ReturnStatement' } ) . length ) {
11231123 parentHasFunctionExpressionArgument = function ( ) {
11241124 if ( ! parent || ! parent . arguments ) {
11251125 return false ;
11261126 }
11271127 if ( parent && parent . arguments && parent . arguments . length ) {
1128- return _ . where ( parent . arguments , { 'type' : 'FunctionExpression' } ) . length ;
1128+ return _ . filter ( parent . arguments , { 'type' : 'FunctionExpression' } ) . length ;
11291129 }
11301130 return false ;
11311131 } ( ) ;
@@ -1432,7 +1432,7 @@ clean = function clean() {
14321432 } , { } ) ) , hoistedCallbackParameters ) ;
14331433 // Creates variable declarations for each AMD module/callback parameter that needs to be hoisted
14341434 _ . each ( hoistedVariables , function ( moduleValue , moduleName ) {
1435- if ( ! _ . contains ( options . ignoreModules , moduleName ) ) {
1435+ if ( ! _ . includes ( options . ignoreModules , moduleName ) ) {
14361436 var _initValue = amdclean . exportsModules [ moduleName ] !== true ? null : {
14371437 type : 'ObjectExpression' ,
14381438 properties : [ ]
0 commit comments