From fdf249c94e4d8dd0e46ac2e7782cd637a06aec6f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 7 Apr 2016 23:43:26 -0700 Subject: [PATCH] Bump to v4.2.0. --- README.md | 2 +- lodash._baseflatten/LICENSE | 60 +- lodash._baseflatten/README.md | 4 +- lodash._baseflatten/index.js | 42 +- lodash._baseflatten/package.json | 2 +- lodash._basepullat/README.md | 4 +- lodash._basepullat/index.js | 79 +- lodash._basepullat/package.json | 3 +- lodash._baseset/LICENSE | 60 +- lodash._baseset/README.md | 4 +- lodash._baseset/index.js | 113 ++- lodash._baseset/package.json | 6 +- lodash._mapcache/LICENSE | 47 - lodash._mapcache/README.md | 18 - lodash._mapcache/index.js | 546 ----------- lodash._mapcache/package.json | 16 - lodash.assign/README.md | 4 +- lodash.assign/index.js | 184 ++-- lodash.assign/package.json | 2 +- lodash.assignin/README.md | 4 +- lodash.assignin/index.js | 214 ++--- lodash.assignin/package.json | 2 +- lodash.assigninwith/README.md | 4 +- lodash.assigninwith/index.js | 205 ++--- lodash.assigninwith/package.json | 2 +- lodash.assignwith/README.md | 4 +- lodash.assignwith/index.js | 184 ++-- lodash.assignwith/package.json | 2 +- lodash.at/LICENSE | 60 +- lodash.at/README.md | 4 +- lodash.at/index.js | 107 ++- lodash.at/package.json | 6 +- lodash.attempt/LICENSE | 60 +- lodash.attempt/README.md | 4 +- lodash.attempt/index.js | 51 +- lodash.attempt/package.json | 9 +- lodash.bind/README.md | 4 +- lodash.bind/index.js | 1169 +++++++++++++++++++++++- lodash.bind/package.json | 8 +- lodash.bindall/LICENSE | 60 +- lodash.bindall/README.md | 4 +- lodash.bindall/index.js | 11 +- lodash.bindall/package.json | 4 +- lodash.bindkey/README.md | 4 +- lodash.bindkey/index.js | 1162 +++++++++++++++++++++++- lodash.bindkey/package.json | 8 +- lodash.camelcase/README.md | 4 +- lodash.camelcase/index.js | 424 ++++++++- lodash.camelcase/package.json | 9 +- lodash.capitalize/LICENSE | 60 +- lodash.capitalize/README.md | 4 +- lodash.capitalize/index.js | 268 +++++- lodash.capitalize/package.json | 10 +- lodash.chunk/README.md | 4 +- lodash.chunk/index.js | 48 +- lodash.chunk/package.json | 2 +- lodash.clone/README.md | 4 +- lodash.clone/index.js | 55 +- lodash.clone/package.json | 3 +- lodash.clonedeep/README.md | 4 +- lodash.clonedeep/index.js | 55 +- lodash.clonedeep/package.json | 3 +- lodash.clonedeepwith/README.md | 4 +- lodash.clonedeepwith/index.js | 55 +- lodash.clonedeepwith/package.json | 3 +- lodash.clonewith/README.md | 4 +- lodash.clonewith/index.js | 55 +- lodash.clonewith/package.json | 3 +- lodash.concat/LICENSE | 60 +- lodash.concat/README.md | 4 +- lodash.concat/index.js | 94 +- lodash.concat/package.json | 5 +- lodash.cond/README.md | 4 +- lodash.cond/index.js | 308 +------ lodash.cond/package.json | 12 +- lodash.conforms/README.md | 4 +- lodash.conforms/index.js | 55 +- lodash.conforms/package.json | 3 +- lodash.countby/README.md | 4 +- lodash.countby/index.js | 280 +----- lodash.countby/package.json | 9 +- lodash.create/README.md | 4 +- lodash.create/index.js | 184 ++-- lodash.create/package.json | 2 +- lodash.defaults/README.md | 4 +- lodash.defaults/index.js | 205 ++--- lodash.defaults/package.json | 2 +- lodash.defaultsdeep/README.md | 4 +- lodash.defaultsdeep/index.js | 86 +- lodash.defaultsdeep/package.json | 3 +- lodash.difference/LICENSE | 60 +- lodash.difference/README.md | 4 +- lodash.difference/index.js | 18 +- lodash.difference/package.json | 4 +- lodash.differenceby/README.md | 4 +- lodash.differenceby/index.js | 348 +------ lodash.differenceby/package.json | 17 +- lodash.differencewith/LICENSE | 60 +- lodash.differencewith/README.md | 4 +- lodash.differencewith/index.js | 18 +- lodash.differencewith/package.json | 4 +- lodash.droprightwhile/README.md | 4 +- lodash.droprightwhile/index.js | 305 +------ lodash.droprightwhile/package.json | 11 +- lodash.dropwhile/README.md | 4 +- lodash.dropwhile/index.js | 305 +------ lodash.dropwhile/package.json | 11 +- lodash.endswith/README.md | 4 +- lodash.endswith/index.js | 78 +- lodash.endswith/package.json | 8 +- lodash.every/README.md | 4 +- lodash.every/index.js | 243 +---- lodash.every/package.json | 9 +- lodash.filter/README.md | 4 +- lodash.filter/index.js | 289 +----- lodash.filter/package.json | 10 +- lodash.find/README.md | 4 +- lodash.find/index.js | 280 +----- lodash.find/package.json | 9 +- lodash.findindex/README.md | 4 +- lodash.findindex/index.js | 303 +------ lodash.findindex/package.json | 9 +- lodash.findkey/README.md | 4 +- lodash.findkey/index.js | 305 +------ lodash.findkey/package.json | 11 +- lodash.findlast/README.md | 4 +- lodash.findlast/index.js | 280 +----- lodash.findlast/package.json | 9 +- lodash.findlastindex/README.md | 4 +- lodash.findlastindex/index.js | 303 +------ lodash.findlastindex/package.json | 9 +- lodash.findlastkey/README.md | 4 +- lodash.findlastkey/index.js | 305 +------ lodash.findlastkey/package.json | 11 +- lodash.flatmap/LICENSE | 33 +- lodash.flatmap/README.md | 4 +- lodash.flatmap/index.js | 4 +- lodash.flatmap/package.json | 2 +- lodash.flatten/LICENSE | 60 +- lodash.flatten/README.md | 4 +- lodash.flatten/index.js | 8 +- lodash.flatten/package.json | 4 +- lodash.flattendeep/LICENSE | 60 +- lodash.flattendeep/README.md | 4 +- lodash.flattendeep/index.js | 8 +- lodash.flattendeep/package.json | 4 +- lodash.flip/LICENSE | 60 +- lodash.flip/README.md | 4 +- lodash.flip/index.js | 1178 +++++++++++++++++++++++- lodash.flip/package.json | 7 +- lodash.foreach/LICENSE | 60 +- lodash.foreach/README.md | 4 +- lodash.foreach/index.js | 60 +- lodash.foreach/package.json | 5 +- lodash.foreachright/README.md | 4 +- lodash.foreachright/package.json | 4 +- lodash.forin/README.md | 4 +- lodash.forin/package.json | 4 +- lodash.forinright/LICENSE | 60 +- lodash.forinright/README.md | 4 +- lodash.forinright/index.js | 44 +- lodash.forinright/package.json | 3 +- lodash.forown/README.md | 4 +- lodash.forown/package.json | 4 +- lodash.forownright/LICENSE | 60 +- lodash.forownright/README.md | 4 +- lodash.forownright/index.js | 44 +- lodash.forownright/package.json | 3 +- lodash.functions/LICENSE | 60 +- lodash.functions/README.md | 4 +- lodash.functions/index.js | 414 ++++++++- lodash.functions/package.json | 7 +- lodash.functionsin/LICENSE | 60 +- lodash.functionsin/README.md | 4 +- lodash.functionsin/index.js | 408 ++++++++- lodash.functionsin/package.json | 7 +- lodash.get/LICENSE | 60 +- lodash.get/README.md | 4 +- lodash.get/index.js | 111 ++- lodash.get/package.json | 6 +- lodash.groupby/README.md | 4 +- lodash.groupby/index.js | 280 +----- lodash.groupby/package.json | 9 +- lodash.has/README.md | 4 +- lodash.has/index.js | 84 +- lodash.has/package.json | 3 +- lodash.hasin/README.md | 4 +- lodash.hasin/index.js | 84 +- lodash.hasin/package.json | 3 +- lodash.includes/README.md | 4 +- lodash.includes/index.js | 316 ++++++- lodash.includes/package.json | 7 +- lodash.intersection/README.md | 4 +- lodash.intersection/index.js | 4 +- lodash.intersection/package.json | 4 +- lodash.intersectionby/README.md | 4 +- lodash.intersectionby/index.js | 362 +------- lodash.intersectionby/package.json | 17 +- lodash.intersectionwith/README.md | 4 +- lodash.intersectionwith/index.js | 4 +- lodash.intersectionwith/package.json | 4 +- lodash.invert/LICENSE | 60 +- lodash.invert/README.md | 4 +- lodash.invert/index.js | 524 ++++++++++- lodash.invert/package.json | 8 +- lodash.invertby/README.md | 4 +- lodash.invertby/index.js | 46 +- lodash.invertby/package.json | 3 +- lodash.invoke/README.md | 4 +- lodash.invoke/index.js | 79 +- lodash.invoke/package.json | 3 +- lodash.invokemap/README.md | 4 +- lodash.invokemap/index.js | 83 +- lodash.invokemap/package.json | 3 +- lodash.isarraylike/README.md | 4 +- lodash.isarraylike/index.js | 42 +- lodash.isarraylike/package.json | 2 +- lodash.isarraylikeobject/README.md | 4 +- lodash.isarraylikeobject/index.js | 42 +- lodash.isarraylikeobject/package.json | 2 +- lodash.isempty/LICENSE | 60 +- lodash.isempty/README.md | 4 +- lodash.isempty/index.js | 277 +++++- lodash.isempty/package.json | 8 +- lodash.isequal/README.md | 4 +- lodash.isequal/index.js | 571 +++++++++++- lodash.isequal/package.json | 3 +- lodash.isequalwith/README.md | 4 +- lodash.isequalwith/index.js | 571 +++++++++++- lodash.isequalwith/package.json | 3 +- lodash.ismatch/README.md | 4 +- lodash.ismatch/index.js | 619 ++++++++++++- lodash.ismatch/package.json | 3 +- lodash.ismatchwith/README.md | 4 +- lodash.ismatchwith/index.js | 619 ++++++++++++- lodash.ismatchwith/package.json | 3 +- lodash.iteratee/README.md | 4 +- lodash.iteratee/index.js | 308 +------ lodash.iteratee/package.json | 12 +- lodash.keyby/README.md | 4 +- lodash.keyby/index.js | 280 +----- lodash.keyby/package.json | 9 +- lodash.keys/README.md | 4 +- lodash.keys/index.js | 164 +--- lodash.keys/package.json | 2 +- lodash.keysin/README.md | 4 +- lodash.keysin/index.js | 201 ++--- lodash.keysin/package.json | 2 +- lodash.lowercase/README.md | 4 +- lodash.lowercase/index.js | 294 +++++- lodash.lowercase/package.json | 8 +- lodash.lowerfirst/LICENSE | 60 +- lodash.lowerfirst/README.md | 4 +- lodash.lowerfirst/index.js | 37 +- lodash.lowerfirst/package.json | 5 +- lodash.map/README.md | 4 +- lodash.map/index.js | 262 +----- lodash.map/package.json | 10 +- lodash.mapkeys/README.md | 4 +- lodash.mapkeys/index.js | 308 +------ lodash.mapkeys/package.json | 11 +- lodash.mapvalues/README.md | 4 +- lodash.mapvalues/index.js | 307 +------ lodash.mapvalues/package.json | 11 +- lodash.matches/README.md | 4 +- lodash.matches/index.js | 572 +++++++++++- lodash.matches/package.json | 7 +- lodash.matchesproperty/README.md | 4 +- lodash.matchesproperty/index.js | 797 +++++++++++++++- lodash.matchesproperty/package.json | 10 +- lodash.maxby/README.md | 4 +- lodash.maxby/index.js | 303 +------ lodash.maxby/package.json | 9 +- lodash.merge/README.md | 4 +- lodash.merge/index.js | 103 ++- lodash.merge/package.json | 3 +- lodash.mergewith/README.md | 4 +- lodash.mergewith/index.js | 91 +- lodash.mergewith/package.json | 3 +- lodash.method/README.md | 4 +- lodash.method/index.js | 79 +- lodash.method/package.json | 3 +- lodash.methodof/README.md | 4 +- lodash.methodof/index.js | 79 +- lodash.methodof/package.json | 3 +- lodash.minby/README.md | 4 +- lodash.minby/index.js | 303 +------ lodash.minby/package.json | 9 +- lodash.mixin/README.md | 4 +- lodash.mixin/index.js | 412 ++++++++- lodash.mixin/package.json | 7 +- lodash.ntharg/README.md | 4 +- lodash.ntharg/index.js | 67 +- lodash.ntharg/package.json | 7 +- lodash.omit/README.md | 4 +- lodash.omit/index.js | 5 +- lodash.omit/package.json | 4 +- lodash.omitby/README.md | 4 +- lodash.omitby/index.js | 305 +------ lodash.omitby/package.json | 11 +- lodash.orderby/README.md | 4 +- lodash.orderby/index.js | 262 +----- lodash.orderby/package.json | 10 +- lodash.over/README.md | 4 +- lodash.over/index.js | 314 +------ lodash.over/package.json | 12 +- lodash.overargs/README.md | 4 +- lodash.overargs/index.js | 330 +------ lodash.overargs/package.json | 12 +- lodash.overevery/README.md | 4 +- lodash.overevery/index.js | 314 +------ lodash.overevery/package.json | 12 +- lodash.oversome/README.md | 4 +- lodash.oversome/index.js | 330 +------ lodash.oversome/package.json | 12 +- lodash.pad/LICENSE | 60 +- lodash.pad/README.md | 4 +- lodash.pad/index.js | 158 +++- lodash.pad/package.json | 5 +- lodash.padend/README.md | 4 +- lodash.padend/index.js | 6 +- lodash.padend/package.json | 4 +- lodash.padstart/README.md | 4 +- lodash.padstart/index.js | 6 +- lodash.padstart/package.json | 4 +- lodash.partial/README.md | 4 +- lodash.partial/index.js | 1168 +++++++++++++++++++++++- lodash.partial/package.json | 8 +- lodash.partialright/README.md | 4 +- lodash.partialright/index.js | 1168 +++++++++++++++++++++++- lodash.partialright/package.json | 8 +- lodash.partition/README.md | 4 +- lodash.partition/index.js | 280 +----- lodash.partition/package.json | 9 +- lodash.pick/LICENSE | 60 +- lodash.pick/README.md | 4 +- lodash.pick/index.js | 11 +- lodash.pick/package.json | 4 +- lodash.pickby/README.md | 4 +- lodash.pickby/index.js | 305 +------ lodash.pickby/package.json | 11 +- lodash.property/LICENSE | 60 +- lodash.property/README.md | 4 +- lodash.property/index.js | 113 ++- lodash.property/package.json | 6 +- lodash.propertyof/LICENSE | 60 +- lodash.propertyof/README.md | 4 +- lodash.propertyof/index.js | 105 ++- lodash.propertyof/package.json | 6 +- lodash.pullall/LICENSE | 60 +- lodash.pullall/README.md | 4 +- lodash.pullall/index.js | 191 +++- lodash.pullall/package.json | 7 +- lodash.pullallby/README.md | 4 +- lodash.pullallby/index.js | 305 +------ lodash.pullallby/package.json | 11 +- lodash.pullat/LICENSE | 60 +- lodash.pullat/README.md | 4 +- lodash.pullat/index.js | 109 ++- lodash.pullat/package.json | 8 +- lodash.rangeright/README.md | 4 +- lodash.rangeright/index.js | 46 +- lodash.rangeright/package.json | 2 +- lodash.rearg/LICENSE | 60 +- lodash.rearg/README.md | 4 +- lodash.rearg/index.js | 13 +- lodash.rearg/package.json | 4 +- lodash.reduce/README.md | 4 +- lodash.reduce/index.js | 282 +----- lodash.reduce/package.json | 11 +- lodash.reduceright/README.md | 4 +- lodash.reduceright/index.js | 282 +----- lodash.reduceright/package.json | 11 +- lodash.reject/README.md | 4 +- lodash.reject/index.js | 289 +----- lodash.reject/package.json | 10 +- lodash.remove/README.md | 4 +- lodash.remove/index.js | 312 +------ lodash.remove/package.json | 11 +- lodash.result/README.md | 4 +- lodash.result/index.js | 69 +- lodash.result/package.json | 3 +- lodash.sample/LICENSE | 60 +- lodash.sample/README.md | 4 +- lodash.sample/index.js | 336 ++++++- lodash.sample/package.json | 7 +- lodash.samplesize/README.md | 4 +- lodash.samplesize/index.js | 200 ++--- lodash.samplesize/package.json | 2 +- lodash.set/README.md | 4 +- lodash.set/index.js | 2 +- lodash.set/package.json | 4 +- lodash.setwith/README.md | 4 +- lodash.setwith/index.js | 2 +- lodash.setwith/package.json | 4 +- lodash.shuffle/README.md | 4 +- lodash.shuffle/index.js | 200 ++--- lodash.shuffle/package.json | 2 +- lodash.size/README.md | 4 +- lodash.size/index.js | 305 ++----- lodash.size/package.json | 2 +- lodash.slice/README.md | 4 +- lodash.slice/index.js | 48 +- lodash.slice/package.json | 2 +- lodash.some/README.md | 4 +- lodash.some/index.js | 243 +---- lodash.some/package.json | 9 +- lodash.sortby/README.md | 4 +- lodash.sortby/index.js | 293 +----- lodash.sortby/package.json | 12 +- lodash.sortedindexby/README.md | 4 +- lodash.sortedindexby/index.js | 305 +------ lodash.sortedindexby/package.json | 11 +- lodash.sortedlastindexby/README.md | 4 +- lodash.sortedlastindexby/index.js | 305 +------ lodash.sortedlastindexby/package.json | 11 +- lodash.sorteduniq/README.md | 4 +- lodash.sorteduniq/index.js | 64 +- lodash.sorteduniq/package.json | 7 +- lodash.sorteduniqby/README.md | 4 +- lodash.sorteduniqby/index.js | 305 +------ lodash.sorteduniqby/package.json | 11 +- lodash.split/README.md | 4 +- lodash.split/index.js | 230 ++++- lodash.split/package.json | 3 +- lodash.spread/README.md | 4 +- lodash.spread/index.js | 74 +- lodash.spread/package.json | 8 +- lodash.startcase/LICENSE | 60 +- lodash.startcase/README.md | 4 +- lodash.startcase/index.js | 27 +- lodash.startcase/package.json | 6 +- lodash.startswith/README.md | 4 +- lodash.startswith/index.js | 76 +- lodash.startswith/package.json | 8 +- lodash.subtract/README.md | 4 +- lodash.subtract/index.js | 130 ++- lodash.subtract/package.json | 8 +- lodash.sumby/README.md | 4 +- lodash.sumby/index.js | 303 +------ lodash.sumby/package.json | 9 +- lodash.takerightwhile/README.md | 4 +- lodash.takerightwhile/index.js | 305 +------ lodash.takerightwhile/package.json | 11 +- lodash.takewhile/README.md | 4 +- lodash.takewhile/index.js | 305 +------ lodash.takewhile/package.json | 11 +- lodash.template/README.md | 4 +- lodash.template/index.js | 42 +- lodash.template/package.json | 5 +- lodash.templatesettings/LICENSE | 2 +- lodash.templatesettings/README.md | 6 +- lodash.templatesettings/index.js | 146 ++- lodash.templatesettings/package.json | 13 +- lodash.times/README.md | 4 +- lodash.times/package.json | 4 +- lodash.toarray/README.md | 4 +- lodash.toarray/index.js | 31 +- lodash.toarray/package.json | 3 +- lodash.topairs/README.md | 4 +- lodash.topairs/index.js | 476 +++++++++- lodash.topairs/package.json | 8 +- lodash.topairsin/README.md | 4 +- lodash.topairsin/index.js | 467 +++++++++- lodash.topairsin/package.json | 8 +- lodash.topath/README.md | 4 +- lodash.topath/index.js | 27 +- lodash.topath/package.json | 3 +- lodash.toplainobject/README.md | 4 +- lodash.toplainobject/index.js | 205 ++--- lodash.toplainobject/package.json | 2 +- lodash.transform/README.md | 4 +- lodash.transform/index.js | 301 +------ lodash.transform/package.json | 12 +- lodash.trim/README.md | 4 +- lodash.trim/index.js | 92 +- lodash.trim/package.json | 4 +- lodash.trimend/README.md | 4 +- lodash.trimend/index.js | 74 +- lodash.trimend/package.json | 3 +- lodash.trimstart/README.md | 4 +- lodash.trimstart/index.js | 75 +- lodash.trimstart/package.json | 3 +- lodash.truncate/README.md | 4 +- lodash.truncate/index.js | 22 +- lodash.truncate/package.json | 3 +- lodash.unary/LICENSE | 60 +- lodash.unary/README.md | 4 +- lodash.unary/index.js | 1198 ++++++++++++++++++++++++- lodash.unary/package.json | 9 +- lodash.union/LICENSE | 33 +- lodash.union/README.md | 4 +- lodash.union/index.js | 295 +----- lodash.union/package.json | 8 +- lodash.unionby/README.md | 4 +- lodash.unionby/index.js | 468 +--------- lodash.unionby/package.json | 17 +- lodash.unionwith/LICENSE | 33 +- lodash.unionwith/README.md | 4 +- lodash.unionwith/index.js | 208 +---- lodash.unionwith/package.json | 8 +- lodash.uniq/LICENSE | 33 +- lodash.uniq/README.md | 4 +- lodash.uniq/index.js | 289 +----- lodash.uniq/package.json | 8 +- lodash.uniqby/README.md | 4 +- lodash.uniqby/index.js | 562 +----------- lodash.uniqby/package.json | 15 +- lodash.uniqwith/LICENSE | 33 +- lodash.uniqwith/README.md | 4 +- lodash.uniqwith/index.js | 289 +----- lodash.uniqwith/package.json | 8 +- lodash.unset/README.md | 4 +- lodash.unset/index.js | 415 ++++++++- lodash.unset/package.json | 4 +- lodash.unzipwith/LICENSE | 60 +- lodash.unzipwith/README.md | 4 +- lodash.unzipwith/index.js | 313 ++++++- lodash.unzipwith/package.json | 9 +- lodash.uppercase/README.md | 4 +- lodash.uppercase/index.js | 294 +++++- lodash.uppercase/package.json | 8 +- lodash.upperfirst/LICENSE | 60 +- lodash.upperfirst/README.md | 4 +- lodash.upperfirst/index.js | 37 +- lodash.upperfirst/package.json | 5 +- lodash.values/LICENSE | 60 +- lodash.values/README.md | 4 +- lodash.values/index.js | 478 +++++++++- lodash.values/package.json | 9 +- lodash.valuesin/LICENSE | 60 +- lodash.valuesin/README.md | 4 +- lodash.valuesin/index.js | 472 +++++++++- lodash.valuesin/package.json | 9 +- lodash.without/LICENSE | 60 +- lodash.without/README.md | 4 +- lodash.without/index.js | 13 +- lodash.without/package.json | 4 +- lodash.words/README.md | 4 +- lodash.words/index.js | 45 +- lodash.words/package.json | 2 +- lodash.xor/LICENSE | 33 +- lodash.xor/README.md | 4 +- lodash.xor/index.js | 320 +------ lodash.xor/package.json | 10 +- lodash.xorby/README.md | 4 +- lodash.xorby/index.js | 580 +----------- lodash.xorby/package.json | 19 +- lodash.xorwith/LICENSE | 33 +- lodash.xorwith/README.md | 4 +- lodash.xorwith/index.js | 320 +------ lodash.xorwith/package.json | 10 +- lodash.zip/README.md | 4 +- lodash.zip/index.js | 29 +- lodash.zip/package.json | 2 +- lodash.zipobjectdeep/LICENSE | 60 +- lodash.zipobjectdeep/README.md | 4 +- lodash.zipobjectdeep/index.js | 16 +- lodash.zipobjectdeep/package.json | 4 +- lodash.zipwith/README.md | 4 +- lodash.zipwith/index.js | 29 +- lodash.zipwith/package.json | 2 +- 562 files changed, 23863 insertions(+), 21738 deletions(-) delete mode 100644 lodash._mapcache/LICENSE delete mode 100644 lodash._mapcache/README.md delete mode 100644 lodash._mapcache/index.js delete mode 100644 lodash._mapcache/package.json diff --git a/README.md b/README.md index 2326b4ae4..56f0627b9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v4.1.5 +# lodash v4.2.0 The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method. diff --git a/lodash._baseflatten/LICENSE b/lodash._baseflatten/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash._baseflatten/LICENSE +++ b/lodash._baseflatten/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash._baseflatten/README.md b/lodash._baseflatten/README.md index 4250ad4af..bfa8eb7f4 100644 --- a/lodash._baseflatten/README.md +++ b/lodash._baseflatten/README.md @@ -1,4 +1,4 @@ -# lodash._baseflatten v4.1.1 +# lodash._baseflatten v4.2.0 The internal [lodash](https://lodash.com/) function `baseFlatten` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var baseFlatten = require('lodash._baseflatten'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash._baseflatten) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash._baseflatten) for more details. diff --git a/lodash._baseflatten/index.js b/lodash._baseflatten/index.js index 116717c5d..0daaa0162 100644 --- a/lodash._baseflatten/index.js +++ b/lodash._baseflatten/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as references for various `Number` constants. */ @@ -41,7 +41,8 @@ var objectProto = Object.prototype; var hasOwnProperty = objectProto.hasOwnProperty; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -55,23 +56,24 @@ var propertyIsEnumerable = objectProto.propertyIsEnumerable; * @private * @param {Array} array The array to flatten. * @param {number} depth The maximum recursion depth. - * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ -function baseFlatten(array, depth, isStrict, result) { - result || (result = []); - +function baseFlatten(array, depth, predicate, isStrict, result) { var index = -1, length = array.length; + predicate || (predicate = isFlattenable); + result || (result = []); + while (++index < length) { var value = array[index]; - if (depth > 0 && isArrayLikeObject(value) && - (isStrict || isArray(value) || isArguments(value))) { + if (depth > 0 && predicate(value)) { if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, depth - 1, isStrict, result); + baseFlatten(value, depth - 1, predicate, isStrict, result); } else { arrayPush(result, value); } @@ -108,6 +110,17 @@ function baseProperty(key) { */ var getLength = baseProperty('length'); +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable(value) { + return isArrayLikeObject(value) && (isArray(value) || isArguments(value)); +} + /** * Checks if `value` is likely an `arguments` object. * @@ -276,8 +289,9 @@ function isLength(value) { } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ diff --git a/lodash._baseflatten/package.json b/lodash._baseflatten/package.json index d464f99d0..7f8f55250 100644 --- a/lodash._baseflatten/package.json +++ b/lodash._baseflatten/package.json @@ -1,6 +1,6 @@ { "name": "lodash._baseflatten", - "version": "4.1.1", + "version": "4.2.0", "description": "The internal lodash function `baseFlatten` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash._basepullat/README.md b/lodash._basepullat/README.md index b7ce39fd9..3dda9ec9c 100644 --- a/lodash._basepullat/README.md +++ b/lodash._basepullat/README.md @@ -1,4 +1,4 @@ -# lodash._basepullat v4.1.1 +# lodash._basepullat v4.2.0 The internal [lodash](https://lodash.com/) function `basePullAt` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var basePullAt = require('lodash._basepullat'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash._basepullat) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash._basepullat) for more details. diff --git a/lodash._basepullat/index.js b/lodash._basepullat/index.js index 4da9b7d5a..01f75f45a 100644 --- a/lodash._basepullat/index.js +++ b/lodash._basepullat/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), toString = require('lodash.tostring'); /** Used as references for various `Number` constants. */ @@ -44,6 +43,37 @@ var arrayProto = Array.prototype; /** Built-in value references. */ var splice = arrayProto.splice; +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + /** * The base implementation of `_.pullAt` without support for individual * indexes or capturing the removed elements. @@ -65,7 +95,7 @@ function basePullAt(array, indexes) { splice.call(array, index, 1); } else if (!isKey(index, array)) { - var path = baseToPath(index), + var path = baseCastPath(index), object = parent(array, path); if (object != null) { @@ -80,18 +110,6 @@ function basePullAt(array, indexes) { return array; } -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Checks if `value` is a property name and not a property path. * @@ -159,7 +177,7 @@ function last(array) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -179,4 +197,33 @@ function last(array) { */ var isArray = Array.isArray; +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + module.exports = basePullAt; diff --git a/lodash._basepullat/package.json b/lodash._basepullat/package.json index 8437d2a3e..58b4395da 100644 --- a/lodash._basepullat/package.json +++ b/lodash._basepullat/package.json @@ -1,6 +1,6 @@ { "name": "lodash._basepullat", - "version": "4.1.1", + "version": "4.2.0", "description": "The internal lodash function `basePullAt` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash._baseset/LICENSE b/lodash._baseset/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash._baseset/LICENSE +++ b/lodash._baseset/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash._baseset/README.md b/lodash._baseset/README.md index 0a518f6a3..f4af39063 100644 --- a/lodash._baseset/README.md +++ b/lodash._baseset/README.md @@ -1,4 +1,4 @@ -# lodash._baseset v4.1.3 +# lodash._baseset v4.2.0 The internal [lodash](https://lodash.com/) function `baseSet` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var baseSet = require('lodash._baseset'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.1.3-npm-packages/lodash._baseset) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash._baseset) for more details. diff --git a/lodash._baseset/index.js b/lodash._baseset/index.js index 095bb08ab..d0870e759 100644 --- a/lodash._baseset/index.js +++ b/lodash._baseset/index.js @@ -1,23 +1,22 @@ /** - * lodash 4.1.3 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var toString = require('lodash.tostring'); +var stringToPath = require('lodash._stringtopath'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + reIsPlainProp = /^\w*$/; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; @@ -42,6 +41,13 @@ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) @@ -82,7 +88,7 @@ function baseCastPath(value) { * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { - path = isKey(path, object) ? [path + ''] : baseCastPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = -1, length = path.length, @@ -118,35 +124,23 @@ function baseSet(object, path, value, customizer) { * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { - if (typeof value == 'number') { + var type = typeof value; + if (type == 'number' || type == 'symbol') { return true; } return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } /** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. @@ -180,10 +174,12 @@ function eq(value, other) { * * @static * @memberOf _ + * @since 0.1.0 * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -201,11 +197,13 @@ function eq(value, other) { var isArray = Array.isArray; /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. @@ -228,4 +226,55 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + module.exports = baseSet; diff --git a/lodash._baseset/package.json b/lodash._baseset/package.json index f8571e2d4..2f4644ac8 100644 --- a/lodash._baseset/package.json +++ b/lodash._baseset/package.json @@ -1,6 +1,6 @@ { "name": "lodash._baseset", - "version": "4.1.3", + "version": "4.2.0", "description": "The internal lodash function `baseSet` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -8,12 +8,12 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash.tostring": "^4.0.0" + "lodash._stringtopath": "~4.7.0" } } diff --git a/lodash._mapcache/LICENSE b/lodash._mapcache/LICENSE deleted file mode 100644 index e0c69d560..000000000 --- a/lodash._mapcache/LICENSE +++ /dev/null @@ -1,47 +0,0 @@ -Copyright jQuery Foundation and other contributors - -Based on Underscore.js, copyright Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors - -This software consists of voluntary contributions made by many -individuals. For exact contribution history, see the revision history -available at https://github.com/lodash/lodash - -The following license applies to all parts of this software except as -documented below: - -==== - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==== - -Copyright and related rights for sample code are waived via CC0. Sample -code is defined as all source code displayed within the prose of the -documentation. - -CC0: http://creativecommons.org/publicdomain/zero/1.0/ - -==== - -Files located in the node_modules and vendor directories are externally -maintained libraries used by this software which have their own -licenses; we recommend you read them, as their terms may differ from the -terms above. diff --git a/lodash._mapcache/README.md b/lodash._mapcache/README.md deleted file mode 100644 index 68c6245c0..000000000 --- a/lodash._mapcache/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# lodash._mapcache v4.1.5 - -The internal [lodash](https://lodash.com/) function `MapCache` exported as a [Node.js](https://nodejs.org/) module. - -## Installation - -Using npm: -```bash -$ {sudo -H} npm i -g npm -$ npm i --save lodash._mapcache -``` - -In Node.js: -```js -var MapCache = require('lodash._mapcache'); -``` - -See the [package source](https://github.com/lodash/lodash/blob/4.1.5-npm-packages/lodash._mapcache) for more details. diff --git a/lodash._mapcache/index.js b/lodash._mapcache/index.js deleted file mode 100644 index 85790a167..000000000 --- a/lodash._mapcache/index.js +++ /dev/null @@ -1,546 +0,0 @@ -/** - * lodash 4.1.5 (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). - */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; - -/** Detect free variable `exports`. */ -var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) - ? exports - : undefined; - -/** Detect free variable `module`. */ -var freeModule = (objectTypes[typeof module] && module && !module.nodeType) - ? module - : undefined; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || - ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || - freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** Used for built-in method references. */ -var arrayProto = Array.prototype, - objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** Built-in value references. */ -var splice = arrayProto.splice; - -/* Built-in method references that are verified to be native. */ -var Map = getNative(root, 'Map'), - nativeCreate = getNative(Object, 'create'); - -/** - * Creates a hash object. - * - * @private - * @constructor - * @returns {Object} Returns the new hash object. - */ -function Hash() {} - -/** - * Removes `key` and its value from the hash. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(hash, key) { - return hashHas(hash, key) && delete hash[key]; -} - -/** - * Gets the hash value for `key`. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(hash, key) { - if (nativeCreate) { - var result = hash[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(hash, key) ? hash[key] : undefined; -} - -/** - * Checks if a hash value for `key` exists. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(hash, key) { - return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); -} - -/** - * Sets the hash `key` to `value`. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ -function hashSet(hash, key, value) { - hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; -} - -// Avoid inheriting from `Object.prototype` when possible. -Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; - -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ -function MapCache(values) { - var index = -1, - length = values ? values.length : 0; - - this.clear(); - while (++index < length) { - var entry = values[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapClear() { - this.__data__ = { - 'hash': new Hash, - 'map': Map ? new Map : [], - 'string': new Hash - }; -} - -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapDelete(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashDelete(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map['delete'](key) : assocDelete(data.map, key); -} - -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapGet(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashGet(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.get(key) : assocGet(data.map, key); -} - -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapHas(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashHas(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.has(key) : assocHas(data.map, key); -} - -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ -function mapSet(key, value) { - var data = this.__data__; - if (isKeyable(key)) { - hashSet(typeof key == 'string' ? data.string : data.hash, key, value); - } else if (Map) { - data.map.set(key, value); - } else { - assocSet(data.map, key, value); - } - return this; -} - -// Add methods to `MapCache`. -MapCache.prototype.clear = mapClear; -MapCache.prototype['delete'] = mapDelete; -MapCache.prototype.get = mapGet; -MapCache.prototype.has = mapHas; -MapCache.prototype.set = mapSet; - -/** - * Removes `key` and its value from the associative array. - * - * @private - * @param {Array} array The array to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function assocDelete(array, key) { - var index = assocIndexOf(array, key); - if (index < 0) { - return false; - } - var lastIndex = array.length - 1; - if (index == lastIndex) { - array.pop(); - } else { - splice.call(array, index, 1); - } - return true; -} - -/** - * Gets the associative array value for `key`. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function assocGet(array, key) { - var index = assocIndexOf(array, key); - return index < 0 ? undefined : array[index][1]; -} - -/** - * Checks if an associative array value for `key` exists. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function assocHas(array, key) { - return assocIndexOf(array, key) > -1; -} - -/** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to search. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; -} - -/** - * Sets the associative array `key` to `value`. - * - * @private - * @param {Array} array The array to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ -function assocSet(array, key, value) { - var index = assocIndexOf(array, key); - if (index < 0) { - array.push([key, value]); - } else { - array[index][1] = value; - } -} - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ -function isKeyable(value) { - var type = typeof value; - return type == 'number' || type == 'boolean' || - (type == 'string' && value != '__proto__') || value == null; -} - -/** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to process. - * @returns {string} Returns the source code. - */ -function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; -} - -/** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'user': 'fred' }; - * var other = { 'user': 'fred' }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ -function eq(value, other) { - return value === other || (value !== value && other !== other); -} - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (!isObject(value)) { - return false; - } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); -} - -module.exports = MapCache; diff --git a/lodash._mapcache/package.json b/lodash._mapcache/package.json deleted file mode 100644 index 4bd4bad7d..000000000 --- a/lodash._mapcache/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "lodash._mapcache", - "version": "4.1.5", - "description": "The internal lodash function `MapCache` exported as a module.", - "homepage": "https://lodash.com/", - "icon": "https://lodash.com/icon.svg", - "license": "MIT", - "author": "John-David Dalton (http://allyoucanleet.com/)", - "contributors": [ - "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", - "Mathias Bynens (https://mathiasbynens.be/)" - ], - "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } -} diff --git a/lodash.assign/README.md b/lodash.assign/README.md index cbea4d943..6bce2d6bd 100644 --- a/lodash.assign/README.md +++ b/lodash.assign/README.md @@ -1,4 +1,4 @@ -# lodash.assign v4.1.0 +# lodash.assign v4.2.0 The [lodash](https://lodash.com/) method `_.assign` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var assign = require('lodash.assign'); ``` -See the [documentation](https://lodash.com/docs#assign) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.assign) for more details. +See the [documentation](https://lodash.com/docs#assign) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.assign) for more details. diff --git a/lodash.assign/index.js b/lodash.assign/index.js index 09b346ee7..8b007bc78 100644 --- a/lodash.assign/index.js +++ b/lodash.assign/index.js @@ -13,8 +13,7 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + genTag = '[object GeneratorFunction]'; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; @@ -39,19 +38,6 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -72,7 +58,7 @@ function baseTimes(n, iteratee) { } /** - * Creates a function that invokes `func` with its first argument transformed. + * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. @@ -93,7 +79,7 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -102,16 +88,42 @@ var objectToString = objectProto.toString; var propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetPrototype = Object.getPrototypeOf, - nativeKeys = Object.keys, +var nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max; /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -128,31 +140,24 @@ function assignValue(object, key, value) { } /** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); -} - -/** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. @@ -244,45 +249,6 @@ function createAssigner(assigner) { }); } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Gets the `[[Prototype]]` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {null|Object} Returns the `[[Prototype]]`. - */ -var getPrototype = overArg(nativeGetPrototype, Object); - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -338,7 +304,7 @@ function isPrototype(value) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -391,7 +357,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -447,7 +413,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -498,8 +464,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -507,16 +472,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -538,7 +502,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -594,28 +558,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * Assigns own enumerable string keyed properties of source objects to the * destination object. Source objects are applied from left to right. @@ -664,7 +606,7 @@ var assign = createAssigner(function(object, source) { * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -689,23 +631,7 @@ var assign = createAssigner(function(object, source) { * // => ['0', '1'] */ function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } module.exports = assign; diff --git a/lodash.assign/package.json b/lodash.assign/package.json index 064b6855a..78672ead9 100644 --- a/lodash.assign/package.json +++ b/lodash.assign/package.json @@ -1,6 +1,6 @@ { "name": "lodash.assign", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.assign` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.assignin/README.md b/lodash.assignin/README.md index 09337a7c8..02ac41c84 100644 --- a/lodash.assignin/README.md +++ b/lodash.assignin/README.md @@ -1,4 +1,4 @@ -# lodash.assignin v4.1.0 +# lodash.assignin v4.2.0 The [lodash](https://lodash.com/) method `_.assignIn` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var assignIn = require('lodash.assignin'); ``` -See the [documentation](https://lodash.com/docs#assignIn) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.assignin) for more details. +See the [documentation](https://lodash.com/docs#assignIn) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.assignin) for more details. diff --git a/lodash.assignin/index.js b/lodash.assignin/index.js index 0dcc7784d..cc0f2c227 100644 --- a/lodash.assignin/index.js +++ b/lodash.assignin/index.js @@ -13,21 +13,11 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + genTag = '[object GeneratorFunction]'; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. @@ -48,19 +38,6 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -80,23 +57,6 @@ function baseTimes(n, iteratee) { return result; } -/** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ -function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -105,25 +65,47 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ -var Reflect = root.Reflect, - enumerate = Reflect ? Reflect.enumerate : undefined, - propertyIsEnumerable = objectProto.propertyIsEnumerable; +var propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; -/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ -var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -140,30 +122,27 @@ function assignValue(object, key, value) { } /** - * The base implementation of `_.keysIn` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { - object = object == null ? object : Object(object); + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; - var result = []; for (var key in object) { - result.push(key); + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } } return result; } -// Fallback for IE < 9 with es6-shim. -if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { - baseKeysIn = function(object) { - return iteratorToArray(enumerate(object)); - }; -} - /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * @@ -254,36 +233,6 @@ function createAssigner(assigner) { }); } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -337,9 +286,28 @@ function isPrototype(value) { return value === proto; } +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} + /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -392,7 +360,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -448,7 +416,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -499,8 +467,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -508,16 +475,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -539,7 +505,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -595,28 +561,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * This method is like `_.assign` except that it iterates over own and * inherited source properties. @@ -649,13 +593,7 @@ function isString(value) { * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } */ var assignIn = createAssigner(function(object, source) { - if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { - copyObject(source, keysIn(source), object); - return; - } - for (var key in source) { - assignValue(object, key, source[key]); - } + copyObject(source, keysIn(source), object); }); /** @@ -682,23 +620,7 @@ var assignIn = createAssigner(function(object, source) { * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { - var index = -1, - isProto = isPrototype(object), - props = baseKeysIn(object), - propsLength = props.length, - indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - while (++index < propsLength) { - var key = props[index]; - if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } module.exports = assignIn; diff --git a/lodash.assignin/package.json b/lodash.assignin/package.json index e0af89f25..dc4451287 100644 --- a/lodash.assignin/package.json +++ b/lodash.assignin/package.json @@ -1,6 +1,6 @@ { "name": "lodash.assignin", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.assignIn` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.assigninwith/README.md b/lodash.assigninwith/README.md index 89cb14eb4..c0feab12c 100644 --- a/lodash.assigninwith/README.md +++ b/lodash.assigninwith/README.md @@ -1,4 +1,4 @@ -# lodash.assigninwith v4.1.0 +# lodash.assigninwith v4.2.0 The [lodash](https://lodash.com/) method `_.assignInWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var assignInWith = require('lodash.assigninwith'); ``` -See the [documentation](https://lodash.com/docs#assignInWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.assigninwith) for more details. +See the [documentation](https://lodash.com/docs#assignInWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.assigninwith) for more details. diff --git a/lodash.assigninwith/index.js b/lodash.assigninwith/index.js index 7253835d5..8f0c0574f 100644 --- a/lodash.assigninwith/index.js +++ b/lodash.assigninwith/index.js @@ -13,21 +13,11 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + genTag = '[object GeneratorFunction]'; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. @@ -48,19 +38,6 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -80,23 +57,6 @@ function baseTimes(n, iteratee) { return result; } -/** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ -function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -105,22 +65,47 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ -var Reflect = root.Reflect, - enumerate = Reflect ? Reflect.enumerate : undefined, - propertyIsEnumerable = objectProto.propertyIsEnumerable; +var propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -137,30 +122,27 @@ function assignValue(object, key, value) { } /** - * The base implementation of `_.keysIn` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { - object = object == null ? object : Object(object); + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; - var result = []; for (var key in object) { - result.push(key); + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } } return result; } -// Fallback for IE < 9 with es6-shim. -if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { - baseKeysIn = function(object) { - return iteratorToArray(enumerate(object)); - }; -} - /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * @@ -251,36 +233,6 @@ function createAssigner(assigner) { }); } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -334,9 +286,28 @@ function isPrototype(value) { return value === proto; } +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} + /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -389,7 +360,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -445,7 +416,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -496,8 +467,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -505,16 +475,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -536,7 +505,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -592,28 +561,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * This method is like `_.assignIn` except that it accepts `customizer` * which is invoked to produce the assigned values. If `customizer` returns @@ -671,23 +618,7 @@ var assignInWith = createAssigner(function(object, source, srcIndex, customizer) * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { - var index = -1, - isProto = isPrototype(object), - props = baseKeysIn(object), - propsLength = props.length, - indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - while (++index < propsLength) { - var key = props[index]; - if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } module.exports = assignInWith; diff --git a/lodash.assigninwith/package.json b/lodash.assigninwith/package.json index 4f137b1e1..54d1b78dc 100644 --- a/lodash.assigninwith/package.json +++ b/lodash.assigninwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.assigninwith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.assignInWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.assignwith/README.md b/lodash.assignwith/README.md index fa7e20140..026191eb5 100644 --- a/lodash.assignwith/README.md +++ b/lodash.assignwith/README.md @@ -1,4 +1,4 @@ -# lodash.assignwith v4.1.0 +# lodash.assignwith v4.2.0 The [lodash](https://lodash.com/) method `_.assignWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var assignWith = require('lodash.assignwith'); ``` -See the [documentation](https://lodash.com/docs#assignWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.assignwith) for more details. +See the [documentation](https://lodash.com/docs#assignWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.assignwith) for more details. diff --git a/lodash.assignwith/index.js b/lodash.assignwith/index.js index fdfc5a3d0..921dfce74 100644 --- a/lodash.assignwith/index.js +++ b/lodash.assignwith/index.js @@ -13,8 +13,7 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + genTag = '[object GeneratorFunction]'; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; @@ -39,19 +38,6 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -72,7 +58,7 @@ function baseTimes(n, iteratee) { } /** - * Creates a function that invokes `func` with its first argument transformed. + * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. @@ -93,7 +79,7 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -102,13 +88,39 @@ var objectToString = objectProto.toString; var propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetPrototype = Object.getPrototypeOf, - nativeKeys = Object.keys, +var nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -125,31 +137,24 @@ function assignValue(object, key, value) { } /** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); -} - -/** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. @@ -241,45 +246,6 @@ function createAssigner(assigner) { }); } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Gets the `[[Prototype]]` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {null|Object} Returns the `[[Prototype]]`. - */ -var getPrototype = overArg(nativeGetPrototype, Object); - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -335,7 +301,7 @@ function isPrototype(value) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -388,7 +354,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -444,7 +410,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -495,8 +461,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -504,16 +469,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -535,7 +499,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -591,28 +555,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * This method is like `_.assign` except that it accepts `customizer` * which is invoked to produce the assigned values. If `customizer` returns @@ -649,7 +591,7 @@ var assignWith = createAssigner(function(object, source, srcIndex, customizer) { * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -674,23 +616,7 @@ var assignWith = createAssigner(function(object, source, srcIndex, customizer) { * // => ['0', '1'] */ function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } module.exports = assignWith; diff --git a/lodash.assignwith/package.json b/lodash.assignwith/package.json index 88e235bb9..07605f36f 100644 --- a/lodash.assignwith/package.json +++ b/lodash.assignwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.assignwith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.assignWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.at/LICENSE b/lodash.at/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.at/LICENSE +++ b/lodash.at/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.at/README.md b/lodash.at/README.md index 5e4db10aa..d8426c697 100644 --- a/lodash.at/README.md +++ b/lodash.at/README.md @@ -1,4 +1,4 @@ -# lodash.at v4.1.1 +# lodash.at v4.2.0 The [lodash](https://lodash.com/) method `_.at` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var at = require('lodash.at'); ``` -See the [documentation](https://lodash.com/docs#at) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.at) for more details. +See the [documentation](https://lodash.com/docs#at) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.at) for more details. diff --git a/lodash.at/index.js b/lodash.at/index.js index 15cc3c72a..3c4dba956 100644 --- a/lodash.at/index.js +++ b/lodash.at/index.js @@ -1,22 +1,30 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseFlatten = require('lodash._baseflatten'), rest = require('lodash.rest'), - toString = require('lodash.tostring'); + stringToPath = require('lodash._stringtopath'); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; + reIsPlainProp = /^\w*$/; -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; /** * The base implementation of `_.at` without support for individual paths. @@ -58,7 +66,7 @@ function baseCastPath(value) { * @returns {*} Returns the resolved value. */ function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseCastPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = 0, length = path.length; @@ -78,38 +86,26 @@ function baseGet(object, path) { * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { - if (typeof value == 'number') { + var type = typeof value; + if (type == 'number' || type == 'symbol') { return true; } return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ + * @since 0.1.0 * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -126,11 +122,63 @@ function stringToPath(string) { */ var isArray = Array.isArray; +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + /** * Creates an array of values corresponding to `paths` of `object`. * * @static * @memberOf _ + * @since 1.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {...(string|string[])} [paths] The property paths of elements to pick, @@ -156,10 +204,11 @@ var at = rest(function(object, paths) { * * @static * @memberOf _ + * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * diff --git a/lodash.at/package.json b/lodash.at/package.json index eef1d1572..3997bb0ee 100644 --- a/lodash.at/package.json +++ b/lodash.at/package.json @@ -1,6 +1,6 @@ { "name": "lodash.at", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.at` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseflatten": "~4.1.0", - "lodash.rest": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._stringtopath": "~4.7.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.attempt/LICENSE b/lodash.attempt/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.attempt/LICENSE +++ b/lodash.attempt/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.attempt/README.md b/lodash.attempt/README.md index 1d7171799..0fae50073 100644 --- a/lodash.attempt/README.md +++ b/lodash.attempt/README.md @@ -1,4 +1,4 @@ -# lodash.attempt v4.1.1 +# lodash.attempt v4.2.0 The [lodash](https://lodash.com/) method `_.attempt` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var attempt = require('lodash.attempt'); ``` -See the [documentation](https://lodash.com/docs#attempt) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.attempt) for more details. +See the [documentation](https://lodash.com/docs#attempt) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.attempt) for more details. diff --git a/lodash.attempt/index.js b/lodash.attempt/index.js index 5c7257a41..8a51074e6 100644 --- a/lodash.attempt/index.js +++ b/lodash.attempt/index.js @@ -1,12 +1,11 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var rest = require('lodash.rest'); /** `Object#toString` result references. */ var errorTag = '[object Error]'; @@ -22,8 +21,7 @@ var errorTag = '[object Error]'; * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { - var length = args.length; - switch (length) { + switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); @@ -37,11 +35,43 @@ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + /** * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, * `SyntaxError`, `TypeError`, or `URIError` object. @@ -51,8 +81,7 @@ var objectToString = objectProto.toString; * @since 3.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, - * else `false`. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. * @example * * _.isError(new Error); @@ -119,7 +148,7 @@ function isObjectLike(value) { * elements = []; * } */ -var attempt = rest(function(func, args) { +var attempt = baseRest(function(func, args) { try { return apply(func, undefined, args); } catch (e) { diff --git a/lodash.attempt/package.json b/lodash.attempt/package.json index 65002fd3e..715dc0412 100644 --- a/lodash.attempt/package.json +++ b/lodash.attempt/package.json @@ -1,6 +1,6 @@ { "name": "lodash.attempt", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.attempt` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,9 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.rest": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.bind/README.md b/lodash.bind/README.md index a0582531d..6e597314e 100644 --- a/lodash.bind/README.md +++ b/lodash.bind/README.md @@ -1,4 +1,4 @@ -# lodash.bind v4.1.4 +# lodash.bind v4.2.0 The [lodash](https://lodash.com/) method `_.bind` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var bind = require('lodash.bind'); ``` -See the [documentation](https://lodash.com/docs#bind) or [package source](https://github.com/lodash/lodash/blob/4.1.4-npm-packages/lodash.bind) for more details. +See the [documentation](https://lodash.com/docs#bind) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.bind) for more details. diff --git a/lodash.bind/index.js b/lodash.bind/index.js index b2b4fcdd7..cce303885 100644 --- a/lodash.bind/index.js +++ b/lodash.bind/index.js @@ -6,15 +6,253 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var createWrapper = require('lodash._createwrapper'), - rest = require('lodash.rest'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; -/** Used to compose bitmasks for wrapper metadata. */ +/** Used to compose bitmasks for function metadata. */ var BIND_FLAG = 1, - PARTIAL_FLAG = 32; + BIND_KEY_FLAG = 2, + CURRY_BOUND_FLAG = 4, + CURRY_FLAG = 8, + CURRY_RIGHT_FLAG = 16, + PARTIAL_FLAG = 32, + PARTIAL_RIGHT_FLAG = 64, + ARY_FLAG = 128, + REARG_FLAG = 256, + FLIP_FLAG = 512; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + +/** Used to associate wrap methods with their bit flags. */ +var wrapFlags = [ + ['ary', ARY_FLAG], + ['bind', BIND_FLAG], + ['bindKey', BIND_KEY_FLAG], + ['curry', CURRY_FLAG], + ['curryRight', CURRY_RIGHT_FLAG], + ['flip', FLIP_FLAG], + ['partial', PARTIAL_FLAG], + ['partialRight', PARTIAL_RIGHT_FLAG], + ['rearg', REARG_FLAG] +]; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to match wrap detail comments. */ +var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to search. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ +function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + result++; + } + } + return result; +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} /** * Replaces all `placeholder` elements in `array` with an internal placeholder @@ -41,6 +279,511 @@ function replaceHolders(array, placeholder) { return result; } +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var objectCreate = Object.create; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/* Used to set `toString` methods. */ +var defineProperty = (function() { + var func = getNative(Object, 'defineProperty'), + name = getNative.name; + + return (name && name.length > 2) ? func : undefined; +}()); + +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + +/** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; +} + +/** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; +} + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +/** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createBind(func, bitmask, thisArg) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; +} + +/** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ +function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; +} + +/** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & ARY_FLAG, + isBind = bitmask & BIND_FLAG, + isBindKey = bitmask & BIND_KEY_FLAG, + isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG), + isFlip = bitmask & FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ +function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); + + if (!(bitmask & CURRY_BOUND_FLAG)) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + + var result = wrapFunc(func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity); + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); +} + +/** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * The bitmask may be composed of the following flags: + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] == null + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { + bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + return setWrapToString(result, func, bitmask); +} + /** * Gets the argument placeholder value for `func`. * @@ -53,6 +796,152 @@ function getHolder(func) { return object.placeholder; } +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ +function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; +} + +/** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ +function insertWrapDetails(source, details) { + var length = details.length, + lastIndex = length - 1; + + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ +function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; +} + +/** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ +var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { + var source = (reference + ''); + return defineProperty(wrapper, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) + }); +}; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ +function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); +} + /** * Creates a function that invokes `func` with the `this` binding of `thisArg` * and `partials` prepended to the arguments it receives. @@ -60,7 +949,7 @@ function getHolder(func) { * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * - * **Note:** Unlike native `Function#bind` this method doesn't set the "length" + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" * property of bound functions. * * @static @@ -73,9 +962,9 @@ function getHolder(func) { * @returns {Function} Returns the new bound function. * @example * - * var greet = function(greeting, punctuation) { + * function greet(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; - * }; + * } * * var object = { 'user': 'fred' }; * @@ -88,15 +977,277 @@ function getHolder(func) { * bound('hi'); * // => 'hi fred!' */ -var bind = rest(function(func, thisArg, partials) { +var bind = baseRest(function(func, thisArg, partials) { var bitmask = BIND_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bind)); bitmask |= PARTIAL_FLAG; } - return createWrapper(func, bitmask, thisArg, partials, holders); + return createWrap(func, bitmask, thisArg, partials, holders); }); +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; +} + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + // Assign default placeholders. bind.placeholder = {}; diff --git a/lodash.bind/package.json b/lodash.bind/package.json index 0877d149b..67a6ea112 100644 --- a/lodash.bind/package.json +++ b/lodash.bind/package.json @@ -1,6 +1,6 @@ { "name": "lodash.bind", - "version": "4.1.4", + "version": "4.2.0", "description": "The lodash method `_.bind` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._createwrapper": "~4.0.0", - "lodash.rest": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.bindall/LICENSE b/lodash.bindall/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.bindall/LICENSE +++ b/lodash.bindall/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.bindall/README.md b/lodash.bindall/README.md index 8e64a3076..3d51925ed 100644 --- a/lodash.bindall/README.md +++ b/lodash.bindall/README.md @@ -1,4 +1,4 @@ -# lodash.bindall v4.1.1 +# lodash.bindall v4.2.0 The [lodash](https://lodash.com/) method `_.bindAll` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var bindAll = require('lodash.bindall'); ``` -See the [documentation](https://lodash.com/docs#bindAll) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.bindall) for more details. +See the [documentation](https://lodash.com/docs#bindAll) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.bindall) for more details. diff --git a/lodash.bindall/index.js b/lodash.bindall/index.js index 82ffda594..fa3ac51da 100644 --- a/lodash.bindall/index.js +++ b/lodash.bindall/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseFlatten = require('lodash._baseflatten'), bind = require('lodash.bind'), @@ -42,8 +42,7 @@ function arrayEach(array, iteratee) { * @memberOf _ * @category Util * @param {Object} object The object to bind and assign the bound methods to. - * @param {...(string|string[])} methodNames The object method names to bind, - * specified individually or in arrays. + * @param {...(string|string[])} methodNames The object method names to bind. * @returns {Object} Returns `object`. * @example * diff --git a/lodash.bindall/package.json b/lodash.bindall/package.json index 8f9e12b0a..fcdca1e8e 100644 --- a/lodash.bindall/package.json +++ b/lodash.bindall/package.json @@ -1,6 +1,6 @@ { "name": "lodash.bindall", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.bindAll` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseflatten": "~4.1.0", + "lodash._baseflatten": "~4.2.0", "lodash.bind": "^4.0.0", "lodash.rest": "^4.0.0" } diff --git a/lodash.bindkey/README.md b/lodash.bindkey/README.md index 23630fdb4..bd10048bd 100644 --- a/lodash.bindkey/README.md +++ b/lodash.bindkey/README.md @@ -1,4 +1,4 @@ -# lodash.bindkey v4.1.4 +# lodash.bindkey v4.2.0 The [lodash](https://lodash.com/) method `_.bindKey` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var bindKey = require('lodash.bindkey'); ``` -See the [documentation](https://lodash.com/docs#bindKey) or [package source](https://github.com/lodash/lodash/blob/4.1.4-npm-packages/lodash.bindkey) for more details. +See the [documentation](https://lodash.com/docs#bindKey) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.bindkey) for more details. diff --git a/lodash.bindkey/index.js b/lodash.bindkey/index.js index 60b6a569f..0bed7c1b4 100644 --- a/lodash.bindkey/index.js +++ b/lodash.bindkey/index.js @@ -6,16 +6,253 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var createWrapper = require('lodash._createwrapper'), - rest = require('lodash.rest'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; -/** Used to compose bitmasks for wrapper metadata. */ +/** Used to compose bitmasks for function metadata. */ var BIND_FLAG = 1, BIND_KEY_FLAG = 2, - PARTIAL_FLAG = 32; + CURRY_BOUND_FLAG = 4, + CURRY_FLAG = 8, + CURRY_RIGHT_FLAG = 16, + PARTIAL_FLAG = 32, + PARTIAL_RIGHT_FLAG = 64, + ARY_FLAG = 128, + REARG_FLAG = 256, + FLIP_FLAG = 512; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + +/** Used to associate wrap methods with their bit flags. */ +var wrapFlags = [ + ['ary', ARY_FLAG], + ['bind', BIND_FLAG], + ['bindKey', BIND_KEY_FLAG], + ['curry', CURRY_FLAG], + ['curryRight', CURRY_RIGHT_FLAG], + ['flip', FLIP_FLAG], + ['partial', PARTIAL_FLAG], + ['partialRight', PARTIAL_RIGHT_FLAG], + ['rearg', REARG_FLAG] +]; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to match wrap detail comments. */ +var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to search. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ +function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + result++; + } + } + return result; +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} /** * Replaces all `placeholder` elements in `array` with an internal placeholder @@ -42,6 +279,511 @@ function replaceHolders(array, placeholder) { return result; } +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var objectCreate = Object.create; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/* Used to set `toString` methods. */ +var defineProperty = (function() { + var func = getNative(Object, 'defineProperty'), + name = getNative.name; + + return (name && name.length > 2) ? func : undefined; +}()); + +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + +/** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; +} + +/** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; +} + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +/** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createBind(func, bitmask, thisArg) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; +} + +/** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ +function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; +} + +/** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & ARY_FLAG, + isBind = bitmask & BIND_FLAG, + isBindKey = bitmask & BIND_KEY_FLAG, + isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG), + isFlip = bitmask & FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ +function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); + + if (!(bitmask & CURRY_BOUND_FLAG)) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + + var result = wrapFunc(func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity); + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); +} + +/** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * The bitmask may be composed of the following flags: + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] == null + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { + bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + return setWrapToString(result, func, bitmask); +} + /** * Gets the argument placeholder value for `func`. * @@ -54,6 +796,152 @@ function getHolder(func) { return object.placeholder; } +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ +function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; +} + +/** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ +function insertWrapDetails(source, details) { + var length = details.length, + lastIndex = length - 1; + + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ +function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; +} + +/** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ +var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { + var source = (reference + ''); + return defineProperty(wrapper, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) + }); +}; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ +function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); +} + /** * Creates a function that invokes the method at `object[key]` with `partials` * prepended to the arguments it receives. @@ -99,15 +987,277 @@ function getHolder(func) { * bound('hi'); * // => 'hiya fred!' */ -var bindKey = rest(function(object, key, partials) { +var bindKey = baseRest(function(object, key, partials) { var bitmask = BIND_FLAG | BIND_KEY_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bindKey)); bitmask |= PARTIAL_FLAG; } - return createWrapper(key, bitmask, object, partials, holders); + return createWrap(key, bitmask, object, partials, holders); }); +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; +} + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + // Assign default placeholders. bindKey.placeholder = {}; diff --git a/lodash.bindkey/package.json b/lodash.bindkey/package.json index ab70415f6..b2722daca 100644 --- a/lodash.bindkey/package.json +++ b/lodash.bindkey/package.json @@ -1,6 +1,6 @@ { "name": "lodash.bindkey", - "version": "4.1.4", + "version": "4.2.0", "description": "The lodash method `_.bindKey` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._createwrapper": "~4.0.0", - "lodash.rest": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.camelcase/README.md b/lodash.camelcase/README.md index 36f8d98ca..4213460cd 100644 --- a/lodash.camelcase/README.md +++ b/lodash.camelcase/README.md @@ -1,4 +1,4 @@ -# lodash.camelcase v4.1.1 +# lodash.camelcase v4.2.0 The [lodash](https://lodash.com/) method `_.camelCase` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var camelCase = require('lodash.camelcase'); ``` -See the [documentation](https://lodash.com/docs#camelCase) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.camelcase) for more details. +See the [documentation](https://lodash.com/docs#camelCase) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.camelcase) for more details. diff --git a/lodash.camelcase/index.js b/lodash.camelcase/index.js index 025d6533e..20e9c9686 100644 --- a/lodash.camelcase/index.js +++ b/lodash.camelcase/index.js @@ -1,27 +1,131 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var capitalize = require('lodash.capitalize'), - deburr = require('lodash.deburr'), - words = require('lodash.words'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Used to match non-compound words composed of alphanumeric characters. */ +var reBasicWord = /[a-zA-Z0-9]+/g; + +/** Used to match latin-1 supplementary letters (excluding mathematical operators). */ +var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', + rsComboSymbolsRange = '\\u20d0-\\u20f0', + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; /** Used to compose unicode capture groups. */ -var rsApos = "['\u2019]"; +var rsApos = "['\u2019]", + rsAstral = '[' + rsAstralRange + ']', + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', + rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match apostrophes. */ var reApos = RegExp(rsApos, 'g'); +/** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ +var reComboMark = RegExp(rsCombo, 'g'); + +/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ +var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** Used to match complex or compound words. */ +var reComplexWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', + rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, + rsUpper + '+' + rsOptUpperContr, + rsDigits, + rsEmoji +].join('|'), 'g'); + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); + +/** Used to detect strings that need a more robust regexp to match words. */ +var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + +/** Used to map latin-1 supplementary letters to basic latin letters. */ +var deburredLetters = { + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss' +}; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as @@ -30,7 +134,7 @@ var reApos = RegExp(rsApos, 'g'); */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, - length = array.length; + length = array ? array.length : 0; if (initAccum && length) { accumulator = array[++index]; @@ -41,6 +145,148 @@ function arrayReduce(array, iteratee, accumulator, initAccum) { return accumulator; } +/** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ +var deburrLetter = basePropertyOf(deburredLetters); + +/** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function stringToArray(string) { + return string.match(reComplexSymbol); +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} + +/** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ +function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = reHasComplexSymbol.test(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; +} + /** * Creates a function like `_.camelCase`. * @@ -54,6 +300,81 @@ function createCompounder(callback) { }; } +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + /** * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). * @@ -79,4 +400,93 @@ var camelCase = createCompounder(function(result, word, index) { return result + (index ? capitalize(word) : word); }); +/** + * Converts the first character of `string` to upper case and the remaining + * to lower case. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('FRED'); + * // => 'Fred' + */ +function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); +} + +/** + * Deburrs `string` by converting + * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * to basic latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ +function deburr(string) { + string = toString(string); + return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); +} + +/** + * Converts the first character of `string` to upper case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.upperFirst('fred'); + * // => 'Fred' + * + * _.upperFirst('FRED'); + * // => 'FRED' + */ +var upperFirst = createCaseFirst('toUpperCase'); + +/** + * Splits `string` into an array of its words. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {RegExp|string} [pattern] The pattern to match words. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the words of `string`. + * @example + * + * _.words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + * _.words('fred, barney, & pebbles', /[^, ]+/g); + * // => ['fred', 'barney', '&', 'pebbles'] + */ +function words(string, pattern, guard) { + string = toString(string); + pattern = guard ? undefined : pattern; + + if (pattern === undefined) { + pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord; + } + return string.match(pattern) || []; +} + module.exports = camelCase; diff --git a/lodash.camelcase/package.json b/lodash.camelcase/package.json index be5174b28..16aacd1ec 100644 --- a/lodash.camelcase/package.json +++ b/lodash.camelcase/package.json @@ -1,6 +1,6 @@ { "name": "lodash.camelcase", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.camelCase` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,10 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.capitalize": "^4.0.0", - "lodash.deburr": "^4.0.0", - "lodash.words": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.capitalize/LICENSE b/lodash.capitalize/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.capitalize/LICENSE +++ b/lodash.capitalize/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.capitalize/README.md b/lodash.capitalize/README.md index b0f23181d..49526d0a4 100644 --- a/lodash.capitalize/README.md +++ b/lodash.capitalize/README.md @@ -1,4 +1,4 @@ -# lodash.capitalize v4.1.1 +# lodash.capitalize v4.2.0 The [lodash](https://lodash.com/) method `_.capitalize` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var capitalize = require('lodash.capitalize'); ``` -See the [documentation](https://lodash.com/docs#capitalize) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.capitalize) for more details. +See the [documentation](https://lodash.com/docs#capitalize) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.capitalize) for more details. diff --git a/lodash.capitalize/index.js b/lodash.capitalize/index.js index 65b43626a..d8f73438a 100644 --- a/lodash.capitalize/index.js +++ b/lodash.capitalize/index.js @@ -1,13 +1,250 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var toString = require('lodash.tostring'), - upperFirst = require('lodash.upperfirst'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', + rsComboSymbolsRange = '\\u20d0-\\u20f0', + rsVarRange = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsAstral = '[' + rsAstralRange + ']', + rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + +/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ +var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function stringToArray(string) { + return string.match(reComplexSymbol); +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} + +/** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ +function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = reHasComplexSymbol.test(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} /** * Converts the first character of `string` to upper case and the remaining @@ -28,4 +265,23 @@ function capitalize(string) { return upperFirst(toString(string).toLowerCase()); } +/** + * Converts the first character of `string` to upper case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.upperFirst('fred'); + * // => 'Fred' + * + * _.upperFirst('FRED'); + * // => 'FRED' + */ +var upperFirst = createCaseFirst('toUpperCase'); + module.exports = capitalize; diff --git a/lodash.capitalize/package.json b/lodash.capitalize/package.json index f03e88ff7..cd5faac3e 100644 --- a/lodash.capitalize/package.json +++ b/lodash.capitalize/package.json @@ -1,6 +1,6 @@ { "name": "lodash.capitalize", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.capitalize` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,13 +9,9 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.tostring": "^4.0.0", - "lodash.upperfirst": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.chunk/README.md b/lodash.chunk/README.md index 19888fdcb..fd4daca7c 100644 --- a/lodash.chunk/README.md +++ b/lodash.chunk/README.md @@ -1,4 +1,4 @@ -# lodash.chunk v4.1.0 +# lodash.chunk v4.2.0 The [lodash](https://lodash.com/) method `_.chunk` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var chunk = require('lodash.chunk'); ``` -See the [documentation](https://lodash.com/docs#chunk) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.chunk) for more details. +See the [documentation](https://lodash.com/docs#chunk) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.chunk) for more details. diff --git a/lodash.chunk/index.js b/lodash.chunk/index.js index 197d37f02..7e7e9679e 100644 --- a/lodash.chunk/index.js +++ b/lodash.chunk/index.js @@ -36,25 +36,12 @@ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -93,19 +80,6 @@ function baseSlice(array, start, end) { return result; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Checks if `value` is a valid array-like index. * @@ -188,7 +162,7 @@ function chunk(array, size, guard) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -248,7 +222,7 @@ function eq(value, other) { * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -270,8 +244,7 @@ function isArrayLike(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -279,16 +252,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -310,7 +282,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -427,7 +399,7 @@ function toFinite(value) { * Converts `value` to an integer. * * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ @@ -487,7 +459,7 @@ function toNumber(value) { return NAN; } if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { diff --git a/lodash.chunk/package.json b/lodash.chunk/package.json index a47ed6d2c..71cd2eb2e 100644 --- a/lodash.chunk/package.json +++ b/lodash.chunk/package.json @@ -1,6 +1,6 @@ { "name": "lodash.chunk", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.chunk` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.clone/README.md b/lodash.clone/README.md index 956830177..7881768ba 100644 --- a/lodash.clone/README.md +++ b/lodash.clone/README.md @@ -1,4 +1,4 @@ -# lodash.clone v4.1.1 +# lodash.clone v4.2.0 The [lodash](https://lodash.com/) method `_.clone` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var clone = require('lodash.clone'); ``` -See the [documentation](https://lodash.com/docs#clone) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.clone) for more details. +See the [documentation](https://lodash.com/docs#clone) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.clone) for more details. diff --git a/lodash.clone/index.js b/lodash.clone/index.js index 8c78bf0af..bd8e5f71c 100644 --- a/lodash.clone/index.js +++ b/lodash.clone/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), isBuffer = require('lodash.isbuffer'), keys = require('lodash.keys'), @@ -92,6 +91,27 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -193,7 +213,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, - getOwnPropertySymbols = Object.getOwnPropertySymbols; + getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), @@ -315,17 +336,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -433,10 +446,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -489,8 +503,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -724,7 +741,7 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. diff --git a/lodash.clone/package.json b/lodash.clone/package.json index 225bd0a34..bc426a7c4 100644 --- a/lodash.clone/package.json +++ b/lodash.clone/package.json @@ -1,6 +1,6 @@ { "name": "lodash.clone", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.clone` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", diff --git a/lodash.clonedeep/README.md b/lodash.clonedeep/README.md index b7484efd2..2f7dd99f5 100644 --- a/lodash.clonedeep/README.md +++ b/lodash.clonedeep/README.md @@ -1,4 +1,4 @@ -# lodash.clonedeep v4.1.1 +# lodash.clonedeep v4.2.0 The [lodash](https://lodash.com/) method `_.cloneDeep` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var cloneDeep = require('lodash.clonedeep'); ``` -See the [documentation](https://lodash.com/docs#cloneDeep) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.clonedeep) for more details. +See the [documentation](https://lodash.com/docs#cloneDeep) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.clonedeep) for more details. diff --git a/lodash.clonedeep/index.js b/lodash.clonedeep/index.js index 3547a6ae9..df5328093 100644 --- a/lodash.clonedeep/index.js +++ b/lodash.clonedeep/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), isBuffer = require('lodash.isbuffer'), keys = require('lodash.keys'), @@ -92,6 +91,27 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -193,7 +213,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, - getOwnPropertySymbols = Object.getOwnPropertySymbols; + getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), @@ -315,17 +336,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -433,10 +446,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -489,8 +503,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -716,7 +733,7 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. diff --git a/lodash.clonedeep/package.json b/lodash.clonedeep/package.json index 80b380107..557f97f98 100644 --- a/lodash.clonedeep/package.json +++ b/lodash.clonedeep/package.json @@ -1,6 +1,6 @@ { "name": "lodash.clonedeep", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.cloneDeep` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", diff --git a/lodash.clonedeepwith/README.md b/lodash.clonedeepwith/README.md index cfc4d4f12..e32cdb47d 100644 --- a/lodash.clonedeepwith/README.md +++ b/lodash.clonedeepwith/README.md @@ -1,4 +1,4 @@ -# lodash.clonedeepwith v4.1.1 +# lodash.clonedeepwith v4.2.0 The [lodash](https://lodash.com/) method `_.cloneDeepWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var cloneDeepWith = require('lodash.clonedeepwith'); ``` -See the [documentation](https://lodash.com/docs#cloneDeepWith) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.clonedeepwith) for more details. +See the [documentation](https://lodash.com/docs#cloneDeepWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.clonedeepwith) for more details. diff --git a/lodash.clonedeepwith/index.js b/lodash.clonedeepwith/index.js index 3dab8bd26..f2174f3a4 100644 --- a/lodash.clonedeepwith/index.js +++ b/lodash.clonedeepwith/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), isBuffer = require('lodash.isbuffer'), keys = require('lodash.keys'), @@ -92,6 +91,27 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -193,7 +213,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, - getOwnPropertySymbols = Object.getOwnPropertySymbols; + getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), @@ -315,17 +336,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -433,10 +446,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -489,8 +503,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -726,7 +743,7 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. diff --git a/lodash.clonedeepwith/package.json b/lodash.clonedeepwith/package.json index 6fb66c460..3657bdedf 100644 --- a/lodash.clonedeepwith/package.json +++ b/lodash.clonedeepwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.clonedeepwith", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.cloneDeepWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", diff --git a/lodash.clonewith/README.md b/lodash.clonewith/README.md index 9f730ad60..bb3d9e971 100644 --- a/lodash.clonewith/README.md +++ b/lodash.clonewith/README.md @@ -1,4 +1,4 @@ -# lodash.clonewith v4.1.1 +# lodash.clonewith v4.2.0 The [lodash](https://lodash.com/) method `_.cloneWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var cloneWith = require('lodash.clonewith'); ``` -See the [documentation](https://lodash.com/docs#cloneWith) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.clonewith) for more details. +See the [documentation](https://lodash.com/docs#cloneWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.clonewith) for more details. diff --git a/lodash.clonewith/index.js b/lodash.clonewith/index.js index eb918287f..19c9491f9 100644 --- a/lodash.clonewith/index.js +++ b/lodash.clonewith/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), isBuffer = require('lodash.isbuffer'), keys = require('lodash.keys'), @@ -92,6 +91,27 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -193,7 +213,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, - getOwnPropertySymbols = Object.getOwnPropertySymbols; + getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), @@ -315,17 +336,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -433,10 +446,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -489,8 +503,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -729,7 +746,7 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. diff --git a/lodash.clonewith/package.json b/lodash.clonewith/package.json index 2a51c1d5e..3d781de57 100644 --- a/lodash.clonewith/package.json +++ b/lodash.clonewith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.clonewith", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.cloneWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", diff --git a/lodash.concat/LICENSE b/lodash.concat/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.concat/LICENSE +++ b/lodash.concat/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.concat/README.md b/lodash.concat/README.md index 8c1f19c49..341b9a39a 100644 --- a/lodash.concat/README.md +++ b/lodash.concat/README.md @@ -1,4 +1,4 @@ -# lodash.concat v4.1.1 +# lodash.concat v4.2.0 The [lodash](https://lodash.com/) method `_.concat` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var concat = require('lodash.concat'); ``` -See the [documentation](https://lodash.com/docs#concat) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.concat) for more details. +See the [documentation](https://lodash.com/docs#concat) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.concat) for more details. diff --git a/lodash.concat/index.js b/lodash.concat/index.js index f8a3f88e2..3eb667f79 100644 --- a/lodash.concat/index.js +++ b/lodash.concat/index.js @@ -1,13 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseFlatten = require('lodash._baseflatten'), - rest = require('lodash.rest'); +var baseFlatten = require('lodash._baseflatten'); /** * Creates a new array concatenating `array` with `other`. @@ -33,12 +32,32 @@ function arrayConcat(array, other) { return result; } +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + /** * Creates a new array concatenating `array` with any additional arrays * and/or values. * * @static * @memberOf _ + * @since 4.0.0 * @category Array * @param {Array} array The array to concatenate. * @param {...*} [values] The values to concatenate. @@ -54,23 +73,72 @@ function arrayConcat(array, other) { * console.log(array); * // => [1] */ -var concat = rest(function(array, values) { - if (!isArray(array)) { - array = array == null ? [] : [Object(array)]; +function concat() { + var length = arguments.length, + array = castArray(arguments[0]); + + if (length < 2) { + return length ? copyArray(array) : []; } - values = baseFlatten(values, 1); - return arrayConcat(array, values); -}); + var args = Array(length - 1); + while (length--) { + args[length - 1] = arguments[length]; + } + return arrayConcat(array, baseFlatten(args, 1)); +} + +/** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ +function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; +} /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ + * @since 0.1.0 * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); diff --git a/lodash.concat/package.json b/lodash.concat/package.json index 51eb840af..afe7736ad 100644 --- a/lodash.concat/package.json +++ b/lodash.concat/package.json @@ -1,6 +1,6 @@ { "name": "lodash.concat", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.concat` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseflatten": "~4.1.0", - "lodash.rest": "^4.0.0" + "lodash._baseflatten": "~4.1.0" } } diff --git a/lodash.cond/README.md b/lodash.cond/README.md index 5fcda3761..13e879569 100644 --- a/lodash.cond/README.md +++ b/lodash.cond/README.md @@ -1,4 +1,4 @@ -# lodash.cond v4.1.1 +# lodash.cond v4.2.0 The [lodash](https://lodash.com/) method `_.cond` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var cond = require('lodash.cond'); ``` -See the [documentation](https://lodash.com/docs#cond) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.cond) for more details. +See the [documentation](https://lodash.com/docs#cond) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.cond) for more details. diff --git a/lodash.cond/index.js b/lodash.cond/index.js index 86b3b92cb..d1df773f4 100644 --- a/lodash.cond/index.js +++ b/lodash.cond/index.js @@ -1,35 +1,17 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; +var baseIteratee = require('lodash._baseiteratee'), + rest = require('lodash.rest'); /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. @@ -52,243 +34,25 @@ function apply(func, thisArg, args) { } /** - * The base implementation of `_.get` without support for default values. + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. * * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); + while (++index < length) { + result[index] = iteratee(array[index], index, array); } return result; } -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - /** * Creates a function that iterates over `pairs` invoking the corresponding * function of the first predicate to return truthy. The predicate-function @@ -338,48 +102,4 @@ function cond(pairs) { }); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = cond; diff --git a/lodash.cond/package.json b/lodash.cond/package.json index ee871cdff..1001e464a 100644 --- a/lodash.cond/package.json +++ b/lodash.cond/package.json @@ -1,6 +1,6 @@ { "name": "lodash.cond", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.cond` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,13 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.conforms/README.md b/lodash.conforms/README.md index ba938ff6c..b63bda07f 100644 --- a/lodash.conforms/README.md +++ b/lodash.conforms/README.md @@ -1,4 +1,4 @@ -# lodash.conforms v4.1.1 +# lodash.conforms v4.2.0 The [lodash](https://lodash.com/) method `_.conforms` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var conforms = require('lodash.conforms'); ``` -See the [documentation](https://lodash.com/docs#conforms) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.conforms) for more details. +See the [documentation](https://lodash.com/docs#conforms) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.conforms) for more details. diff --git a/lodash.conforms/index.js b/lodash.conforms/index.js index 7b2b6c652..476664193 100644 --- a/lodash.conforms/index.js +++ b/lodash.conforms/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), isBuffer = require('lodash.isbuffer'), keys = require('lodash.keys'), @@ -92,6 +91,27 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -193,7 +213,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, - getOwnPropertySymbols = Object.getOwnPropertySymbols; + getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), @@ -344,17 +365,9 @@ function baseConforms(source) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -462,10 +475,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -518,8 +532,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -725,7 +742,7 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. diff --git a/lodash.conforms/package.json b/lodash.conforms/package.json index 4cbdbe644..d3ec2cc43 100644 --- a/lodash.conforms/package.json +++ b/lodash.conforms/package.json @@ -1,6 +1,6 @@ { "name": "lodash.conforms", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.conforms` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", diff --git a/lodash.countby/README.md b/lodash.countby/README.md index b4bf7d81c..fcd184551 100644 --- a/lodash.countby/README.md +++ b/lodash.countby/README.md @@ -1,4 +1,4 @@ -# lodash.countby v4.1.1 +# lodash.countby v4.2.0 The [lodash](https://lodash.com/) method `_.countBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var countBy = require('lodash.countby'); ``` -See the [documentation](https://lodash.com/docs#countBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.countby) for more details. +See the [documentation](https://lodash.com/docs#countBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.countby) for more details. diff --git a/lodash.countby/index.js b/lodash.countby/index.js index 2960d1308..2075928be 100644 --- a/lodash.countby/index.js +++ b/lodash.countby/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,24 +7,7 @@ * Available under MIT license */ var baseEach = require('lodash._baseeach'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'); /** * A specialized version of `baseAggregator` for arrays. @@ -71,130 +54,6 @@ function baseAggregator(collection, setter, iteratee, accumulator) { return accumulator; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Creates a function like `_.groupBy`. * @@ -212,67 +71,6 @@ function createAggregator(setter, initializer) { }; } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value @@ -302,7 +100,7 @@ var countBy = createAggregator(function(result, value, key) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -322,76 +120,4 @@ var countBy = createAggregator(function(result, value, key) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = countBy; diff --git a/lodash.countby/package.json b/lodash.countby/package.json index 0c06505bf..6c4ab24a5 100644 --- a/lodash.countby/package.json +++ b/lodash.countby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.countby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.countBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,11 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeach": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.create/README.md b/lodash.create/README.md index 086a78c7c..db421ebf7 100644 --- a/lodash.create/README.md +++ b/lodash.create/README.md @@ -1,4 +1,4 @@ -# lodash.create v4.1.0 +# lodash.create v4.2.0 The [lodash](https://lodash.com/) method `_.create` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var create = require('lodash.create'); ``` -See the [documentation](https://lodash.com/docs#create) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.create) for more details. +See the [documentation](https://lodash.com/docs#create) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.create) for more details. diff --git a/lodash.create/index.js b/lodash.create/index.js index 923aeebcb..f6830383c 100644 --- a/lodash.create/index.js +++ b/lodash.create/index.js @@ -13,25 +13,11 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + genTag = '[object GeneratorFunction]'; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -52,7 +38,7 @@ function baseTimes(n, iteratee) { } /** - * Creates a function that invokes `func` with its first argument transformed. + * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. @@ -73,7 +59,7 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -83,12 +69,38 @@ var objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetPrototype = Object.getPrototypeOf, - nativeKeys = Object.keys; +var nativeKeys = overArg(Object.keys, Object); + +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -130,31 +142,24 @@ function baseCreate(proto) { } /** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); -} - -/** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} /** * Copies properties of `source` to `object`. @@ -184,45 +189,6 @@ function copyObject(source, props, object, customizer) { return object; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Gets the `[[Prototype]]` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {null|Object} Returns the `[[Prototype]]`. - */ -var getPrototype = overArg(nativeGetPrototype, Object); - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -254,7 +220,7 @@ function isPrototype(value) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -307,7 +273,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -363,7 +329,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -414,8 +380,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -423,16 +388,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -454,7 +418,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -510,28 +474,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * Creates an object that inherits from the `prototype` object. If a * `properties` object is given, its own enumerable string keyed properties @@ -575,7 +517,7 @@ function create(prototype, properties) { * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -600,23 +542,7 @@ function create(prototype, properties) { * // => ['0', '1'] */ function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } module.exports = create; diff --git a/lodash.create/package.json b/lodash.create/package.json index 9be4f4222..e69224588 100644 --- a/lodash.create/package.json +++ b/lodash.create/package.json @@ -1,6 +1,6 @@ { "name": "lodash.create", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.create` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.defaults/README.md b/lodash.defaults/README.md index 9ea904dce..a129849e8 100644 --- a/lodash.defaults/README.md +++ b/lodash.defaults/README.md @@ -1,4 +1,4 @@ -# lodash.defaults v4.1.0 +# lodash.defaults v4.2.0 The [lodash](https://lodash.com/) method `_.defaults` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var defaults = require('lodash.defaults'); ``` -See the [documentation](https://lodash.com/docs#defaults) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.defaults) for more details. +See the [documentation](https://lodash.com/docs#defaults) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.defaults) for more details. diff --git a/lodash.defaults/index.js b/lodash.defaults/index.js index 65649927d..25eba9ce0 100644 --- a/lodash.defaults/index.js +++ b/lodash.defaults/index.js @@ -13,21 +13,11 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + genTag = '[object GeneratorFunction]'; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. @@ -48,19 +38,6 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -80,23 +57,6 @@ function baseTimes(n, iteratee) { return result; } -/** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ -function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -105,19 +65,44 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ -var Reflect = root.Reflect, - enumerate = Reflect ? Reflect.enumerate : undefined, - propertyIsEnumerable = objectProto.propertyIsEnumerable; +var propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + /** * Used by `_.defaults` to customize its `_.assignIn` use. * @@ -138,7 +123,7 @@ function assignInDefaults(objValue, srcValue, key, object) { /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -155,30 +140,27 @@ function assignValue(object, key, value) { } /** - * The base implementation of `_.keysIn` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { - object = object == null ? object : Object(object); + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; - var result = []; for (var key in object) { - result.push(key); + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } } return result; } -// Fallback for IE < 9 with es6-shim. -if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { - baseKeysIn = function(object) { - return iteratorToArray(enumerate(object)); - }; -} - /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * @@ -269,36 +251,6 @@ function createAssigner(assigner) { }); } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -352,9 +304,28 @@ function isPrototype(value) { return value === proto; } +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} + /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -407,7 +378,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -463,7 +434,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -514,8 +485,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -523,16 +493,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -554,7 +523,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -610,28 +579,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * This method is like `_.assignIn` except that it accepts `customizer` * which is invoked to produce the assigned values. If `customizer` returns @@ -715,23 +662,7 @@ var defaults = baseRest(function(args) { * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { - var index = -1, - isProto = isPrototype(object), - props = baseKeysIn(object), - propsLength = props.length, - indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - while (++index < propsLength) { - var key = props[index]; - if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } module.exports = defaults; diff --git a/lodash.defaults/package.json b/lodash.defaults/package.json index 16367ab2c..3c49784b4 100644 --- a/lodash.defaults/package.json +++ b/lodash.defaults/package.json @@ -1,6 +1,6 @@ { "name": "lodash.defaults", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.defaults` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.defaultsdeep/README.md b/lodash.defaultsdeep/README.md index 96eb8c6c8..c81518c5e 100644 --- a/lodash.defaultsdeep/README.md +++ b/lodash.defaultsdeep/README.md @@ -1,4 +1,4 @@ -# lodash.defaultsdeep v4.1.1 +# lodash.defaultsdeep v4.2.0 The [lodash](https://lodash.com/) method `_.defaultsDeep` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var defaultsDeep = require('lodash.defaultsdeep'); ``` -See the [documentation](https://lodash.com/docs#defaultsDeep) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.defaultsdeep) for more details. +See the [documentation](https://lodash.com/docs#defaultsDeep) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.defaultsdeep) for more details. diff --git a/lodash.defaultsdeep/index.js b/lodash.defaultsdeep/index.js index 9bfecaeb6..04a9c051a 100644 --- a/lodash.defaultsdeep/index.js +++ b/lodash.defaultsdeep/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), isBuffer = require('lodash.isbuffer'), isPlainObject = require('lodash.isplainobject'), @@ -135,6 +134,27 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -237,6 +257,7 @@ var reIsNative = RegExp('^' + var Symbol = root.Symbol, Uint8Array = root.Uint8Array, getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references that are verified to be native. */ @@ -374,17 +395,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -412,7 +425,10 @@ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } - var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source); + var props = (isArray(source) || isTypedArray(source)) + ? undefined + : keysIn(source); + arrayEach(props || source, function(srcValue, key) { if (props) { key = srcValue; @@ -423,7 +439,10 @@ function baseMerge(object, source, srcIndex, customizer, stack) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { - var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; + var newValue = customizer + ? customizer(object[key], srcValue, (key + ''), object, source, stack) + : undefined; + if (newValue === undefined) { newValue = srcValue; } @@ -455,21 +474,24 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta assignMergeValue(object, key, stacked); return; } - var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined, - isCommon = newValue === undefined; + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; if (isCommon) { newValue = srcValue; if (isArray(srcValue) || isTypedArray(srcValue)) { if (isArray(objValue)) { - newValue = srcIndex ? copyArray(objValue) : objValue; + newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { @@ -478,10 +500,10 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta } else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } else { - newValue = srcIndex ? baseClone(objValue) : objValue; + newValue = objValue; } } else { @@ -604,10 +626,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -660,8 +683,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -921,7 +947,7 @@ function isArguments(value) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -948,7 +974,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -977,7 +1002,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -1048,7 +1072,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -1150,7 +1175,8 @@ function isNative(value) { * // => false */ function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } /** diff --git a/lodash.defaultsdeep/package.json b/lodash.defaultsdeep/package.json index a1b90761a..74e39d19e 100644 --- a/lodash.defaultsdeep/package.json +++ b/lodash.defaultsdeep/package.json @@ -1,6 +1,6 @@ { "name": "lodash.defaultsdeep", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.defaultsDeep` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", diff --git a/lodash.difference/LICENSE b/lodash.difference/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.difference/LICENSE +++ b/lodash.difference/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.difference/README.md b/lodash.difference/README.md index ea5551d13..7b934e94a 100644 --- a/lodash.difference/README.md +++ b/lodash.difference/README.md @@ -1,4 +1,4 @@ -# lodash.difference v4.1.2 +# lodash.difference v4.2.0 The [lodash](https://lodash.com/) method `_.difference` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var difference = require('lodash.difference'); ``` -See the [documentation](https://lodash.com/docs#difference) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.difference) for more details. +See the [documentation](https://lodash.com/docs#difference) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.difference) for more details. diff --git a/lodash.difference/index.js b/lodash.difference/index.js index 2847d12cd..652ffb08e 100644 --- a/lodash.difference/index.js +++ b/lodash.difference/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseDifference = require('lodash._basedifference'), baseFlatten = require('lodash._baseflatten'), @@ -21,7 +21,8 @@ var funcTag = '[object Function]', var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -72,7 +73,7 @@ var getLength = baseProperty('length'); */ var difference = rest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, true)) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []; }); @@ -193,8 +194,9 @@ function isLength(value) { } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ diff --git a/lodash.difference/package.json b/lodash.difference/package.json index 8b84edbfb..8fa65faf9 100644 --- a/lodash.difference/package.json +++ b/lodash.difference/package.json @@ -1,6 +1,6 @@ { "name": "lodash.difference", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.difference` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basedifference": "~4.4.0", - "lodash._baseflatten": "~4.1.0", + "lodash._baseflatten": "~4.2.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.differenceby/README.md b/lodash.differenceby/README.md index 5a1e957c2..0c898a02c 100644 --- a/lodash.differenceby/README.md +++ b/lodash.differenceby/README.md @@ -1,4 +1,4 @@ -# lodash.differenceby v4.1.1 +# lodash.differenceby v4.2.0 The [lodash](https://lodash.com/) method `_.differenceBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var differenceBy = require('lodash.differenceby'); ``` -See the [documentation](https://lodash.com/docs#differenceBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.differenceby) for more details. +See the [documentation](https://lodash.com/docs#differenceBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.differenceby) for more details. diff --git a/lodash.differenceby/index.js b/lodash.differenceby/index.js index 03ac15521..1f685c2da 100644 --- a/lodash.differenceby/index.js +++ b/lodash.differenceby/index.js @@ -1,31 +1,15 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - arrayMap = require('lodash._arraymap'), +var baseDifference = require('lodash._basedifference'), baseFlatten = require('lodash._baseflatten'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - cacheHas = require('lodash._cachehas'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; + baseIteratee = require('lodash._baseiteratee'), + rest = require('lodash.rest'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -34,27 +18,6 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.unary` without support for storing wrapper metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new function. - */ -function baseUnary(func) { - return function(value) { - return func(value); - }; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -64,147 +27,6 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; -/** - * The base implementation of methods like `_.difference` without support for - * excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ -function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; -} - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.property` without support for deep paths. * @@ -218,31 +40,6 @@ function baseProperty(key) { }; } -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -255,67 +52,6 @@ function baseToPath(value) { */ var getLength = baseProperty('length'); -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * This method is like `_.difference` except that it accepts `iteratee` which * is invoked for each element of `array` and `values` to generate the criterion @@ -343,7 +79,7 @@ var differenceBy = rest(function(array, values) { iteratee = undefined; } return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, false, true), baseIteratee(iteratee)) + ? baseDifference(array, baseFlatten(values, 1, true), baseIteratee(iteratee)) : []; }); @@ -365,31 +101,6 @@ function last(array) { return length ? array[length - 1] : undefined; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -397,7 +108,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -426,7 +136,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -497,7 +206,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -555,48 +265,4 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = differenceBy; diff --git a/lodash.differenceby/package.json b/lodash.differenceby/package.json index 378dd8d9e..1b20f6108 100644 --- a/lodash.differenceby/package.json +++ b/lodash.differenceby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.differenceby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.differenceBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,18 +15,9 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", - "lodash._arraymap": "^3.0.0", + "lodash._basedifference": "^4.0.0", "lodash._baseflatten": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._setcache": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.differencewith/LICENSE b/lodash.differencewith/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.differencewith/LICENSE +++ b/lodash.differencewith/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.differencewith/README.md b/lodash.differencewith/README.md index d4c50993a..96b0a88d8 100644 --- a/lodash.differencewith/README.md +++ b/lodash.differencewith/README.md @@ -1,4 +1,4 @@ -# lodash.differencewith v4.1.2 +# lodash.differencewith v4.2.0 The [lodash](https://lodash.com/) method `_.differenceWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var differenceWith = require('lodash.differencewith'); ``` -See the [documentation](https://lodash.com/docs#differenceWith) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.differencewith) for more details. +See the [documentation](https://lodash.com/docs#differenceWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.differencewith) for more details. diff --git a/lodash.differencewith/index.js b/lodash.differencewith/index.js index 62f008a4e..e5a4663a6 100644 --- a/lodash.differencewith/index.js +++ b/lodash.differencewith/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseDifference = require('lodash._basedifference'), baseFlatten = require('lodash._baseflatten'), @@ -21,7 +21,8 @@ var funcTag = '[object Function]', var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -79,7 +80,7 @@ var differenceWith = rest(function(array, values) { comparator = undefined; } return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, true), undefined, comparator) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) : []; }); @@ -219,8 +220,9 @@ function isLength(value) { } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ diff --git a/lodash.differencewith/package.json b/lodash.differencewith/package.json index 77328c7ac..f2afec1c6 100644 --- a/lodash.differencewith/package.json +++ b/lodash.differencewith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.differencewith", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.differenceWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basedifference": "~4.4.0", - "lodash._baseflatten": "~4.1.0", + "lodash._baseflatten": "~4.2.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.droprightwhile/README.md b/lodash.droprightwhile/README.md index 362d14f4e..f40eadbf4 100644 --- a/lodash.droprightwhile/README.md +++ b/lodash.droprightwhile/README.md @@ -1,4 +1,4 @@ -# lodash.droprightwhile v4.1.1 +# lodash.droprightwhile v4.2.0 The [lodash](https://lodash.com/) method `_.dropRightWhile` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var dropRightWhile = require('lodash.droprightwhile'); ``` -See the [documentation](https://lodash.com/docs#dropRightWhile) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.droprightwhile) for more details. +See the [documentation](https://lodash.com/docs#dropRightWhile) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.droprightwhile) for more details. diff --git a/lodash.droprightwhile/index.js b/lodash.droprightwhile/index.js index 4cd1bccdf..611ecd5a5 100644 --- a/lodash.droprightwhile/index.js +++ b/lodash.droprightwhile/index.js @@ -1,154 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} +var baseIteratee = require('lodash._baseiteratee'), + baseSlice = require('lodash._baseslice'); /** * The base implementation of methods like `_.dropWhile` and `_.takeWhile` @@ -173,67 +32,6 @@ function baseWhile(array, predicate, isDrop, fromRight) { : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates a slice of `array` excluding elements dropped from the end. * Elements are dropped until `predicate` returns falsey. The predicate is @@ -274,101 +72,4 @@ function dropRightWhile(array, predicate) { : []; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = dropRightWhile; diff --git a/lodash.droprightwhile/package.json b/lodash.droprightwhile/package.json index 0165b5493..f9e8fc406 100644 --- a/lodash.droprightwhile/package.json +++ b/lodash.droprightwhile/package.json @@ -1,6 +1,6 @@ { "name": "lodash.droprightwhile", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.dropRightWhile` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._baseslice": "^4.0.0" } } diff --git a/lodash.dropwhile/README.md b/lodash.dropwhile/README.md index 8bfdb58d5..353ba6f5a 100644 --- a/lodash.dropwhile/README.md +++ b/lodash.dropwhile/README.md @@ -1,4 +1,4 @@ -# lodash.dropwhile v4.1.1 +# lodash.dropwhile v4.2.0 The [lodash](https://lodash.com/) method `_.dropWhile` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var dropWhile = require('lodash.dropwhile'); ``` -See the [documentation](https://lodash.com/docs#dropWhile) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.dropwhile) for more details. +See the [documentation](https://lodash.com/docs#dropWhile) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.dropwhile) for more details. diff --git a/lodash.dropwhile/index.js b/lodash.dropwhile/index.js index 29ba95768..302f7d6ac 100644 --- a/lodash.dropwhile/index.js +++ b/lodash.dropwhile/index.js @@ -1,154 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} +var baseIteratee = require('lodash._baseiteratee'), + baseSlice = require('lodash._baseslice'); /** * The base implementation of methods like `_.dropWhile` and `_.takeWhile` @@ -173,67 +32,6 @@ function baseWhile(array, predicate, isDrop, fromRight) { : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates a slice of `array` excluding elements dropped from the beginning. * Elements are dropped until `predicate` returns falsey. The predicate is @@ -274,101 +72,4 @@ function dropWhile(array, predicate) { : []; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = dropWhile; diff --git a/lodash.dropwhile/package.json b/lodash.dropwhile/package.json index fe4d0c0c0..484afa518 100644 --- a/lodash.dropwhile/package.json +++ b/lodash.dropwhile/package.json @@ -1,6 +1,6 @@ { "name": "lodash.dropwhile", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.dropWhile` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._baseslice": "^4.0.0" } } diff --git a/lodash.endswith/README.md b/lodash.endswith/README.md index 30bd4159a..1c38faf14 100644 --- a/lodash.endswith/README.md +++ b/lodash.endswith/README.md @@ -1,4 +1,4 @@ -# lodash.endswith v4.1.0 +# lodash.endswith v4.2.0 The [lodash](https://lodash.com/) method `_.endsWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var endsWith = require('lodash.endswith'); ``` -See the [documentation](https://lodash.com/docs#endsWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.endswith) for more details. +See the [documentation](https://lodash.com/docs#endsWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.endswith) for more details. diff --git a/lodash.endswith/index.js b/lodash.endswith/index.js index 78a72dd6b..48e73493e 100644 --- a/lodash.endswith/index.js +++ b/lodash.endswith/index.js @@ -6,8 +6,6 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseToString = require('lodash._basetostring'), - toString = require('lodash.tostring'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, @@ -34,6 +32,15 @@ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -44,8 +51,15 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + /** - * The base implementation of `_.clamp` which doesn't coerce arguments to numbers. + * The base implementation of `_.clamp` which doesn't coerce arguments. * * @private * @param {number} number The number to clamp. @@ -65,6 +79,26 @@ function baseClamp(number, lower, upper) { return number; } +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + /** * Checks if `value` is classified as a `Function` object. * @@ -73,8 +107,7 @@ function baseClamp(number, lower, upper) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -157,8 +190,7 @@ function isObjectLike(value) { * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); @@ -210,7 +242,7 @@ function toFinite(value) { /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on + * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static @@ -284,6 +316,31 @@ function toNumber(value) { : (reIsBadHex.test(value) ? NAN : +value); } +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + /** * Checks if `string` ends with the given target string. * @@ -293,7 +350,7 @@ function toNumber(value) { * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search from. + * @param {number} [position=string.length] The position to search up to. * @returns {boolean} Returns `true` if `string` ends with `target`, * else `false`. * @example @@ -316,8 +373,9 @@ function endsWith(string, target, position) { ? length : baseClamp(toInteger(position), 0, length); + var end = position; position -= target.length; - return position >= 0 && string.indexOf(target, position) == position; + return position >= 0 && string.slice(position, end) == target; } module.exports = endsWith; diff --git a/lodash.endswith/package.json b/lodash.endswith/package.json index 8b3840743..a9612be63 100644 --- a/lodash.endswith/package.json +++ b/lodash.endswith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.endswith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.endsWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._basetostring": "~4.12.0", - "lodash.tostring": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.every/README.md b/lodash.every/README.md index c64494bed..f4cab1252 100644 --- a/lodash.every/README.md +++ b/lodash.every/README.md @@ -1,4 +1,4 @@ -# lodash.every v4.1.1 +# lodash.every v4.2.0 The [lodash](https://lodash.com/) method `_.every` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var every = require('lodash.every'); ``` -See the [documentation](https://lodash.com/docs#every) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.every) for more details. +See the [documentation](https://lodash.com/docs#every) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.every) for more details. diff --git a/lodash.every/index.js b/lodash.every/index.js index 0f875cae4..0d2d0fce3 100644 --- a/lodash.every/index.js +++ b/lodash.every/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,16 +7,7 @@ * Available under MIT license */ var baseEach = require('lodash._baseeach'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; + baseIteratee = require('lodash._baseiteratee'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -25,14 +16,6 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; @@ -97,92 +80,6 @@ function baseEvery(collection, predicate) { return result; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.property` without support for deep paths. * @@ -196,31 +93,6 @@ function baseProperty(key) { }; } -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -233,23 +105,6 @@ function baseToPath(value) { */ var getLength = baseProperty('length'); -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - /** * Checks if the given arguments are from an iteratee call. * @@ -272,50 +127,6 @@ function isIterateeCall(value, index, object) { return false; } -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Checks if `predicate` returns truthy for **all** elements of `collection`. * Iteration is stopped once `predicate` returns falsey. The predicate is @@ -397,7 +208,7 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -424,7 +235,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -496,7 +306,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -527,48 +338,4 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = every; diff --git a/lodash.every/package.json b/lodash.every/package.json index 93ee6b3da..c825ead9c 100644 --- a/lodash.every/package.json +++ b/lodash.every/package.json @@ -1,6 +1,6 @@ { "name": "lodash.every", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.every` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,11 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeach": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.filter/README.md b/lodash.filter/README.md index 59fd0322d..454beb56f 100644 --- a/lodash.filter/README.md +++ b/lodash.filter/README.md @@ -1,4 +1,4 @@ -# lodash.filter v4.1.1 +# lodash.filter v4.2.0 The [lodash](https://lodash.com/) method `_.filter` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var filter = require('lodash.filter'); ``` -See the [documentation](https://lodash.com/docs#filter) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.filter) for more details. +See the [documentation](https://lodash.com/docs#filter) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.filter) for more details. diff --git a/lodash.filter/index.js b/lodash.filter/index.js index 6effe02f2..8d8347094 100644 --- a/lodash.filter/index.js +++ b/lodash.filter/index.js @@ -1,214 +1,35 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayFilter = require('lodash._arrayfilter'), - baseFilter = require('lodash._basefilter'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +var baseFilter = require('lodash._basefilter'), + baseIteratee = require('lodash._baseiteratee'); /** - * The base implementation of `_.get` without support for default values. + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. * * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); +function arrayFilter(array, predicate) { + var index = -1, + length = array.length, + resIndex = -1, + result = []; - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[++resIndex] = value; + } } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); return result; } @@ -255,7 +76,7 @@ function filter(collection, predicate) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -275,76 +96,4 @@ function filter(collection, predicate) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = filter; diff --git a/lodash.filter/package.json b/lodash.filter/package.json index 25f65c213..201df9ca4 100644 --- a/lodash.filter/package.json +++ b/lodash.filter/package.json @@ -1,6 +1,6 @@ { "name": "lodash.filter", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.filter` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,13 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayfilter": "^3.0.0", "lodash._basefilter": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.find/README.md b/lodash.find/README.md index 677567731..87f3b0da9 100644 --- a/lodash.find/README.md +++ b/lodash.find/README.md @@ -1,4 +1,4 @@ -# lodash.find v4.1.1 +# lodash.find v4.2.0 The [lodash](https://lodash.com/) method `_.find` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var find = require('lodash.find'); ``` -See the [documentation](https://lodash.com/docs#find) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.find) for more details. +See the [documentation](https://lodash.com/docs#find) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.find) for more details. diff --git a/lodash.find/index.js b/lodash.find/index.js index 249459c80..c81970172 100644 --- a/lodash.find/index.js +++ b/lodash.find/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -9,209 +9,7 @@ var baseEach = require('lodash._baseeach'), baseFind = require('lodash._basefind'), baseFindIndex = require('lodash._basefindindex'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} + baseIteratee = require('lodash._baseiteratee'); /** * Iterates over elements of `collection`, returning the first element @@ -261,7 +59,7 @@ function find(collection, predicate) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -281,76 +79,4 @@ function find(collection, predicate) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = find; diff --git a/lodash.find/package.json b/lodash.find/package.json index 25c2c4956..1fb3e4b0d 100644 --- a/lodash.find/package.json +++ b/lodash.find/package.json @@ -1,6 +1,6 @@ { "name": "lodash.find", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.find` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,11 +18,6 @@ "lodash._baseeach": "^4.0.0", "lodash._basefind": "^3.0.0", "lodash._basefindindex": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.findindex/README.md b/lodash.findindex/README.md index 02a78758c..e36375e0a 100644 --- a/lodash.findindex/README.md +++ b/lodash.findindex/README.md @@ -1,4 +1,4 @@ -# lodash.findindex v4.1.1 +# lodash.findindex v4.2.0 The [lodash](https://lodash.com/) method `_.findIndex` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var findIndex = require('lodash.findindex'); ``` -See the [documentation](https://lodash.com/docs#findIndex) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.findindex) for more details. +See the [documentation](https://lodash.com/docs#findIndex) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.findindex) for more details. diff --git a/lodash.findindex/index.js b/lodash.findindex/index.js index b339abc19..22a693f50 100644 --- a/lodash.findindex/index.js +++ b/lodash.findindex/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,209 +7,7 @@ * Available under MIT license */ var baseFindIndex = require('lodash._basefindindex'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} + baseIteratee = require('lodash._baseiteratee'); /** * This method is like `_.find` except that it returns the index of the first @@ -250,101 +48,4 @@ function findIndex(array, predicate) { : -1; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = findIndex; diff --git a/lodash.findindex/package.json b/lodash.findindex/package.json index 624e8a3bf..3b57f2ff8 100644 --- a/lodash.findindex/package.json +++ b/lodash.findindex/package.json @@ -1,6 +1,6 @@ { "name": "lodash.findindex", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.findIndex` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,11 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefindindex": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.findkey/README.md b/lodash.findkey/README.md index 2230f25e1..13a5933c3 100644 --- a/lodash.findkey/README.md +++ b/lodash.findkey/README.md @@ -1,4 +1,4 @@ -# lodash.findkey v4.1.1 +# lodash.findkey v4.2.0 The [lodash](https://lodash.com/) method `_.findKey` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var findKey = require('lodash.findkey'); ``` -See the [documentation](https://lodash.com/docs#findKey) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.findkey) for more details. +See the [documentation](https://lodash.com/docs#findKey) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.findkey) for more details. diff --git a/lodash.findkey/index.js b/lodash.findkey/index.js index 4c6f07db0..2d00d49c5 100644 --- a/lodash.findkey/index.js +++ b/lodash.findkey/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -8,25 +8,8 @@ */ var baseFind = require('lodash._basefind'), baseFor = require('lodash._basefor'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - keys = require('lodash.keys'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'), + keys = require('lodash.keys'); /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -40,244 +23,6 @@ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - /** * This method is like `_.find` except that it returns the key of the first * element `predicate` returns truthy for instead of the element itself. @@ -315,48 +60,4 @@ function findKey(object, predicate) { return baseFind(object, baseIteratee(predicate, 3), baseForOwn, true); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = findKey; diff --git a/lodash.findkey/package.json b/lodash.findkey/package.json index d9fcb43ec..ecef9c9a1 100644 --- a/lodash.findkey/package.json +++ b/lodash.findkey/package.json @@ -1,6 +1,6 @@ { "name": "lodash.findkey", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.findKey` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -17,12 +17,7 @@ "dependencies": { "lodash._basefind": "^3.0.0", "lodash._basefor": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.keys": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.keys": "^4.0.0" } } diff --git a/lodash.findlast/README.md b/lodash.findlast/README.md index ac73a8795..5c3094e5b 100644 --- a/lodash.findlast/README.md +++ b/lodash.findlast/README.md @@ -1,4 +1,4 @@ -# lodash.findlast v4.1.1 +# lodash.findlast v4.2.0 The [lodash](https://lodash.com/) method `_.findLast` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var findLast = require('lodash.findlast'); ``` -See the [documentation](https://lodash.com/docs#findLast) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.findlast) for more details. +See the [documentation](https://lodash.com/docs#findLast) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.findlast) for more details. diff --git a/lodash.findlast/index.js b/lodash.findlast/index.js index db0dba1a6..89d4e29d7 100644 --- a/lodash.findlast/index.js +++ b/lodash.findlast/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -9,209 +9,7 @@ var baseEachRight = require('lodash._baseeachright'), baseFind = require('lodash._basefind'), baseFindIndex = require('lodash._basefindindex'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} + baseIteratee = require('lodash._baseiteratee'); /** * This method is like `_.find` except that it iterates over elements of @@ -244,7 +42,7 @@ function findLast(collection, predicate) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -264,76 +62,4 @@ function findLast(collection, predicate) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = findLast; diff --git a/lodash.findlast/package.json b/lodash.findlast/package.json index 1caca8f0c..b6e7aec91 100644 --- a/lodash.findlast/package.json +++ b/lodash.findlast/package.json @@ -1,6 +1,6 @@ { "name": "lodash.findlast", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.findLast` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,11 +18,6 @@ "lodash._baseeachright": "^4.0.0", "lodash._basefind": "^3.0.0", "lodash._basefindindex": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.findlastindex/README.md b/lodash.findlastindex/README.md index 926acebed..7baea6e41 100644 --- a/lodash.findlastindex/README.md +++ b/lodash.findlastindex/README.md @@ -1,4 +1,4 @@ -# lodash.findlastindex v4.1.1 +# lodash.findlastindex v4.2.0 The [lodash](https://lodash.com/) method `_.findLastIndex` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var findLastIndex = require('lodash.findlastindex'); ``` -See the [documentation](https://lodash.com/docs#findLastIndex) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.findlastindex) for more details. +See the [documentation](https://lodash.com/docs#findLastIndex) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.findlastindex) for more details. diff --git a/lodash.findlastindex/index.js b/lodash.findlastindex/index.js index ea2b56b73..e23c42b81 100644 --- a/lodash.findlastindex/index.js +++ b/lodash.findlastindex/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,209 +7,7 @@ * Available under MIT license */ var baseFindIndex = require('lodash._basefindindex'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} + baseIteratee = require('lodash._baseiteratee'); /** * This method is like `_.findIndex` except that it iterates over elements @@ -250,101 +48,4 @@ function findLastIndex(array, predicate) { : -1; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = findLastIndex; diff --git a/lodash.findlastindex/package.json b/lodash.findlastindex/package.json index 62dd18655..68bc5b5ce 100644 --- a/lodash.findlastindex/package.json +++ b/lodash.findlastindex/package.json @@ -1,6 +1,6 @@ { "name": "lodash.findlastindex", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.findLastIndex` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,11 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefindindex": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.findlastkey/README.md b/lodash.findlastkey/README.md index f2f44c2eb..b99990495 100644 --- a/lodash.findlastkey/README.md +++ b/lodash.findlastkey/README.md @@ -1,4 +1,4 @@ -# lodash.findlastkey v4.1.1 +# lodash.findlastkey v4.2.0 The [lodash](https://lodash.com/) method `_.findLastKey` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var findLastKey = require('lodash.findlastkey'); ``` -See the [documentation](https://lodash.com/docs#findLastKey) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.findlastkey) for more details. +See the [documentation](https://lodash.com/docs#findLastKey) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.findlastkey) for more details. diff --git a/lodash.findlastkey/index.js b/lodash.findlastkey/index.js index e66330904..b5490bd33 100644 --- a/lodash.findlastkey/index.js +++ b/lodash.findlastkey/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,25 +7,8 @@ * Available under MIT license */ var baseFind = require('lodash._basefind'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - keys = require('lodash.keys'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'), + keys = require('lodash.keys'); /** * This function is like `baseFor` except that it iterates over properties @@ -51,130 +34,6 @@ function baseForOwnRight(object, iteratee) { return object && baseForRight(object, iteratee, keys); } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Creates a base function for methods like `_.forIn`. * @@ -199,120 +58,6 @@ function createBaseFor(fromRight) { }; } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - /** * This method is like `_.findKey` except that it iterates over elements of * a collection in the opposite order. @@ -350,48 +95,4 @@ function findLastKey(object, predicate) { return baseFind(object, baseIteratee(predicate, 3), baseForOwnRight, true); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = findLastKey; diff --git a/lodash.findlastkey/package.json b/lodash.findlastkey/package.json index 6d4de7e6f..1809119cb 100644 --- a/lodash.findlastkey/package.json +++ b/lodash.findlastkey/package.json @@ -1,6 +1,6 @@ { "name": "lodash.findlastkey", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.findLastKey` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,12 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefind": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.keys": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.keys": "^4.0.0" } } diff --git a/lodash.flatmap/LICENSE b/lodash.flatmap/LICENSE index b054ca5a3..bcbe13d67 100644 --- a/lodash.flatmap/LICENSE +++ b/lodash.flatmap/LICENSE @@ -1,22 +1,23 @@ +The MIT License (MIT) + Copyright 2012-2016 The Dojo Foundation Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lodash.flatmap/README.md b/lodash.flatmap/README.md index f7634cbce..07b8614f3 100644 --- a/lodash.flatmap/README.md +++ b/lodash.flatmap/README.md @@ -1,4 +1,4 @@ -# lodash.flatmap v4.1.0 +# lodash.flatmap v4.2.0 The [lodash](https://lodash.com/) method `_.flatMap` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var flatMap = require('lodash.flatmap'); ``` -See the [documentation](https://lodash.com/docs#flatMap) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.flatmap) for more details. +See the [documentation](https://lodash.com/docs#flatMap) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.flatmap) for more details. diff --git a/lodash.flatmap/index.js b/lodash.flatmap/index.js index 6e4886451..3c0a46204 100644 --- a/lodash.flatmap/index.js +++ b/lodash.flatmap/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -30,7 +30,7 @@ var baseFlatten = require('lodash._baseflatten'), * // => [1, 1, 2, 2] */ function flatMap(collection, iteratee) { - return baseFlatten(map(collection, iteratee)); + return baseFlatten(map(collection, iteratee), 1); } module.exports = flatMap; diff --git a/lodash.flatmap/package.json b/lodash.flatmap/package.json index 77f1306eb..ccb0c125a 100644 --- a/lodash.flatmap/package.json +++ b/lodash.flatmap/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flatmap", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.flatMap` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.flatten/LICENSE b/lodash.flatten/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.flatten/LICENSE +++ b/lodash.flatten/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.flatten/README.md b/lodash.flatten/README.md index 2aff2cf66..67446d621 100644 --- a/lodash.flatten/README.md +++ b/lodash.flatten/README.md @@ -1,4 +1,4 @@ -# lodash.flatten v4.1.1 +# lodash.flatten v4.2.0 The [lodash](https://lodash.com/) method `_.flatten` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var flatten = require('lodash.flatten'); ``` -See the [documentation](https://lodash.com/docs#flatten) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.flatten) for more details. +See the [documentation](https://lodash.com/docs#flatten) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.flatten) for more details. diff --git a/lodash.flatten/index.js b/lodash.flatten/index.js index 5fc42a42d..dff01ac94 100644 --- a/lodash.flatten/index.js +++ b/lodash.flatten/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseFlatten = require('lodash._baseflatten'); diff --git a/lodash.flatten/package.json b/lodash.flatten/package.json index ccd3433a3..69cad164b 100644 --- a/lodash.flatten/package.json +++ b/lodash.flatten/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flatten", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.flatten` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseflatten": "~4.1.0" + "lodash._baseflatten": "~4.2.0" } } diff --git a/lodash.flattendeep/LICENSE b/lodash.flattendeep/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.flattendeep/LICENSE +++ b/lodash.flattendeep/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.flattendeep/README.md b/lodash.flattendeep/README.md index ce775c22d..f0e438998 100644 --- a/lodash.flattendeep/README.md +++ b/lodash.flattendeep/README.md @@ -1,4 +1,4 @@ -# lodash.flattendeep v4.1.1 +# lodash.flattendeep v4.2.0 The [lodash](https://lodash.com/) method `_.flattenDeep` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var flattenDeep = require('lodash.flattendeep'); ``` -See the [documentation](https://lodash.com/docs#flattenDeep) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.flattendeep) for more details. +See the [documentation](https://lodash.com/docs#flattenDeep) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.flattendeep) for more details. diff --git a/lodash.flattendeep/index.js b/lodash.flattendeep/index.js index 7624bfb45..1f506a7e3 100644 --- a/lodash.flattendeep/index.js +++ b/lodash.flattendeep/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseFlatten = require('lodash._baseflatten'); diff --git a/lodash.flattendeep/package.json b/lodash.flattendeep/package.json index 1a5094c19..a4347c7ff 100644 --- a/lodash.flattendeep/package.json +++ b/lodash.flattendeep/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flattendeep", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.flattenDeep` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseflatten": "~4.1.0" + "lodash._baseflatten": "~4.2.0" } } diff --git a/lodash.flip/LICENSE b/lodash.flip/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.flip/LICENSE +++ b/lodash.flip/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.flip/README.md b/lodash.flip/README.md index 6cf0dfa7f..b51b0ffc9 100644 --- a/lodash.flip/README.md +++ b/lodash.flip/README.md @@ -1,4 +1,4 @@ -# lodash.flip v4.1.1 +# lodash.flip v4.2.0 The [lodash](https://lodash.com/) method `_.flip` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var flip = require('lodash.flip'); ``` -See the [documentation](https://lodash.com/docs#flip) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.flip) for more details. +See the [documentation](https://lodash.com/docs#flip) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.flip) for more details. diff --git a/lodash.flip/index.js b/lodash.flip/index.js index 8a241bb6f..a83aaa71f 100644 --- a/lodash.flip/index.js +++ b/lodash.flip/index.js @@ -1,15 +1,917 @@ /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var createWrapper = require('lodash._createwrapper'); -/** Used to compose bitmasks for wrapper metadata. */ -var FLIP_FLAG = 512; +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** Used as the internal argument placeholder. */ +var PLACEHOLDER = '__lodash_placeholder__'; + +/** Used to compose bitmasks for function metadata. */ +var BIND_FLAG = 1, + BIND_KEY_FLAG = 2, + CURRY_BOUND_FLAG = 4, + CURRY_FLAG = 8, + CURRY_RIGHT_FLAG = 16, + PARTIAL_FLAG = 32, + PARTIAL_RIGHT_FLAG = 64, + ARY_FLAG = 128, + REARG_FLAG = 256, + FLIP_FLAG = 512; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + +/** Used to associate wrap methods with their bit flags. */ +var wrapFlags = [ + ['ary', ARY_FLAG], + ['bind', BIND_FLAG], + ['bindKey', BIND_KEY_FLAG], + ['curry', CURRY_FLAG], + ['curryRight', CURRY_RIGHT_FLAG], + ['flip', FLIP_FLAG], + ['partial', PARTIAL_FLAG], + ['partialRight', PARTIAL_RIGHT_FLAG], + ['rearg', REARG_FLAG] +]; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to match wrap detail comments. */ +var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to search. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ +function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + result++; + } + } + return result; +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} + +/** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ +function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + return result; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var objectCreate = Object.create; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/* Used to set `toString` methods. */ +var defineProperty = (function() { + var func = getNative(Object, 'defineProperty'), + name = getNative.name; + + return (name && name.length > 2) ? func : undefined; +}()); + +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; +} + +/** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; +} + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +/** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createBind(func, bitmask, thisArg) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; +} + +/** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ +function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; +} + +/** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & ARY_FLAG, + isBind = bitmask & BIND_FLAG, + isBindKey = bitmask & BIND_KEY_FLAG, + isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG), + isFlip = bitmask & FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ +function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); + + if (!(bitmask & CURRY_BOUND_FLAG)) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + + var result = wrapFunc(func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity); + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); +} + +/** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * The bitmask may be composed of the following flags: + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] == null + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { + bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + return setWrapToString(result, func, bitmask); +} + +/** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ +function getHolder(func) { + var object = func; + return object.placeholder; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ +function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; +} + +/** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ +function insertWrapDetails(source, details) { + var length = details.length, + lastIndex = length - 1; + + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ +function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; +} + +/** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ +var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { + var source = (reference + ''); + return defineProperty(wrapper, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) + }); +}; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ +function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); +} /** * Creates a function that invokes `func` with arguments reversed. @@ -30,7 +932,269 @@ var FLIP_FLAG = 512; * // => ['d', 'c', 'b', 'a'] */ function flip(func) { - return createWrapper(func, FLIP_FLAG); + return createWrap(func, FLIP_FLAG); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; +} + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; } module.exports = flip; diff --git a/lodash.flip/package.json b/lodash.flip/package.json index 8b1d2a30d..8632825c1 100644 --- a/lodash.flip/package.json +++ b/lodash.flip/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flip", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.flip` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,8 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._createwrapper": "~4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.foreach/LICENSE b/lodash.foreach/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.foreach/LICENSE +++ b/lodash.foreach/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.foreach/README.md b/lodash.foreach/README.md index 41b5a8f9b..dcda49d8e 100644 --- a/lodash.foreach/README.md +++ b/lodash.foreach/README.md @@ -1,4 +1,4 @@ -# lodash.foreach v4.1.1 +# lodash.foreach v4.2.0 The [lodash](https://lodash.com/) method `_.forEach` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var forEach = require('lodash.foreach'); ``` -See the [documentation](https://lodash.com/docs#forEach) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.foreach) for more details. +See the [documentation](https://lodash.com/docs#forEach) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.foreach) for more details. diff --git a/lodash.foreach/index.js b/lodash.foreach/index.js index 363c28e4f..a2e84738e 100644 --- a/lodash.foreach/index.js +++ b/lodash.foreach/index.js @@ -1,12 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseEach = require('lodash._baseeach'); +var baseEach = require('lodash._baseeach'), + baseIteratee = require('lodash._baseiteratee'); /** * A specialized version of `_.forEach` for arrays without support for @@ -30,27 +31,17 @@ function arrayEach(array, iteratee) { } /** - * Casts `value` to `identity` if it's not a function. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array} Returns the array-like object. - */ -function baseCastFunction(value) { - return typeof value == 'function' ? value : identity; -} - -/** - * Iterates over elements of `collection` invoking `iteratee` for each element. + * Iterates over elements of `collection` and invokes `iteratee` for each element. * The iteratee is invoked with three arguments: (value, index|key, collection). * Iteratee functions may exit iteration early by explicitly returning `false`. * - * **Note:** As with other "Collections" methods, objects with a "length" property - * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn` - * for object iteration. + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. * * @static * @memberOf _ + * @since 0.1.0 * @alias each * @category Collection * @param {Array|Object} collection The collection to iterate over. @@ -61,17 +52,17 @@ function baseCastFunction(value) { * _([1, 2]).forEach(function(value) { * console.log(value); * }); - * // => logs `1` then `2` + * // => Logs `1` then `2`. * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); - * // => logs 'a' then 'b' (iteration order is not guaranteed) + * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forEach(collection, iteratee) { return (typeof iteratee == 'function' && isArray(collection)) ? arrayEach(collection, iteratee) - : baseEach(collection, baseCastFunction(iteratee)); + : baseEach(collection, baseIteratee(iteratee)); } /** @@ -79,10 +70,12 @@ function forEach(collection, iteratee) { * * @static * @memberOf _ + * @since 0.1.0 * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -99,23 +92,4 @@ function forEach(collection, iteratee) { */ var isArray = Array.isArray; -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - module.exports = forEach; diff --git a/lodash.foreach/package.json b/lodash.foreach/package.json index 9239cfa6d..316b4df6e 100644 --- a/lodash.foreach/package.json +++ b/lodash.foreach/package.json @@ -1,6 +1,6 @@ { "name": "lodash.foreach", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.forEach` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseeach": "~4.1.0" + "lodash._baseeach": "~4.1.0", + "lodash._baseiteratee": "~4.6.0" } } diff --git a/lodash.foreachright/README.md b/lodash.foreachright/README.md index 54f670cad..63e513b07 100644 --- a/lodash.foreachright/README.md +++ b/lodash.foreachright/README.md @@ -1,4 +1,4 @@ -# lodash.foreachright v4.1.1 +# lodash.foreachright v4.2.0 The [lodash](https://lodash.com/) method `_.forEachRight` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var forEachRight = require('lodash.foreachright'); ``` -See the [documentation](https://lodash.com/docs#forEachRight) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.foreachright) for more details. +See the [documentation](https://lodash.com/docs#forEachRight) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.foreachright) for more details. diff --git a/lodash.foreachright/package.json b/lodash.foreachright/package.json index 3267c1618..ea3eaf076 100644 --- a/lodash.foreachright/package.json +++ b/lodash.foreachright/package.json @@ -1,6 +1,6 @@ { "name": "lodash.foreachright", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.forEachRight` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,6 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeachright": "~4.1.0", - "lodash._baseiteratee": "~4.6.0" + "lodash._baseiteratee": "~4.7.0" } } diff --git a/lodash.forin/README.md b/lodash.forin/README.md index 105638519..a1a14024e 100644 --- a/lodash.forin/README.md +++ b/lodash.forin/README.md @@ -1,4 +1,4 @@ -# lodash.forin v4.1.1 +# lodash.forin v4.2.0 The [lodash](https://lodash.com/) method `_.forIn` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var forIn = require('lodash.forin'); ``` -See the [documentation](https://lodash.com/docs#forIn) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.forin) for more details. +See the [documentation](https://lodash.com/docs#forIn) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.forin) for more details. diff --git a/lodash.forin/package.json b/lodash.forin/package.json index 85ce4b48d..6540bcf3c 100644 --- a/lodash.forin/package.json +++ b/lodash.forin/package.json @@ -1,6 +1,6 @@ { "name": "lodash.forin", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.forIn` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefor": "~3.0.0", - "lodash._baseiteratee": "~4.6.0", + "lodash._baseiteratee": "~4.7.0", "lodash.keysin": "^4.0.0" } } diff --git a/lodash.forinright/LICENSE b/lodash.forinright/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.forinright/LICENSE +++ b/lodash.forinright/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.forinright/README.md b/lodash.forinright/README.md index 70ee4029b..f3910e6c3 100644 --- a/lodash.forinright/README.md +++ b/lodash.forinright/README.md @@ -1,4 +1,4 @@ -# lodash.forinright v4.1.1 +# lodash.forinright v4.2.0 The [lodash](https://lodash.com/) method `_.forInRight` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var forInRight = require('lodash.forinright'); ``` -See the [documentation](https://lodash.com/docs#forInRight) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.forinright) for more details. +See the [documentation](https://lodash.com/docs#forInRight) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.forinright) for more details. diff --git a/lodash.forinright/index.js b/lodash.forinright/index.js index f28143f4d..f95475a8e 100644 --- a/lodash.forinright/index.js +++ b/lodash.forinright/index.js @@ -1,31 +1,22 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseForRight = require('lodash._baseforright'), + baseIteratee = require('lodash._baseiteratee'), keysIn = require('lodash.keysin'); -/** - * Casts `value` to `identity` if it's not a function. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array} Returns the array-like object. - */ -function baseCastFunction(value) { - return typeof value == 'function' ? value : identity; -} - /** * This method is like `_.forIn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ + * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -42,31 +33,12 @@ function baseCastFunction(value) { * _.forInRight(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c' + * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. */ function forInRight(object, iteratee) { return object == null ? object - : baseForRight(object, baseCastFunction(iteratee), keysIn); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; + : baseForRight(object, baseIteratee(iteratee), keysIn); } module.exports = forInRight; diff --git a/lodash.forinright/package.json b/lodash.forinright/package.json index ff396cb96..89592a0cb 100644 --- a/lodash.forinright/package.json +++ b/lodash.forinright/package.json @@ -1,6 +1,6 @@ { "name": "lodash.forinright", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.forInRight` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,6 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseforright": "~4.0.0", + "lodash._baseiteratee": "~4.6.0", "lodash.keysin": "^4.0.0" } } diff --git a/lodash.forown/README.md b/lodash.forown/README.md index 4e5aec800..85abf8117 100644 --- a/lodash.forown/README.md +++ b/lodash.forown/README.md @@ -1,4 +1,4 @@ -# lodash.forown v4.1.1 +# lodash.forown v4.2.0 The [lodash](https://lodash.com/) method `_.forOwn` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var forOwn = require('lodash.forown'); ``` -See the [documentation](https://lodash.com/docs#forOwn) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.forown) for more details. +See the [documentation](https://lodash.com/docs#forOwn) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.forown) for more details. diff --git a/lodash.forown/package.json b/lodash.forown/package.json index be4385860..be4c4e41b 100644 --- a/lodash.forown/package.json +++ b/lodash.forown/package.json @@ -1,6 +1,6 @@ { "name": "lodash.forown", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.forOwn` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefor": "~3.0.0", - "lodash._baseiteratee": "~4.6.0", + "lodash._baseiteratee": "~4.7.0", "lodash.keys": "^4.0.0" } } diff --git a/lodash.forownright/LICENSE b/lodash.forownright/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.forownright/LICENSE +++ b/lodash.forownright/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.forownright/README.md b/lodash.forownright/README.md index bf38fd6c1..2f7f3db95 100644 --- a/lodash.forownright/README.md +++ b/lodash.forownright/README.md @@ -1,4 +1,4 @@ -# lodash.forownright v4.1.1 +# lodash.forownright v4.2.0 The [lodash](https://lodash.com/) method `_.forOwnRight` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var forOwnRight = require('lodash.forownright'); ``` -See the [documentation](https://lodash.com/docs#forOwnRight) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.forownright) for more details. +See the [documentation](https://lodash.com/docs#forOwnRight) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.forownright) for more details. diff --git a/lodash.forownright/index.js b/lodash.forownright/index.js index ac492a61b..18183154e 100644 --- a/lodash.forownright/index.js +++ b/lodash.forownright/index.js @@ -1,25 +1,15 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseForRight = require('lodash._baseforright'), + baseIteratee = require('lodash._baseiteratee'), keys = require('lodash.keys'); -/** - * Casts `value` to `identity` if it's not a function. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array} Returns the array-like object. - */ -function baseCastFunction(value) { - return typeof value == 'function' ? value : identity; -} - /** * The base implementation of `_.forOwnRight` without support for iteratee shorthands. * @@ -38,6 +28,7 @@ function baseForOwnRight(object, iteratee) { * * @static * @memberOf _ + * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. @@ -54,29 +45,10 @@ function baseForOwnRight(object, iteratee) { * _.forOwnRight(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b' + * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. */ function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, baseCastFunction(iteratee)); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; + return object && baseForOwnRight(object, baseIteratee(iteratee)); } module.exports = forOwnRight; diff --git a/lodash.forownright/package.json b/lodash.forownright/package.json index f7987993f..a55bb7101 100644 --- a/lodash.forownright/package.json +++ b/lodash.forownright/package.json @@ -1,6 +1,6 @@ { "name": "lodash.forownright", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.forOwnRight` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,6 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseforright": "~4.0.0", + "lodash._baseiteratee": "~4.6.0", "lodash.keys": "^4.0.0" } } diff --git a/lodash.functions/LICENSE b/lodash.functions/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.functions/LICENSE +++ b/lodash.functions/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.functions/README.md b/lodash.functions/README.md index 3fa96ef4a..5a6c214d1 100644 --- a/lodash.functions/README.md +++ b/lodash.functions/README.md @@ -1,4 +1,4 @@ -# lodash.functions v4.1.1 +# lodash.functions v4.2.0 The [lodash](https://lodash.com/) method `_.functions` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var functions = require('lodash.functions'); ``` -See the [documentation](https://lodash.com/docs#functions) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.functions) for more details. +See the [documentation](https://lodash.com/docs#functions) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.functions) for more details. diff --git a/lodash.functions/index.js b/lodash.functions/index.js index c04311b29..15202ab77 100644 --- a/lodash.functions/index.js +++ b/lodash.functions/index.js @@ -1,29 +1,36 @@ /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var keys = require('lodash.keys'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + stringTag = '[object String]'; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, - length = array.length, + length = array ? array.length : 0, resIndex = 0, result = []; @@ -36,9 +43,58 @@ function arrayFilter(array, predicate) { return result; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +/** + * Creates a function that invokes `func` with its first argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + /** Used for built-in method references. */ var objectProto = Object.prototype; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) @@ -46,6 +102,13 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetPrototype = Object.getPrototypeOf, + nativeKeys = Object.keys; + /** * The base implementation of `_.functions` which creates an array of * `object` function property names filtered from `props`. @@ -61,6 +124,208 @@ function baseFunctions(object, props) { }); } +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return object != null && + (hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null)); +} + +/** + * The base implementation of `_.keys` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +var baseKeys = overArg(nativeKeys, Object); + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ +var getPrototype = overArg(nativeGetPrototype, Object); + +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + /** * Checks if `value` is classified as a `Function` object. * @@ -69,8 +334,7 @@ function baseFunctions(object, props) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -87,6 +351,38 @@ function isFunction(value) { return tag == funcTag || tag == genTag; } +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) @@ -117,6 +413,56 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + /** * Creates an array of function property names from own enumerable properties * of `object`. @@ -144,4 +490,52 @@ function functions(object) { return object == null ? [] : baseFunctions(object, keys(object)); } +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + var isProto = isPrototype(object); + if (!(isProto || isArrayLike(object))) { + return baseKeys(object); + } + var indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + for (var key in object) { + if (baseHas(object, key) && + !(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(isProto && key == 'constructor')) { + result.push(key); + } + } + return result; +} + module.exports = functions; diff --git a/lodash.functions/package.json b/lodash.functions/package.json index b029d531d..2b22d3db5 100644 --- a/lodash.functions/package.json +++ b/lodash.functions/package.json @@ -1,6 +1,6 @@ { "name": "lodash.functions", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.functions` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,8 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.keys": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.functionsin/LICENSE b/lodash.functionsin/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.functionsin/LICENSE +++ b/lodash.functionsin/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.functionsin/README.md b/lodash.functionsin/README.md index 8e060c859..c1e3808a5 100644 --- a/lodash.functionsin/README.md +++ b/lodash.functionsin/README.md @@ -1,4 +1,4 @@ -# lodash.functionsin v4.1.1 +# lodash.functionsin v4.2.0 The [lodash](https://lodash.com/) method `_.functionsIn` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var functionsIn = require('lodash.functionsin'); ``` -See the [documentation](https://lodash.com/docs#functionsIn) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.functionsin) for more details. +See the [documentation](https://lodash.com/docs#functionsIn) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.functionsin) for more details. diff --git a/lodash.functionsin/index.js b/lodash.functionsin/index.js index 205a59669..587a335de 100644 --- a/lodash.functionsin/index.js +++ b/lodash.functionsin/index.js @@ -1,29 +1,45 @@ /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var keysIn = require('lodash.keysin'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + stringTag = '[object String]'; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, - length = array.length, + length = array ? array.length : 0, resIndex = 0, result = []; @@ -36,9 +52,61 @@ function arrayFilter(array, predicate) { return result; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +/** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ +function iteratorToArray(iterator) { + var data, + result = []; + + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; +} + /** Used for built-in method references. */ var objectProto = Object.prototype; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) @@ -46,6 +114,11 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** Built-in value references. */ +var Reflect = root.Reflect, + enumerate = Reflect ? Reflect.enumerate : undefined, + propertyIsEnumerable = objectProto.propertyIsEnumerable; + /** * The base implementation of `_.functions` which creates an array of * `object` function property names filtered from `props`. @@ -61,6 +134,197 @@ function baseFunctions(object, props) { }); } +/** + * The base implementation of `_.keysIn` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeysIn(object) { + object = object == null ? object : Object(object); + + var result = []; + for (var key in object) { + result.push(key); + } + return result; +} + +// Fallback for IE < 9 with es6-shim. +if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { + baseKeysIn = function(object) { + return iteratorToArray(enumerate(object)); + }; +} + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + /** * Checks if `value` is classified as a `Function` object. * @@ -69,8 +333,7 @@ function baseFunctions(object, props) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -87,6 +350,38 @@ function isFunction(value) { return tag == funcTag || tag == genTag; } +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) @@ -117,6 +412,56 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + /** * Creates an array of function property names from own and inherited * enumerable properties of `object`. @@ -144,4 +489,47 @@ function functionsIn(object) { return object == null ? [] : baseFunctions(object, keysIn(object)); } +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + var index = -1, + isProto = isPrototype(object), + props = baseKeysIn(object), + propsLength = props.length, + indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + while (++index < propsLength) { + var key = props[index]; + if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; +} + module.exports = functionsIn; diff --git a/lodash.functionsin/package.json b/lodash.functionsin/package.json index f4b5b5200..28f2635a5 100644 --- a/lodash.functionsin/package.json +++ b/lodash.functionsin/package.json @@ -1,6 +1,6 @@ { "name": "lodash.functionsin", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.functionsIn` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,8 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.keysin": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.get/LICENSE b/lodash.get/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.get/LICENSE +++ b/lodash.get/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.get/README.md b/lodash.get/README.md index c62ce03cc..57c2c6194 100644 --- a/lodash.get/README.md +++ b/lodash.get/README.md @@ -1,4 +1,4 @@ -# lodash.get v4.1.2 +# lodash.get v4.2.0 The [lodash](https://lodash.com/) method `_.get` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var get = require('lodash.get'); ``` -See the [documentation](https://lodash.com/docs#get) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.get) for more details. +See the [documentation](https://lodash.com/docs#get) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.get) for more details. diff --git a/lodash.get/index.js b/lodash.get/index.js index fa2e776b6..6dfbbb445 100644 --- a/lodash.get/index.js +++ b/lodash.get/index.js @@ -1,20 +1,29 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var toString = require('lodash.tostring'); +var stringToPath = require('lodash._stringtopath'); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; + reIsPlainProp = /^\w*$/; -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; /** * Casts `value` to a path array if it's not one. @@ -36,7 +45,7 @@ function baseCastPath(value) { * @returns {*} Returns the resolved value. */ function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseCastPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = 0, length = path.length; @@ -56,38 +65,26 @@ function baseGet(object, path) { * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { - if (typeof value == 'number') { + var type = typeof value; + if (type == 'number' || type == 'symbol') { return true; } return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ + * @since 0.1.0 * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -105,15 +102,67 @@ function stringToPath(string) { var isArray = Array.isArray; /** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined` the `defaultValue` is used in its place. + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". * * @static * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * diff --git a/lodash.get/package.json b/lodash.get/package.json index 48bf52bf9..89f855f9e 100644 --- a/lodash.get/package.json +++ b/lodash.get/package.json @@ -1,6 +1,6 @@ { "name": "lodash.get", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.get` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,12 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash.tostring": "^4.0.0" + "lodash._stringtopath": "~4.7.0" } } diff --git a/lodash.groupby/README.md b/lodash.groupby/README.md index 938980d62..b9038ff75 100644 --- a/lodash.groupby/README.md +++ b/lodash.groupby/README.md @@ -1,4 +1,4 @@ -# lodash.groupby v4.1.1 +# lodash.groupby v4.2.0 The [lodash](https://lodash.com/) method `_.groupBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var groupBy = require('lodash.groupby'); ``` -See the [documentation](https://lodash.com/docs#groupBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.groupby) for more details. +See the [documentation](https://lodash.com/docs#groupBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.groupby) for more details. diff --git a/lodash.groupby/index.js b/lodash.groupby/index.js index 928a20315..c9ef2e31b 100644 --- a/lodash.groupby/index.js +++ b/lodash.groupby/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,24 +7,7 @@ * Available under MIT license */ var baseEach = require('lodash._baseeach'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'); /** * A specialized version of `baseAggregator` for arrays. @@ -71,130 +54,6 @@ function baseAggregator(collection, setter, iteratee, accumulator) { return accumulator; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Creates a function like `_.groupBy`. * @@ -212,67 +71,6 @@ function createAggregator(setter, initializer) { }; } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value @@ -307,7 +105,7 @@ var groupBy = createAggregator(function(result, value, key) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -327,76 +125,4 @@ var groupBy = createAggregator(function(result, value, key) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = groupBy; diff --git a/lodash.groupby/package.json b/lodash.groupby/package.json index eb1ff19de..25dae8cf1 100644 --- a/lodash.groupby/package.json +++ b/lodash.groupby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.groupby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.groupBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,11 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeach": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.has/README.md b/lodash.has/README.md index e6f228ffa..442c5b7f8 100644 --- a/lodash.has/README.md +++ b/lodash.has/README.md @@ -1,4 +1,4 @@ -# lodash.has v4.1.1 +# lodash.has v4.2.0 The [lodash](https://lodash.com/) method `_.has` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var has = require('lodash.has'); ``` -See the [documentation](https://lodash.com/docs#has) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.has) for more details. +See the [documentation](https://lodash.com/docs#has) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.has) for more details. diff --git a/lodash.has/index.js b/lodash.has/index.js index 2414d85cb..6c1a2d4e3 100644 --- a/lodash.has/index.js +++ b/lodash.has/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), toString = require('lodash.tostring'); /** Used as references for various `Number` constants. */ @@ -60,6 +59,37 @@ var objectToString = objectProto.toString; var getPrototypeOf = Object.getPrototypeOf, propertyIsEnumerable = objectProto.propertyIsEnumerable; +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + /** * The base implementation of `_.has` without support for deep paths. * @@ -89,18 +119,6 @@ function baseProperty(key) { }; } -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -128,7 +146,7 @@ function hasPath(object, path, hasFunc) { } var result = hasFunc(object, path); if (!result && !isKey(path)) { - path = baseToPath(path); + path = baseCastPath(path); object = parent(object, path); if (object != null) { path = last(path); @@ -231,7 +249,7 @@ function isArguments(value) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -258,7 +276,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -287,7 +304,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -358,7 +374,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -437,6 +454,35 @@ function isString(value) { (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); } +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + /** * Checks if `path` is a direct property of `object`. * diff --git a/lodash.has/package.json b/lodash.has/package.json index 3c4a20ccf..4564a2730 100644 --- a/lodash.has/package.json +++ b/lodash.has/package.json @@ -1,6 +1,6 @@ { "name": "lodash.has", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.has` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.hasin/README.md b/lodash.hasin/README.md index 3b450ebb7..33842bdec 100644 --- a/lodash.hasin/README.md +++ b/lodash.hasin/README.md @@ -1,4 +1,4 @@ -# lodash.hasin v4.1.1 +# lodash.hasin v4.2.0 The [lodash](https://lodash.com/) method `_.hasIn` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var hasIn = require('lodash.hasin'); ``` -See the [documentation](https://lodash.com/docs#hasIn) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.hasin) for more details. +See the [documentation](https://lodash.com/docs#hasIn) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.hasin) for more details. diff --git a/lodash.hasin/index.js b/lodash.hasin/index.js index 488063940..a26242ad4 100644 --- a/lodash.hasin/index.js +++ b/lodash.hasin/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), toString = require('lodash.tostring'); /** Used as references for various `Number` constants. */ @@ -59,6 +58,37 @@ var objectToString = objectProto.toString; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + /** * The base implementation of `_.hasIn` without support for deep paths. * @@ -84,18 +114,6 @@ function baseProperty(key) { }; } -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -123,7 +141,7 @@ function hasPath(object, path, hasFunc) { } var result = hasFunc(object, path); if (!result && !isKey(path)) { - path = baseToPath(path); + path = baseCastPath(path); object = parent(object, path); if (object != null) { path = last(path); @@ -226,7 +244,7 @@ function isArguments(value) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -253,7 +271,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -282,7 +299,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -353,7 +369,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -432,6 +449,35 @@ function isString(value) { (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); } +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + /** * Checks if `path` is a direct or inherited property of `object`. * diff --git a/lodash.hasin/package.json b/lodash.hasin/package.json index 2361e7f06..2fb920722 100644 --- a/lodash.hasin/package.json +++ b/lodash.hasin/package.json @@ -1,6 +1,6 @@ { "name": "lodash.hasin", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.hasIn` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.includes/README.md b/lodash.includes/README.md index a71b50019..78b375cd2 100644 --- a/lodash.includes/README.md +++ b/lodash.includes/README.md @@ -1,4 +1,4 @@ -# lodash.includes v4.1.3 +# lodash.includes v4.2.0 The [lodash](https://lodash.com/) method `_.includes` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var includes = require('lodash.includes'); ``` -See the [documentation](https://lodash.com/docs#includes) or [package source](https://github.com/lodash/lodash/blob/4.1.3-npm-packages/lodash.includes) for more details. +See the [documentation](https://lodash.com/docs#includes) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.includes) for more details. diff --git a/lodash.includes/index.js b/lodash.includes/index.js index 51df6e613..db1ef5584 100644 --- a/lodash.includes/index.js +++ b/lodash.includes/index.js @@ -6,7 +6,6 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var keys = require('lodash.keys'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, @@ -15,7 +14,8 @@ var INFINITY = 1 / 0, NAN = 0 / 0; /** `Object#toString` result references. */ -var funcTag = '[object Function]', +var argsTag = '[object Arguments]', + funcTag = '[object Function]', genTag = '[object GeneratorFunction]', stringTag = '[object String]', symbolTag = '[object Symbol]'; @@ -32,6 +32,9 @@ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; @@ -40,13 +43,13 @@ var freeParseInt = parseInt; * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array.length, + length = array ? array.length : 0, result = Array(length); while (++index < length) { @@ -55,6 +58,29 @@ function arrayMap(array, iteratee) { return result; } +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + /** * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * @@ -66,7 +92,7 @@ function arrayMap(array, iteratee) { */ function baseIndexOf(array, value, fromIndex) { if (value !== value) { - return indexOfNaN(array, fromIndex); + return baseFindIndex(array, baseIsNaN, fromIndex); } var index = fromIndex - 1, length = array.length; @@ -79,6 +105,49 @@ function baseIndexOf(array, value, fromIndex) { return -1; } +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names @@ -96,30 +165,25 @@ function baseValues(object, props) { } /** - * Gets the index at which the first occurrence of `NaN` is found in `array`. + * Creates a function that invokes `func` with its first argument transformed. * * @private - * @param {Array} array The array to search. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched `NaN`, else `-1`. + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. */ -function indexOfNaN(array, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 0 : -1); - - while ((fromRight ? index-- : ++index < length)) { - var other = array[index]; - if (other !== other) { - return index; - } - } - return -1; +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; } /** Used for built-in method references. */ var objectProto = Object.prototype; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) @@ -127,22 +191,41 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; +var nativeGetPrototype = Object.getPrototypeOf, + nativeKeys = Object.keys, + nativeMax = Math.max; /** - * The base implementation of `_.property` without support for deep paths. + * The base implementation of `_.has` without support for deep paths. * * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return object != null && + (hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null)); } +/** + * The base implementation of `_.keys` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +var baseKeys = overArg(nativeKeys, Object); + /** * Gets the "length" property value of `object`. * @@ -156,6 +239,61 @@ function baseProperty(key) { */ var getLength = baseProperty('length'); +/** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ +var getPrototype = overArg(nativeGetPrototype, Object); + +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + /** * Checks if `value` is in `collection`. If `collection` is a string, it's * checked for a substring of `value`, otherwise @@ -180,10 +318,10 @@ var getLength = baseProperty('length'); * _.includes([1, 2, 3], 1, 2); * // => false * - * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); + * _.includes({ 'a': 1, 'b': 2 }, 1); * // => true * - * _.includes('pebbles', 'eb'); + * _.includes('abcd', 'bc'); * // => true */ function includes(collection, value, fromIndex, guard) { @@ -199,17 +337,39 @@ function includes(collection, value, fromIndex, guard) { : (!!length && baseIndexOf(collection, value, fromIndex) > -1); } +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 - * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); @@ -255,6 +415,35 @@ function isArrayLike(value) { return value != null && isLength(getLength(value)) && !isFunction(value); } +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + /** * Checks if `value` is classified as a `Function` object. * @@ -263,8 +452,7 @@ function isArrayLike(value) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -379,8 +567,7 @@ function isObjectLike(value) { * @memberOf _ * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. * @example * * _.isString('abc'); @@ -402,8 +589,7 @@ function isString(value) { * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); @@ -455,7 +641,7 @@ function toFinite(value) { /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on + * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static @@ -529,6 +715,54 @@ function toNumber(value) { : (reIsBadHex.test(value) ? NAN : +value); } +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + var isProto = isPrototype(object); + if (!(isProto || isArrayLike(object))) { + return baseKeys(object); + } + var indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + for (var key in object) { + if (baseHas(object, key) && + !(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(isProto && key == 'constructor')) { + result.push(key); + } + } + return result; +} + /** * Creates an array of the own enumerable string keyed property values of `object`. * diff --git a/lodash.includes/package.json b/lodash.includes/package.json index aaa141f97..890686a4f 100644 --- a/lodash.includes/package.json +++ b/lodash.includes/package.json @@ -1,6 +1,6 @@ { "name": "lodash.includes", - "version": "4.1.3", + "version": "4.2.0", "description": "The lodash method `_.includes` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,8 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.keys": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.intersection/README.md b/lodash.intersection/README.md index 3b5911a3f..b3c324bea 100644 --- a/lodash.intersection/README.md +++ b/lodash.intersection/README.md @@ -1,4 +1,4 @@ -# lodash.intersection v4.1.2 +# lodash.intersection v4.2.0 The [lodash](https://lodash.com/) method `_.intersection` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var intersection = require('lodash.intersection'); ``` -See the [documentation](https://lodash.com/docs#intersection) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.intersection) for more details. +See the [documentation](https://lodash.com/docs#intersection) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.intersection) for more details. diff --git a/lodash.intersection/index.js b/lodash.intersection/index.js index 827344090..961a39ff3 100644 --- a/lodash.intersection/index.js +++ b/lodash.intersection/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -51,7 +51,7 @@ var objectToString = objectProto.toString; * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { diff --git a/lodash.intersection/package.json b/lodash.intersection/package.json index 819b74025..b764c42ea 100644 --- a/lodash.intersection/package.json +++ b/lodash.intersection/package.json @@ -1,6 +1,6 @@ { "name": "lodash.intersection", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.intersection` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseintersection": "~4.4.0", + "lodash._baseintersection": "~4.5.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.intersectionby/README.md b/lodash.intersectionby/README.md index 4e17e5080..739901de4 100644 --- a/lodash.intersectionby/README.md +++ b/lodash.intersectionby/README.md @@ -1,4 +1,4 @@ -# lodash.intersectionby v4.1.1 +# lodash.intersectionby v4.2.0 The [lodash](https://lodash.com/) method `_.intersectionBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var intersectionBy = require('lodash.intersectionby'); ``` -See the [documentation](https://lodash.com/docs#intersectionBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.intersectionby) for more details. +See the [documentation](https://lodash.com/docs#intersectionBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.intersectionby) for more details. diff --git a/lodash.intersectionby/index.js b/lodash.intersectionby/index.js index ee9bf8855..59c575ef2 100644 --- a/lodash.intersectionby/index.js +++ b/lodash.intersectionby/index.js @@ -1,27 +1,14 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - arrayMap = require('lodash._arraymap'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - cacheHas = require('lodash._cachehas'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; +var baseIntersection = require('lodash._baseintersection'), + baseIteratee = require('lodash._baseiteratee'), + rest = require('lodash.rest'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -30,25 +17,24 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - /** - * The base implementation of `_.unary` without support for storing wrapper metadata. + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. * * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new function. + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. */ -function baseUnary(func) { - return function(value) { - return func(value); - }; +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; } /** Used for built-in method references. */ @@ -61,143 +47,14 @@ var objectProto = Object.prototype; var objectToString = objectProto.toString; /** - * The base implementation of `_.get` without support for default values. + * Casts `value` to an empty array if it's not an array like object. * * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. + * @param {*} value The value to inspect. + * @returns {Array} Returns the array-like object. */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of methods like `_.intersection`, without support - * for iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. - */ -function baseIntersection(arrays, iteratee, comparator) { - var includes = comparator ? arrayIncludesWith : arrayIncludes, - othLength = arrays.length, - othIndex = othLength, - caches = Array(othLength), - result = []; - - while (othIndex--) { - var array = arrays[othIndex]; - if (othIndex && iteratee) { - array = arrayMap(array, baseUnary(iteratee)); - } - caches[othIndex] = !comparator && (iteratee || array.length >= 120) - ? new SetCache(othIndex && array) - : undefined; - } - array = arrays[0]; - - var index = -1, - length = array.length, - seen = caches[0]; - - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) { - var othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; +function baseCastArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; } /** @@ -213,31 +70,6 @@ function baseProperty(key) { }; } -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -250,78 +82,6 @@ function baseToPath(value) { */ var getLength = baseProperty('length'); -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Converts `value` to an array-like object if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the array-like object. - */ -function toArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; -} - /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion @@ -344,7 +104,7 @@ function toArrayLikeObject(value) { */ var intersectionBy = rest(function(arrays) { var iteratee = last(arrays), - mapped = arrayMap(arrays, toArrayLikeObject); + mapped = arrayMap(arrays, baseCastArrayLikeObject); if (iteratee === last(mapped)) { iteratee = undefined; @@ -374,31 +134,6 @@ function last(array) { return length ? array[length - 1] : undefined; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -406,7 +141,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -435,7 +169,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -506,7 +239,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -564,48 +298,4 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = intersectionBy; diff --git a/lodash.intersectionby/package.json b/lodash.intersectionby/package.json index 0520a7ad8..9cb531f1d 100644 --- a/lodash.intersectionby/package.json +++ b/lodash.intersectionby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.intersectionby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.intersectionBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,17 +15,8 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", - "lodash._arraymap": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._setcache": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseintersection": "^4.0.0", + "lodash._baseiteratee": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.intersectionwith/README.md b/lodash.intersectionwith/README.md index 66baf8631..dca131278 100644 --- a/lodash.intersectionwith/README.md +++ b/lodash.intersectionwith/README.md @@ -1,4 +1,4 @@ -# lodash.intersectionwith v4.1.2 +# lodash.intersectionwith v4.2.0 The [lodash](https://lodash.com/) method `_.intersectionWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var intersectionWith = require('lodash.intersectionwith'); ``` -See the [documentation](https://lodash.com/docs#intersectionWith) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.intersectionwith) for more details. +See the [documentation](https://lodash.com/docs#intersectionWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.intersectionwith) for more details. diff --git a/lodash.intersectionwith/index.js b/lodash.intersectionwith/index.js index 985333770..c27a17d23 100644 --- a/lodash.intersectionwith/index.js +++ b/lodash.intersectionwith/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -51,7 +51,7 @@ var objectToString = objectProto.toString; * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { diff --git a/lodash.intersectionwith/package.json b/lodash.intersectionwith/package.json index 730302b35..b8216a9f5 100644 --- a/lodash.intersectionwith/package.json +++ b/lodash.intersectionwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.intersectionwith", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.intersectionWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseintersection": "~4.4.0", + "lodash._baseintersection": "~4.5.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.invert/LICENSE b/lodash.invert/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.invert/LICENSE +++ b/lodash.invert/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.invert/README.md b/lodash.invert/README.md index 3a08abe6c..56be924e5 100644 --- a/lodash.invert/README.md +++ b/lodash.invert/README.md @@ -1,4 +1,4 @@ -# lodash.invert v4.1.1 +# lodash.invert v4.2.0 The [lodash](https://lodash.com/) method `_.invert` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var invert = require('lodash.invert'); ``` -See the [documentation](https://lodash.com/docs#invert) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.invert) for more details. +See the [documentation](https://lodash.com/docs#invert) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.invert) for more details. diff --git a/lodash.invert/index.js b/lodash.invert/index.js index b0ed04620..9a9855d48 100644 --- a/lodash.invert/index.js +++ b/lodash.invert/index.js @@ -1,13 +1,102 @@ /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseFor = require('lodash._basefor'), - keys = require('lodash.keys'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + stringTag = '[object String]'; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +/** + * Creates a function that invokes `func` with its first argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetPrototype = Object.getPrototypeOf, + nativeKeys = Object.keys; + +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -21,6 +110,23 @@ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return object != null && + (hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null)); +} + /** * The base implementation of `_.invert` and `_.invertBy` which inverts * `object` with values transformed by `iteratee` and set by `setter`. @@ -39,6 +145,40 @@ function baseInverter(object, setter, iteratee, accumulator) { return accumulator; } +/** + * The base implementation of `_.keys` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +var baseKeys = overArg(nativeKeys, Object); + +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} + /** * Creates a function like `_.invertBy`. * @@ -53,6 +193,318 @@ function createInverter(setter, toIteratee) { }; } +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ +var getPrototype = overArg(nativeGetPrototype, Object); + +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + /** * Creates an object composed of the inverted keys and values of `object`. * If `object` contains duplicate values, subsequent values overwrite @@ -75,6 +527,54 @@ var invert = createInverter(function(result, value, key) { result[value] = key; }, constant(identity)); +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + var isProto = isPrototype(object); + if (!(isProto || isArrayLike(object))) { + return baseKeys(object); + } + var indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + for (var key in object) { + if (baseHas(object, key) && + !(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(isProto && key == 'constructor')) { + result.push(key); + } + } + return result; +} + /** * Creates a function that returns `value`. * @@ -86,10 +586,12 @@ var invert = createInverter(function(result, value, key) { * @returns {Function} Returns the new constant function. * @example * - * var object = { 'user': 'fred' }; - * var getter = _.constant(object); + * var objects = _.times(2, _.constant({ 'a': 1 })); * - * getter() === object; + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { @@ -99,7 +601,7 @@ function constant(value) { } /** - * This method returns the first argument given to it. + * This method returns the first argument it receives. * * @static * @since 0.1.0 @@ -109,9 +611,9 @@ function constant(value) { * @returns {*} Returns `value`. * @example * - * var object = { 'user': 'fred' }; + * var object = { 'a': 1 }; * - * _.identity(object) === object; + * console.log(_.identity(object) === object); * // => true */ function identity(value) { diff --git a/lodash.invert/package.json b/lodash.invert/package.json index db616a71e..df3c2660e 100644 --- a/lodash.invert/package.json +++ b/lodash.invert/package.json @@ -1,6 +1,6 @@ { "name": "lodash.invert", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.invert` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._basefor": "~3.0.0", - "lodash.keys": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.invertby/README.md b/lodash.invertby/README.md index 91c4e6609..edebc1554 100644 --- a/lodash.invertby/README.md +++ b/lodash.invertby/README.md @@ -1,4 +1,4 @@ -# lodash.invertby v4.1.1 +# lodash.invertby v4.2.0 The [lodash](https://lodash.com/) method `_.invertBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var invertBy = require('lodash.invertby'); ``` -See the [documentation](https://lodash.com/docs#invertBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.invertby) for more details. +See the [documentation](https://lodash.com/docs#invertBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.invertby) for more details. diff --git a/lodash.invertby/index.js b/lodash.invertby/index.js index 95030ff06..f2cc9a5bb 100644 --- a/lodash.invertby/index.js +++ b/lodash.invertby/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -12,6 +12,7 @@ var baseFor = require('lodash._basefor'), get = require('lodash.get'), hasIn = require('lodash.hasin'), keys = require('lodash.keys'), + root = require('lodash._root'), toPairs = require('lodash.topairs'); /** Used to compose bitmasks for comparison styles. */ @@ -32,49 +33,6 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; - -/** Detect free variable `exports`. */ -var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; - -/** Detect free variable `module`. */ -var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; diff --git a/lodash.invertby/package.json b/lodash.invertby/package.json index ca81e5a17..170dda8c3 100644 --- a/lodash.invertby/package.json +++ b/lodash.invertby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.invertby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.invertBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,6 +18,7 @@ "lodash._basefor": "^3.0.0", "lodash._baseisequal": "^4.0.0", "lodash._baseismatch": "^4.0.0", + "lodash._root": "^3.0.0", "lodash.get": "^4.0.0", "lodash.hasin": "^4.0.0", "lodash.keys": "^4.0.0", diff --git a/lodash.invoke/README.md b/lodash.invoke/README.md index 6538e648c..cee18cff3 100644 --- a/lodash.invoke/README.md +++ b/lodash.invoke/README.md @@ -1,4 +1,4 @@ -# lodash.invoke v4.1.1 +# lodash.invoke v4.2.0 The [lodash](https://lodash.com/) method `_.invoke` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var invoke = require('lodash.invoke'); ``` -See the [documentation](https://lodash.com/docs#invoke) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.invoke) for more details. +See the [documentation](https://lodash.com/docs#invoke) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.invoke) for more details. diff --git a/lodash.invoke/index.js b/lodash.invoke/index.js index a4fabd53e..58b31d606 100644 --- a/lodash.invoke/index.js +++ b/lodash.invoke/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), rest = require('lodash.rest'), toString = require('lodash.tostring'); @@ -40,6 +39,37 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + /** * The base implementation of `_.invoke` without support for individual * method arguments. @@ -52,7 +82,7 @@ function apply(func, thisArg, args) { */ function baseInvoke(object, path, args) { if (!isKey(path, object)) { - path = baseToPath(path); + path = baseCastPath(path); object = parent(object, path); path = last(path); } @@ -60,18 +90,6 @@ function baseInvoke(object, path, args) { return func == null ? undefined : apply(func, object, args); } -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Checks if `value` is a property name and not a property path. * @@ -139,7 +157,7 @@ function last(array) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -159,6 +177,35 @@ function last(array) { */ var isArray = Array.isArray; +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + /** * Invokes the method at `path` of `object`. * diff --git a/lodash.invoke/package.json b/lodash.invoke/package.json index a331ef503..ecb680dbc 100644 --- a/lodash.invoke/package.json +++ b/lodash.invoke/package.json @@ -1,6 +1,6 @@ { "name": "lodash.invoke", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.invoke` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", "lodash.rest": "^4.0.0", "lodash.tostring": "^4.0.0" } diff --git a/lodash.invokemap/README.md b/lodash.invokemap/README.md index 5fb435c76..7fc057f8e 100644 --- a/lodash.invokemap/README.md +++ b/lodash.invokemap/README.md @@ -1,4 +1,4 @@ -# lodash.invokemap v4.1.1 +# lodash.invokemap v4.2.0 The [lodash](https://lodash.com/) method `_.invokeMap` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var invokeMap = require('lodash.invokemap'); ``` -See the [documentation](https://lodash.com/docs#invokeMap) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.invokemap) for more details. +See the [documentation](https://lodash.com/docs#invokeMap) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.invokemap) for more details. diff --git a/lodash.invokemap/index.js b/lodash.invokemap/index.js index 948553289..541857278 100644 --- a/lodash.invokemap/index.js +++ b/lodash.invokemap/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -8,7 +8,6 @@ */ var baseEach = require('lodash._baseeach'), baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), rest = require('lodash.rest'), toString = require('lodash.tostring'); @@ -57,6 +56,37 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + /** * The base implementation of `_.invoke` without support for individual * method arguments. @@ -69,7 +99,7 @@ var objectToString = objectProto.toString; */ function baseInvoke(object, path, args) { if (!isKey(path, object)) { - path = baseToPath(path); + path = baseCastPath(path); object = parent(object, path); path = last(path); } @@ -90,18 +120,6 @@ function baseProperty(key) { }; } -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -216,7 +234,7 @@ var invokeMap = rest(function(collection, path, args) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -243,7 +261,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -315,7 +332,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -346,4 +364,33 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + module.exports = invokeMap; diff --git a/lodash.invokemap/package.json b/lodash.invokemap/package.json index 7ad9258b1..4caafd14e 100644 --- a/lodash.invokemap/package.json +++ b/lodash.invokemap/package.json @@ -1,6 +1,6 @@ { "name": "lodash.invokemap", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.invokeMap` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -17,7 +17,6 @@ "dependencies": { "lodash._baseeach": "^4.0.0", "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", "lodash.rest": "^4.0.0", "lodash.tostring": "^4.0.0" } diff --git a/lodash.isarraylike/README.md b/lodash.isarraylike/README.md index ad62534f4..0af33c2a2 100644 --- a/lodash.isarraylike/README.md +++ b/lodash.isarraylike/README.md @@ -1,4 +1,4 @@ -# lodash.isarraylike v4.1.0 +# lodash.isarraylike v4.2.0 The [lodash](https://lodash.com/) method `_.isArrayLike` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var isArrayLike = require('lodash.isarraylike'); ``` -See the [documentation](https://lodash.com/docs#isArrayLike) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.isarraylike) for more details. +See the [documentation](https://lodash.com/docs#isArrayLike) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.isarraylike) for more details. diff --git a/lodash.isarraylike/index.js b/lodash.isarraylike/index.js index c78820add..ffe6a79e3 100644 --- a/lodash.isarraylike/index.js +++ b/lodash.isarraylike/index.js @@ -14,42 +14,16 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -76,7 +50,7 @@ var getLength = baseProperty('length'); * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -98,8 +72,7 @@ function isArrayLike(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -107,16 +80,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -138,7 +110,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static diff --git a/lodash.isarraylike/package.json b/lodash.isarraylike/package.json index f503a35de..6a288ac47 100644 --- a/lodash.isarraylike/package.json +++ b/lodash.isarraylike/package.json @@ -1,6 +1,6 @@ { "name": "lodash.isarraylike", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.isArrayLike` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.isarraylikeobject/README.md b/lodash.isarraylikeobject/README.md index 2a4d13a65..79a48fb01 100644 --- a/lodash.isarraylikeobject/README.md +++ b/lodash.isarraylikeobject/README.md @@ -1,4 +1,4 @@ -# lodash.isarraylikeobject v4.1.0 +# lodash.isarraylikeobject v4.2.0 The [lodash](https://lodash.com/) method `_.isArrayLikeObject` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var isArrayLikeObject = require('lodash.isarraylikeobject'); ``` -See the [documentation](https://lodash.com/docs#isArrayLikeObject) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.isarraylikeobject) for more details. +See the [documentation](https://lodash.com/docs#isArrayLikeObject) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.isarraylikeobject) for more details. diff --git a/lodash.isarraylikeobject/index.js b/lodash.isarraylikeobject/index.js index 66be18f53..1daa1ed62 100644 --- a/lodash.isarraylikeobject/index.js +++ b/lodash.isarraylikeobject/index.js @@ -14,42 +14,16 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -76,7 +50,7 @@ var getLength = baseProperty('length'); * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -127,8 +101,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -136,16 +109,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -167,7 +139,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static diff --git a/lodash.isarraylikeobject/package.json b/lodash.isarraylikeobject/package.json index 74c679f1b..56f3975d3 100644 --- a/lodash.isarraylikeobject/package.json +++ b/lodash.isarraylikeobject/package.json @@ -1,6 +1,6 @@ { "name": "lodash.isarraylikeobject", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.isArrayLikeObject` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.isempty/LICENSE b/lodash.isempty/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.isempty/LICENSE +++ b/lodash.isempty/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.isempty/README.md b/lodash.isempty/README.md index 05cb517dc..79f92f4a8 100644 --- a/lodash.isempty/README.md +++ b/lodash.isempty/README.md @@ -1,4 +1,4 @@ -# lodash.isempty v4.1.3 +# lodash.isempty v4.2.0 The [lodash](https://lodash.com/) method `_.isEmpty` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var isEmpty = require('lodash.isempty'); ``` -See the [documentation](https://lodash.com/docs#isEmpty) or [package source](https://github.com/lodash/lodash/blob/4.1.3-npm-packages/lodash.isempty) for more details. +See the [documentation](https://lodash.com/docs#isEmpty) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.isempty) for more details. diff --git a/lodash.isempty/index.js b/lodash.isempty/index.js index f4224f151..b62255f77 100644 --- a/lodash.isempty/index.js +++ b/lodash.isempty/index.js @@ -1,11 +1,13 @@ /** - * lodash 4.1.3 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ +var keys = require('lodash.keys'), + root = require('lodash._root'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -14,11 +16,67 @@ var MAX_SAFE_INTEGER = 9007199254740991; var argsTag = '[object Arguments]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + mapTag = '[object Map]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + +var dataViewTag = '[object DataView]'; + +/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to determine if values are of the language type `Object`. */ +var objectTypes = { + 'function': true, + 'object': true +}; + +/** Detect free variable `exports`. */ +var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; + +/** Detect free variable `module`. */ +var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = (freeModule && freeModule.exports === freeExports) + ? freeExports + : undefined; + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} /** Used for built-in method references. */ var objectProto = Object.prototype; +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; @@ -28,8 +86,32 @@ var hasOwnProperty = objectProto.hasOwnProperty; */ var objectToString = objectProto.toString; +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + /** Built-in value references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; +var Buffer = moduleExports ? root.Buffer : undefined, + propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/* Built-in method references that are verified to be native. */ +var DataView = getNative(root, 'DataView'), + Map = getNative(root, 'Map'), + Promise = getNative(root, 'Promise'), + Set = getNative(root, 'Set'), + WeakMap = getNative(root, 'WeakMap'); + +/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ +var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); + +/** Used to detect maps, sets, and weakmaps. */ +var dataViewCtorString = DataView ? (DataView + '') : '', + mapCtorString = Map ? funcToString.call(Map) : '', + promiseCtorString = Promise ? funcToString.call(Promise) : '', + setCtorString = Set ? funcToString.call(Set) : '', + weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : ''; /** * The base implementation of `_.property` without support for deep paths. @@ -47,8 +129,9 @@ function baseProperty(key) { /** * Gets the "length" property value of `object`. * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. @@ -56,14 +139,65 @@ function baseProperty(key) { */ var getLength = baseProperty('length'); +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = object[key]; + return isNative(value) ? value : undefined; +} + +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function getTag(value) { + return objectToString.call(value); +} + +// Fallback for data views, maps, sets, and weak maps in IE 11, +// for data views in Edge, and promises in Node.js. +if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = objectToString.call(value), + Ctor = result == objectTag ? value.constructor : null, + ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag; + case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; + } + } + return result; + }; +} + /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArguments(function() { return arguments; }()); @@ -83,10 +217,12 @@ function isArguments(value) { * * @static * @memberOf _ + * @since 0.1.0 * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -110,6 +246,7 @@ var isArray = Array.isArray; * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -137,9 +274,11 @@ function isArrayLike(value) { * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); @@ -159,12 +298,39 @@ function isArrayLikeObject(value) { } /** - * Checks if `value` is an empty collection or object. A value is considered - * empty if it's an `arguments` object, array, string, or jQuery-like collection - * with a length of `0` or has no own enumerable properties. + * Checks if `value` is a buffer. * * @static * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = !Buffer ? constant(false) : function(value) { + return value instanceof Buffer; +}; + +/** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is empty, else `false`. @@ -187,16 +353,22 @@ function isArrayLikeObject(value) { */ function isEmpty(value) { if (isArrayLike(value) && - (isArray(value) || isString(value) || - isFunction(value.splice) || isArguments(value))) { + (isArray(value) || isString(value) || isFunction(value.splice) || + isArguments(value) || isBuffer(value))) { return !value.length; } + if (isObjectLike(value)) { + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } - return true; + return !(nonEnumShadows && keys(value).length); } /** @@ -204,9 +376,11 @@ function isEmpty(value) { * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isFunction(_); @@ -226,13 +400,16 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. * @example * * _.isLength(3); @@ -258,6 +435,7 @@ function isLength(value) { * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. @@ -286,6 +464,7 @@ function isObject(value) { * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. @@ -308,13 +487,44 @@ function isObjectLike(value) { } /** - * Checks if `value` is classified as a `String` primitive or object. + * Checks if `value` is a native function. * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(funcToString.call(value)); + } + return isObjectLike(value) && + (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isString('abc'); @@ -328,4 +538,27 @@ function isString(value) { (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); } +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new function. + * @example + * + * var object = { 'user': 'fred' }; + * var getter = _.constant(object); + * + * getter() === object; + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + module.exports = isEmpty; diff --git a/lodash.isempty/package.json b/lodash.isempty/package.json index 1155a66dc..991644787 100644 --- a/lodash.isempty/package.json +++ b/lodash.isempty/package.json @@ -1,6 +1,6 @@ { "name": "lodash.isempty", - "version": "4.1.3", + "version": "4.2.0", "description": "The lodash method `_.isEmpty` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,9 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "~3.0.0", + "lodash.keys": "^4.0.0" + } } diff --git a/lodash.isequal/README.md b/lodash.isequal/README.md index 722548d6c..f2932ea88 100644 --- a/lodash.isequal/README.md +++ b/lodash.isequal/README.md @@ -1,4 +1,4 @@ -# lodash.isequal v4.1.4 +# lodash.isequal v4.2.0 The [lodash](https://lodash.com/) method `_.isEqual` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var isEqual = require('lodash.isequal'); ``` -See the [documentation](https://lodash.com/docs#isEqual) or [package source](https://github.com/lodash/lodash/blob/4.1.4-npm-packages/lodash.isequal) for more details. +See the [documentation](https://lodash.com/docs#isEqual) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.isequal) for more details. diff --git a/lodash.isequal/index.js b/lodash.isequal/index.js index 50c7931bf..a354b15e5 100644 --- a/lodash.isequal/index.js +++ b/lodash.isequal/index.js @@ -1,15 +1,20 @@ /** - * lodash 4.1.4 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var Stack = require('lodash._stack'), - keys = require('lodash.keys'), +var keys = require('lodash.keys'), root = require('lodash._root'); +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; @@ -114,11 +119,11 @@ function isHostObject(value) { } /** - * Converts `map` to an array. + * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. - * @returns {Array} Returns the converted array. + * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, @@ -131,11 +136,11 @@ function mapToArray(map) { } /** - * Converts `set` to an array. + * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. + * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, @@ -148,7 +153,8 @@ function setToArray(set) { } /** Used for built-in method references. */ -var objectProto = Object.prototype; +var arrayProto = Array.prototype, + objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = Function.prototype.toString; @@ -171,7 +177,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, - Uint8Array = root.Uint8Array; + Uint8Array = root.Uint8Array, + splice = arrayProto.splice; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetPrototype = Object.getPrototypeOf; @@ -181,7 +188,8 @@ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise = getNative(root, 'Promise'), Set = getNative(root, 'Set'), - WeakMap = getNative(root, 'WeakMap'); + WeakMap = getNative(root, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), @@ -194,6 +202,465 @@ var dataViewCtorString = toSource(DataView), var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + this.__data__ = new ListCache(entries); +} + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; +} + +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + return this.__data__['delete'](key); +} + +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} + +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} + +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var cache = this.__data__; + if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) { + cache = this.__data__ = new MapCache(cache.__data__); + } + cache.set(key, value); + return this; +} + +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to search. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + /** * The base implementation of `_.has` without support for deep paths. * @@ -308,9 +775,7 @@ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { - var index = -1, - isPartial = bitmask & PARTIAL_COMPARE_FLAG, - isUnordered = bitmask & UNORDERED_COMPARE_FLAG, + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length; @@ -322,7 +787,10 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { if (stacked) { return stacked == other; } - var result = true; + var index = -1, + result = true, + seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined; + stack.set(array, other); // Ignore non-index properties. @@ -343,10 +811,12 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { break; } // Recursively compare arrays (susceptible to call stack limits). - if (isUnordered) { - if (!arraySome(other, function(othValue) { - return arrValue === othValue || - equalFunc(arrValue, othValue, customizer, bitmask, stack); + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!seen.has(othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + return seen.add(othIndex); + } })) { result = false; break; @@ -524,6 +994,21 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { return result; } +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + /** * Gets the native function at `key` of `object`. * @@ -584,6 +1069,20 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || }; } +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + /** * Converts `func` to its source code. * @@ -603,6 +1102,42 @@ function toSource(func) { return ''; } +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + /** * Checks if `value` is classified as an `Array` object. * diff --git a/lodash.isequal/package.json b/lodash.isequal/package.json index b17c1460b..3bc4de706 100644 --- a/lodash.isequal/package.json +++ b/lodash.isequal/package.json @@ -1,6 +1,6 @@ { "name": "lodash.isequal", - "version": "4.1.4", + "version": "4.2.0", "description": "The lodash method `_.isEqual` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._root": "~3.0.0", - "lodash._stack": "~4.1.0", "lodash.keys": "^4.0.0" } } diff --git a/lodash.isequalwith/README.md b/lodash.isequalwith/README.md index 84de1190c..02fe21e0b 100644 --- a/lodash.isequalwith/README.md +++ b/lodash.isequalwith/README.md @@ -1,4 +1,4 @@ -# lodash.isequalwith v4.1.4 +# lodash.isequalwith v4.2.0 The [lodash](https://lodash.com/) method `_.isEqualWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var isEqualWith = require('lodash.isequalwith'); ``` -See the [documentation](https://lodash.com/docs#isEqualWith) or [package source](https://github.com/lodash/lodash/blob/4.1.4-npm-packages/lodash.isequalwith) for more details. +See the [documentation](https://lodash.com/docs#isEqualWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.isequalwith) for more details. diff --git a/lodash.isequalwith/index.js b/lodash.isequalwith/index.js index c42904576..58272ee7f 100644 --- a/lodash.isequalwith/index.js +++ b/lodash.isequalwith/index.js @@ -1,15 +1,20 @@ /** - * lodash 4.1.4 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var Stack = require('lodash._stack'), - keys = require('lodash.keys'), +var keys = require('lodash.keys'), root = require('lodash._root'); +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; @@ -114,11 +119,11 @@ function isHostObject(value) { } /** - * Converts `map` to an array. + * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. - * @returns {Array} Returns the converted array. + * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, @@ -131,11 +136,11 @@ function mapToArray(map) { } /** - * Converts `set` to an array. + * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. + * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, @@ -148,7 +153,8 @@ function setToArray(set) { } /** Used for built-in method references. */ -var objectProto = Object.prototype; +var arrayProto = Array.prototype, + objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = Function.prototype.toString; @@ -171,7 +177,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, - Uint8Array = root.Uint8Array; + Uint8Array = root.Uint8Array, + splice = arrayProto.splice; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetPrototype = Object.getPrototypeOf; @@ -181,7 +188,8 @@ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise = getNative(root, 'Promise'), Set = getNative(root, 'Set'), - WeakMap = getNative(root, 'WeakMap'); + WeakMap = getNative(root, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), @@ -194,6 +202,465 @@ var dataViewCtorString = toSource(DataView), var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + this.__data__ = new ListCache(entries); +} + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; +} + +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + return this.__data__['delete'](key); +} + +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} + +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} + +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var cache = this.__data__; + if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) { + cache = this.__data__ = new MapCache(cache.__data__); + } + cache.set(key, value); + return this; +} + +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to search. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + /** * The base implementation of `_.has` without support for deep paths. * @@ -308,9 +775,7 @@ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { - var index = -1, - isPartial = bitmask & PARTIAL_COMPARE_FLAG, - isUnordered = bitmask & UNORDERED_COMPARE_FLAG, + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length; @@ -322,7 +787,10 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { if (stacked) { return stacked == other; } - var result = true; + var index = -1, + result = true, + seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined; + stack.set(array, other); // Ignore non-index properties. @@ -343,10 +811,12 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { break; } // Recursively compare arrays (susceptible to call stack limits). - if (isUnordered) { - if (!arraySome(other, function(othValue) { - return arrValue === othValue || - equalFunc(arrValue, othValue, customizer, bitmask, stack); + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!seen.has(othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + return seen.add(othIndex); + } })) { result = false; break; @@ -524,6 +994,21 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { return result; } +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + /** * Gets the native function at `key` of `object`. * @@ -584,6 +1069,20 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || }; } +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + /** * Converts `func` to its source code. * @@ -603,6 +1102,42 @@ function toSource(func) { return ''; } +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + /** * Checks if `value` is classified as an `Array` object. * diff --git a/lodash.isequalwith/package.json b/lodash.isequalwith/package.json index 81cc04b30..471be37ab 100644 --- a/lodash.isequalwith/package.json +++ b/lodash.isequalwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.isequalwith", - "version": "4.1.4", + "version": "4.2.0", "description": "The lodash method `_.isEqualWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._root": "~3.0.0", - "lodash._stack": "~4.1.0", "lodash.keys": "^4.0.0" } } diff --git a/lodash.ismatch/README.md b/lodash.ismatch/README.md index ed696472c..5cf9127a2 100644 --- a/lodash.ismatch/README.md +++ b/lodash.ismatch/README.md @@ -1,4 +1,4 @@ -# lodash.ismatch v4.1.4 +# lodash.ismatch v4.2.0 The [lodash](https://lodash.com/) method `_.isMatch` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var isMatch = require('lodash.ismatch'); ``` -See the [documentation](https://lodash.com/docs#isMatch) or [package source](https://github.com/lodash/lodash/blob/4.1.4-npm-packages/lodash.ismatch) for more details. +See the [documentation](https://lodash.com/docs#isMatch) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.ismatch) for more details. diff --git a/lodash.ismatch/index.js b/lodash.ismatch/index.js index 88e40323a..92c62079d 100644 --- a/lodash.ismatch/index.js +++ b/lodash.ismatch/index.js @@ -1,15 +1,20 @@ /** - * lodash 4.1.4 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var Stack = require('lodash._stack'), - keys = require('lodash.keys'), +var keys = require('lodash.keys'), root = require('lodash._root'); +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; @@ -121,7 +126,7 @@ function arraySome(array, predicate) { * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. - * @returns {Object} Returns the new array of key-value pairs. + * @returns {Object} Returns the key-value pairs. */ function baseToPairs(object, props) { return arrayMap(props, function(key) { @@ -149,11 +154,11 @@ function isHostObject(value) { } /** - * Converts `map` to an array. + * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. - * @returns {Array} Returns the converted array. + * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, @@ -166,11 +171,11 @@ function mapToArray(map) { } /** - * Converts `set` to an array. + * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. + * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, @@ -182,8 +187,26 @@ function setToArray(set) { return result; } +/** + * Converts `set` to its value-value pairs. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the value-value pairs. + */ +function setToPairs(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; +} + /** Used for built-in method references. */ -var objectProto = Object.prototype; +var arrayProto = Array.prototype, + objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = Function.prototype.toString; @@ -206,7 +229,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, - Uint8Array = root.Uint8Array; + Uint8Array = root.Uint8Array, + splice = arrayProto.splice; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetPrototype = Object.getPrototypeOf; @@ -216,7 +240,8 @@ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise = getNative(root, 'Promise'), Set = getNative(root, 'Set'), - WeakMap = getNative(root, 'WeakMap'); + WeakMap = getNative(root, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), @@ -229,6 +254,465 @@ var dataViewCtorString = toSource(DataView), var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + this.__data__ = new ListCache(entries); +} + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; +} + +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + return this.__data__['delete'](key); +} + +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} + +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} + +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var cache = this.__data__; + if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) { + cache = this.__data__ = new MapCache(cache.__data__); + } + cache.set(key, value); + return this; +} + +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to search. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + /** * The base implementation of `_.has` without support for deep paths. * @@ -382,6 +866,26 @@ function baseIsMatch(object, source, matchData, customizer) { return true; } +/** + * Creates a `_.toPairs` or `_.toPairsIn` function. + * + * @private + * @param {Function} keysFunc The function to get the keys of a given object. + * @returns {Function} Returns the new pairs function. + */ +function createToPairs(keysFunc) { + return function(object) { + var tag = getTag(object); + if (tag == mapTag) { + return mapToArray(object); + } + if (tag == setTag) { + return setToPairs(object); + } + return baseToPairs(object, keysFunc(object)); + }; +} + /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. @@ -397,9 +901,7 @@ function baseIsMatch(object, source, matchData, customizer) { * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { - var index = -1, - isPartial = bitmask & PARTIAL_COMPARE_FLAG, - isUnordered = bitmask & UNORDERED_COMPARE_FLAG, + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length; @@ -411,7 +913,10 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { if (stacked) { return stacked == other; } - var result = true; + var index = -1, + result = true, + seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined; + stack.set(array, other); // Ignore non-index properties. @@ -432,10 +937,12 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { break; } // Recursively compare arrays (susceptible to call stack limits). - if (isUnordered) { - if (!arraySome(other, function(othValue) { - return arrValue === othValue || - equalFunc(arrValue, othValue, customizer, bitmask, stack); + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!seen.has(othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + return seen.add(othIndex); + } })) { result = false; break; @@ -613,6 +1120,21 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { return result; } +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + /** * Gets the property names, values, and compare flags of `object`. * @@ -690,6 +1212,20 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || }; } +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * @@ -721,6 +1257,42 @@ function toSource(func) { return ''; } +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + /** * Checks if `value` is classified as an `Array` object. * @@ -943,7 +1515,8 @@ function isTypedArray(value) { /** * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `_.fromPairs`. + * which can be consumed by `_.fromPairs`. If `object` is a map or set, its + * entries are returned. * * @static * @memberOf _ @@ -951,7 +1524,7 @@ function isTypedArray(value) { * @alias entries * @category Object * @param {Object} object The object to query. - * @returns {Array} Returns the new array of key-value pairs. + * @returns {Array} Returns the key-value pairs. * @example * * function Foo() { @@ -964,8 +1537,6 @@ function isTypedArray(value) { * _.toPairs(new Foo); * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) */ -function toPairs(object) { - return baseToPairs(object, keys(object)); -} +var toPairs = createToPairs(keys); module.exports = isMatch; diff --git a/lodash.ismatch/package.json b/lodash.ismatch/package.json index b18944aeb..a359dc65d 100644 --- a/lodash.ismatch/package.json +++ b/lodash.ismatch/package.json @@ -1,6 +1,6 @@ { "name": "lodash.ismatch", - "version": "4.1.4", + "version": "4.2.0", "description": "The lodash method `_.isMatch` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._root": "~3.0.0", - "lodash._stack": "~4.1.0", "lodash.keys": "^4.0.0" } } diff --git a/lodash.ismatchwith/README.md b/lodash.ismatchwith/README.md index 29ccd8846..2eceaae66 100644 --- a/lodash.ismatchwith/README.md +++ b/lodash.ismatchwith/README.md @@ -1,4 +1,4 @@ -# lodash.ismatchwith v4.1.4 +# lodash.ismatchwith v4.2.0 The [lodash](https://lodash.com/) method `_.isMatchWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var isMatchWith = require('lodash.ismatchwith'); ``` -See the [documentation](https://lodash.com/docs#isMatchWith) or [package source](https://github.com/lodash/lodash/blob/4.1.4-npm-packages/lodash.ismatchwith) for more details. +See the [documentation](https://lodash.com/docs#isMatchWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.ismatchwith) for more details. diff --git a/lodash.ismatchwith/index.js b/lodash.ismatchwith/index.js index f2842df1e..f4b034cf9 100644 --- a/lodash.ismatchwith/index.js +++ b/lodash.ismatchwith/index.js @@ -1,15 +1,20 @@ /** - * lodash 4.1.4 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var Stack = require('lodash._stack'), - keys = require('lodash.keys'), +var keys = require('lodash.keys'), root = require('lodash._root'); +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; @@ -121,7 +126,7 @@ function arraySome(array, predicate) { * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. - * @returns {Object} Returns the new array of key-value pairs. + * @returns {Object} Returns the key-value pairs. */ function baseToPairs(object, props) { return arrayMap(props, function(key) { @@ -149,11 +154,11 @@ function isHostObject(value) { } /** - * Converts `map` to an array. + * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. - * @returns {Array} Returns the converted array. + * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, @@ -166,11 +171,11 @@ function mapToArray(map) { } /** - * Converts `set` to an array. + * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. + * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, @@ -182,8 +187,26 @@ function setToArray(set) { return result; } +/** + * Converts `set` to its value-value pairs. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the value-value pairs. + */ +function setToPairs(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; +} + /** Used for built-in method references. */ -var objectProto = Object.prototype; +var arrayProto = Array.prototype, + objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = Function.prototype.toString; @@ -206,7 +229,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, - Uint8Array = root.Uint8Array; + Uint8Array = root.Uint8Array, + splice = arrayProto.splice; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetPrototype = Object.getPrototypeOf; @@ -216,7 +240,8 @@ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise = getNative(root, 'Promise'), Set = getNative(root, 'Set'), - WeakMap = getNative(root, 'WeakMap'); + WeakMap = getNative(root, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), @@ -229,6 +254,465 @@ var dataViewCtorString = toSource(DataView), var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + this.__data__ = new ListCache(entries); +} + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; +} + +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + return this.__data__['delete'](key); +} + +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} + +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} + +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var cache = this.__data__; + if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) { + cache = this.__data__ = new MapCache(cache.__data__); + } + cache.set(key, value); + return this; +} + +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to search. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + /** * The base implementation of `_.has` without support for deep paths. * @@ -382,6 +866,26 @@ function baseIsMatch(object, source, matchData, customizer) { return true; } +/** + * Creates a `_.toPairs` or `_.toPairsIn` function. + * + * @private + * @param {Function} keysFunc The function to get the keys of a given object. + * @returns {Function} Returns the new pairs function. + */ +function createToPairs(keysFunc) { + return function(object) { + var tag = getTag(object); + if (tag == mapTag) { + return mapToArray(object); + } + if (tag == setTag) { + return setToPairs(object); + } + return baseToPairs(object, keysFunc(object)); + }; +} + /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. @@ -397,9 +901,7 @@ function baseIsMatch(object, source, matchData, customizer) { * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { - var index = -1, - isPartial = bitmask & PARTIAL_COMPARE_FLAG, - isUnordered = bitmask & UNORDERED_COMPARE_FLAG, + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length; @@ -411,7 +913,10 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { if (stacked) { return stacked == other; } - var result = true; + var index = -1, + result = true, + seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined; + stack.set(array, other); // Ignore non-index properties. @@ -432,10 +937,12 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { break; } // Recursively compare arrays (susceptible to call stack limits). - if (isUnordered) { - if (!arraySome(other, function(othValue) { - return arrValue === othValue || - equalFunc(arrValue, othValue, customizer, bitmask, stack); + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!seen.has(othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + return seen.add(othIndex); + } })) { result = false; break; @@ -613,6 +1120,21 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { return result; } +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + /** * Gets the property names, values, and compare flags of `object`. * @@ -690,6 +1212,20 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || }; } +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * @@ -721,6 +1257,42 @@ function toSource(func) { return ''; } +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + /** * Checks if `value` is classified as an `Array` object. * @@ -952,7 +1524,8 @@ function isTypedArray(value) { /** * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `_.fromPairs`. + * which can be consumed by `_.fromPairs`. If `object` is a map or set, its + * entries are returned. * * @static * @memberOf _ @@ -960,7 +1533,7 @@ function isTypedArray(value) { * @alias entries * @category Object * @param {Object} object The object to query. - * @returns {Array} Returns the new array of key-value pairs. + * @returns {Array} Returns the key-value pairs. * @example * * function Foo() { @@ -973,8 +1546,6 @@ function isTypedArray(value) { * _.toPairs(new Foo); * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) */ -function toPairs(object) { - return baseToPairs(object, keys(object)); -} +var toPairs = createToPairs(keys); module.exports = isMatchWith; diff --git a/lodash.ismatchwith/package.json b/lodash.ismatchwith/package.json index fd0aa221b..6bb9cfa6b 100644 --- a/lodash.ismatchwith/package.json +++ b/lodash.ismatchwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.ismatchwith", - "version": "4.1.4", + "version": "4.2.0", "description": "The lodash method `_.isMatchWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._root": "~3.0.0", - "lodash._stack": "~4.1.0", "lodash.keys": "^4.0.0" } } diff --git a/lodash.iteratee/README.md b/lodash.iteratee/README.md index ed3255abb..737de8c4e 100644 --- a/lodash.iteratee/README.md +++ b/lodash.iteratee/README.md @@ -1,4 +1,4 @@ -# lodash.iteratee v4.1.1 +# lodash.iteratee v4.2.0 The [lodash](https://lodash.com/) method `_.iteratee` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var iteratee = require('lodash.iteratee'); ``` -See the [documentation](https://lodash.com/docs#iteratee) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.iteratee) for more details. +See the [documentation](https://lodash.com/docs#iteratee) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.iteratee) for more details. diff --git a/lodash.iteratee/index.js b/lodash.iteratee/index.js index 45b83d405..4608a8848 100644 --- a/lodash.iteratee/index.js +++ b/lodash.iteratee/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,21 +7,11 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), + baseIteratee = require('lodash._baseiteratee'), isBuffer = require('lodash.isbuffer'), keys = require('lodash.keys'), - root = require('lodash._root'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; + root = require('lodash._root'); /** `Object#toString` result references. */ var argsTag = '[object Arguments]', @@ -51,17 +41,9 @@ var arrayBufferTag = '[object ArrayBuffer]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - /** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; @@ -110,6 +92,27 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -211,7 +214,8 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, - getOwnPropertySymbols = Object.getOwnPropertySymbols; + getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), @@ -333,17 +337,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -357,130 +353,6 @@ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Creates a clone of `buffer`. * @@ -575,10 +447,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -631,8 +504,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -651,23 +527,6 @@ function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - /** * Gets the native function at `key` of `object`. * @@ -802,23 +661,6 @@ function initCloneByTag(object, tag, isDeep) { } } -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - /** * Checks if `value` is likely a prototype object. * @@ -833,33 +675,6 @@ function isPrototype(value) { return value === proto; } -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. @@ -899,7 +714,7 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -1025,30 +840,12 @@ function isNative(value) { (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - /** * Creates a function that invokes `func` with the arguments of the created * function. If `func` is a property name the created callback returns the * property value for a given element. If `func` is an object the created - * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. + * callback returns `true` for elements that contain the equivalent object + * properties, otherwise it returns `false`. * * @static * @memberOf _ @@ -1077,29 +874,4 @@ function iteratee(func) { return baseIteratee(typeof func == 'function' ? func : baseClone(func, true)); } -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = iteratee; diff --git a/lodash.iteratee/package.json b/lodash.iteratee/package.json index 480b5d130..454205cdc 100644 --- a/lodash.iteratee/package.json +++ b/lodash.iteratee/package.json @@ -1,6 +1,6 @@ { "name": "lodash.iteratee", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.iteratee` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,17 +15,11 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", + "lodash._baseiteratee": "^4.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", "lodash.isbuffer": "^4.0.0", - "lodash.keys": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash.keys": "^4.0.0" } } diff --git a/lodash.keyby/README.md b/lodash.keyby/README.md index 58d314527..5ea6517c3 100644 --- a/lodash.keyby/README.md +++ b/lodash.keyby/README.md @@ -1,4 +1,4 @@ -# lodash.keyby v4.1.1 +# lodash.keyby v4.2.0 The [lodash](https://lodash.com/) method `_.keyBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var keyBy = require('lodash.keyby'); ``` -See the [documentation](https://lodash.com/docs#keyBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.keyby) for more details. +See the [documentation](https://lodash.com/docs#keyBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.keyby) for more details. diff --git a/lodash.keyby/index.js b/lodash.keyby/index.js index 6c72c9aa6..109b672d4 100644 --- a/lodash.keyby/index.js +++ b/lodash.keyby/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,24 +7,7 @@ * Available under MIT license */ var baseEach = require('lodash._baseeach'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'); /** * A specialized version of `baseAggregator` for arrays. @@ -65,130 +48,6 @@ function baseAggregator(collection, setter, iteratee, accumulator) { return accumulator; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Creates a function like `_.groupBy`. * @@ -206,67 +65,6 @@ function createAggregator(setter, initializer) { }; } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates an object composed of keys generated from the results of running * each element of `collection` through `iteratee`. The corresponding value @@ -303,7 +101,7 @@ var keyBy = createAggregator(function(result, value, key) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -323,76 +121,4 @@ var keyBy = createAggregator(function(result, value, key) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = keyBy; diff --git a/lodash.keyby/package.json b/lodash.keyby/package.json index 4a21189d4..c62e445c2 100644 --- a/lodash.keyby/package.json +++ b/lodash.keyby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.keyby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.keyBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,11 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeach": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.keys/README.md b/lodash.keys/README.md index d8171c21f..45f812694 100644 --- a/lodash.keys/README.md +++ b/lodash.keys/README.md @@ -1,4 +1,4 @@ -# lodash.keys v4.1.0 +# lodash.keys v4.2.0 The [lodash](https://lodash.com/) method `_.keys` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var keys = require('lodash.keys'); ``` -See the [documentation](https://lodash.com/docs#keys) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.keys) for more details. +See the [documentation](https://lodash.com/docs#keys) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.keys) for more details. diff --git a/lodash.keys/index.js b/lodash.keys/index.js index 1753fb57e..dd238cc6d 100644 --- a/lodash.keys/index.js +++ b/lodash.keys/index.js @@ -13,25 +13,11 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + genTag = '[object GeneratorFunction]'; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -52,7 +38,7 @@ function baseTimes(n, iteratee) { } /** - * Creates a function that invokes `func` with its first argument transformed. + * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. @@ -73,7 +59,7 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -82,73 +68,53 @@ var objectToString = objectProto.toString; var propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetPrototype = Object.getPrototypeOf, - nativeKeys = Object.keys; +var nativeKeys = overArg(Object.keys, Object); /** - * The base implementation of `_.has` without support for deep paths. + * Creates an array of the enumerable property names of the array-like `value`. * * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. */ -function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; } /** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Gets the `[[Prototype]]` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {null|Object} Returns the `[[Prototype]]`. - */ -var getPrototype = overArg(nativeGetPrototype, Object); - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); } - return null; + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; } /** @@ -199,7 +165,7 @@ function isPrototype(value) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -255,7 +221,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -306,8 +272,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -315,16 +280,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -346,7 +310,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -402,33 +366,11 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -453,23 +395,7 @@ function isString(value) { * // => ['0', '1'] */ function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } module.exports = keys; diff --git a/lodash.keys/package.json b/lodash.keys/package.json index d08e4406d..f89494234 100644 --- a/lodash.keys/package.json +++ b/lodash.keys/package.json @@ -1,6 +1,6 @@ { "name": "lodash.keys", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.keys` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.keysin/README.md b/lodash.keysin/README.md index f0158bce7..69f94d03f 100644 --- a/lodash.keysin/README.md +++ b/lodash.keysin/README.md @@ -1,4 +1,4 @@ -# lodash.keysin v4.1.5 +# lodash.keysin v4.2.0 The [lodash](https://lodash.com/) method `_.keysIn` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var keysIn = require('lodash.keysin'); ``` -See the [documentation](https://lodash.com/docs#keysIn) or [package source](https://github.com/lodash/lodash/blob/4.1.5-npm-packages/lodash.keysin) for more details. +See the [documentation](https://lodash.com/docs#keysIn) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.keysin) for more details. diff --git a/lodash.keysin/index.js b/lodash.keysin/index.js index a8bd90669..765f7b620 100644 --- a/lodash.keysin/index.js +++ b/lodash.keysin/index.js @@ -13,34 +13,11 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + genTag = '[object GeneratorFunction]'; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -60,23 +37,6 @@ function baseTimes(n, iteratee) { return result; } -/** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ -function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -85,71 +45,63 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ -var Reflect = root.Reflect, - enumerate = Reflect ? Reflect.enumerate : undefined, - propertyIsEnumerable = objectProto.propertyIsEnumerable; +var propertyIsEnumerable = objectProto.propertyIsEnumerable; /** - * The base implementation of `_.keysIn` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + +/** + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { - object = object == null ? object : Object(object); + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; - var result = []; for (var key in object) { - result.push(key); + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } } return result; } -// Fallback for IE < 9 with es6-shim. -if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { - baseKeysIn = function(object) { - return iteratorToArray(enumerate(object)); - }; -} - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -179,6 +131,25 @@ function isPrototype(value) { return value === proto; } +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} + /** * Checks if `value` is likely an `arguments` object. * @@ -198,7 +169,7 @@ function isPrototype(value) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -254,7 +225,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -305,8 +276,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -314,16 +284,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -345,7 +314,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -401,28 +370,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * Creates an array of the own and inherited enumerable property names of `object`. * @@ -447,23 +394,7 @@ function isString(value) { * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { - var index = -1, - isProto = isPrototype(object), - props = baseKeysIn(object), - propsLength = props.length, - indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - while (++index < propsLength) { - var key = props[index]; - if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } module.exports = keysIn; diff --git a/lodash.keysin/package.json b/lodash.keysin/package.json index b661992b1..94d4c3074 100644 --- a/lodash.keysin/package.json +++ b/lodash.keysin/package.json @@ -1,6 +1,6 @@ { "name": "lodash.keysin", - "version": "4.1.5", + "version": "4.2.0", "description": "The lodash method `_.keysIn` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.lowercase/README.md b/lodash.lowercase/README.md index d019f81f0..6861f2c14 100644 --- a/lodash.lowercase/README.md +++ b/lodash.lowercase/README.md @@ -1,4 +1,4 @@ -# lodash.lowercase v4.1.1 +# lodash.lowercase v4.2.0 The [lodash](https://lodash.com/) method `_.lowerCase` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var lowerCase = require('lodash.lowercase'); ``` -See the [documentation](https://lodash.com/docs#lowerCase) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.lowercase) for more details. +See the [documentation](https://lodash.com/docs#lowerCase) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.lowercase) for more details. diff --git a/lodash.lowercase/index.js b/lodash.lowercase/index.js index b5b8bd8a0..b6d0c1ecd 100644 --- a/lodash.lowercase/index.js +++ b/lodash.lowercase/index.js @@ -1,26 +1,123 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var deburr = require('lodash.deburr'), - words = require('lodash.words'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Used to match non-compound words composed of alphanumeric characters. */ +var reBasicWord = /[a-zA-Z0-9]+/g; + +/** Used to match latin-1 supplementary letters (excluding mathematical operators). */ +var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', + rsComboSymbolsRange = '\\u20d0-\\u20f0', + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; /** Used to compose unicode capture groups. */ -var rsApos = "['\u2019]"; +var rsApos = "['\u2019]", + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', + rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq; /** Used to match apostrophes. */ var reApos = RegExp(rsApos, 'g'); +/** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ +var reComboMark = RegExp(rsCombo, 'g'); + +/** Used to match complex or compound words. */ +var reComplexWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', + rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, + rsUpper + '+' + rsOptUpperContr, + rsDigits, + rsEmoji +].join('|'), 'g'); + +/** Used to detect strings that need a more robust regexp to match words. */ +var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + +/** Used to map latin-1 supplementary letters to basic latin letters. */ +var deburredLetters = { + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss' +}; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as @@ -29,7 +126,7 @@ var reApos = RegExp(rsApos, 'g'); */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, - length = array.length; + length = array ? array.length : 0; if (initAccum && length) { accumulator = array[++index]; @@ -40,6 +137,65 @@ function arrayReduce(array, iteratee, accumulator, initAccum) { return accumulator; } +/** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ +var deburrLetter = basePropertyOf(deburredLetters); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + /** * Creates a function like `_.camelCase`. * @@ -53,6 +209,103 @@ function createCompounder(callback) { }; } +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +/** + * Deburrs `string` by converting + * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * to basic latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ +function deburr(string) { + string = toString(string); + return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); +} + /** * Converts `string`, as space separated words, to lower case. * @@ -77,4 +330,33 @@ var lowerCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toLowerCase(); }); +/** + * Splits `string` into an array of its words. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {RegExp|string} [pattern] The pattern to match words. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the words of `string`. + * @example + * + * _.words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + * _.words('fred, barney, & pebbles', /[^, ]+/g); + * // => ['fred', 'barney', '&', 'pebbles'] + */ +function words(string, pattern, guard) { + string = toString(string); + pattern = guard ? undefined : pattern; + + if (pattern === undefined) { + pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord; + } + return string.match(pattern) || []; +} + module.exports = lowerCase; diff --git a/lodash.lowercase/package.json b/lodash.lowercase/package.json index ff52e75ca..1bfe61d2b 100644 --- a/lodash.lowercase/package.json +++ b/lodash.lowercase/package.json @@ -1,6 +1,6 @@ { "name": "lodash.lowercase", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.lowerCase` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.deburr": "^4.0.0", - "lodash.words": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.lowerfirst/LICENSE b/lodash.lowerfirst/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.lowerfirst/LICENSE +++ b/lodash.lowerfirst/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.lowerfirst/README.md b/lodash.lowerfirst/README.md index cccb319c3..d02b07b97 100644 --- a/lodash.lowerfirst/README.md +++ b/lodash.lowerfirst/README.md @@ -1,4 +1,4 @@ -# lodash.lowerfirst v4.1.2 +# lodash.lowerfirst v4.2.0 The [lodash](https://lodash.com/) method `_.lowerFirst` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var lowerFirst = require('lodash.lowerfirst'); ``` -See the [documentation](https://lodash.com/docs#lowerFirst) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.lowerfirst) for more details. +See the [documentation](https://lodash.com/docs#lowerFirst) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.lowerfirst) for more details. diff --git a/lodash.lowerfirst/index.js b/lodash.lowerfirst/index.js index 7a66c7849..375380eb0 100644 --- a/lodash.lowerfirst/index.js +++ b/lodash.lowerfirst/index.js @@ -1,12 +1,13 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var toString = require('lodash.tostring'); +var baseSlice = require('lodash._baseslice'), + toString = require('lodash.tostring'); /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', @@ -48,12 +49,27 @@ function stringToArray(string) { return string.match(reComplexSymbol); } +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} + /** * Creates a function like `_.lowerFirst`. * * @private * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new case function. */ function createCaseFirst(methodName) { return function(string) { @@ -63,8 +79,13 @@ function createCaseFirst(methodName) { ? stringToArray(string) : undefined; - var chr = strSymbols ? strSymbols[0] : string.charAt(0), - trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1); + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); return chr[methodName]() + trailing; }; diff --git a/lodash.lowerfirst/package.json b/lodash.lowerfirst/package.json index db6608ca0..a127fd5f3 100644 --- a/lodash.lowerfirst/package.json +++ b/lodash.lowerfirst/package.json @@ -1,6 +1,6 @@ { "name": "lodash.lowerfirst", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.lowerFirst` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,13 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { + "lodash._baseslice": "~4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.map/README.md b/lodash.map/README.md index 7cb30b1b5..6211639fd 100644 --- a/lodash.map/README.md +++ b/lodash.map/README.md @@ -1,4 +1,4 @@ -# lodash.map v4.1.1 +# lodash.map v4.2.0 The [lodash](https://lodash.com/) method `_.map` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var map = require('lodash.map'); ``` -See the [documentation](https://lodash.com/docs#map) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.map) for more details. +See the [documentation](https://lodash.com/docs#map) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.map) for more details. diff --git a/lodash.map/index.js b/lodash.map/index.js index a289dd376..45dfb4256 100644 --- a/lodash.map/index.js +++ b/lodash.map/index.js @@ -1,23 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - baseEach = require('lodash._baseeach'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; +var baseEach = require('lodash._baseeach'), + baseIteratee = require('lodash._baseiteratee'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -26,13 +16,25 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -43,49 +45,6 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - /** * The base implementation of `_.map` without support for iteratee shorthands. * @@ -104,49 +63,6 @@ function baseMap(collection, iteratee) { return result; } -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.property` without support for deep paths. * @@ -160,31 +76,6 @@ function baseProperty(key) { }; } -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -197,67 +88,6 @@ function baseToPath(value) { */ var getLength = baseProperty('length'); -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates an array of values by running each element in `collection` through * `iteratee`. The iteratee is invoked with three arguments: @@ -309,7 +139,7 @@ function map(collection, iteratee) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -336,7 +166,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -408,7 +237,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -439,48 +269,4 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = map; diff --git a/lodash.map/package.json b/lodash.map/package.json index b1b018d8e..acf7798bd 100644 --- a/lodash.map/package.json +++ b/lodash.map/package.json @@ -1,6 +1,6 @@ { "name": "lodash.map", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.map` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,13 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash._baseeach": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.mapkeys/README.md b/lodash.mapkeys/README.md index 833ae6a63..62cffbd37 100644 --- a/lodash.mapkeys/README.md +++ b/lodash.mapkeys/README.md @@ -1,4 +1,4 @@ -# lodash.mapkeys v4.1.1 +# lodash.mapkeys v4.2.0 The [lodash](https://lodash.com/) method `_.mapKeys` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var mapKeys = require('lodash.mapkeys'); ``` -See the [documentation](https://lodash.com/docs#mapKeys) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.mapkeys) for more details. +See the [documentation](https://lodash.com/docs#mapKeys) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.mapkeys) for more details. diff --git a/lodash.mapkeys/index.js b/lodash.mapkeys/index.js index c434e31f2..0917e70cf 100644 --- a/lodash.mapkeys/index.js +++ b/lodash.mapkeys/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,25 +7,8 @@ * Available under MIT license */ var baseFor = require('lodash._basefor'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - keys = require('lodash.keys'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'), + keys = require('lodash.keys'); /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -39,248 +22,11 @@ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - /** * The opposite of `_.mapValues`; this method creates an object with the * same values as `object` and keys generated by running each own enumerable - * property of `object` through `iteratee`. + * property of `object` through `iteratee`. The iteratee is invoked with + * three arguments: (value, key, object). * * @static * @memberOf _ @@ -305,48 +51,4 @@ function mapKeys(object, iteratee) { return result; } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = mapKeys; diff --git a/lodash.mapkeys/package.json b/lodash.mapkeys/package.json index fd7e94c00..813fc21ef 100644 --- a/lodash.mapkeys/package.json +++ b/lodash.mapkeys/package.json @@ -1,6 +1,6 @@ { "name": "lodash.mapkeys", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.mapKeys` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,12 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefor": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.keys": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.keys": "^4.0.0" } } diff --git a/lodash.mapvalues/README.md b/lodash.mapvalues/README.md index a1dcc3361..2320c713d 100644 --- a/lodash.mapvalues/README.md +++ b/lodash.mapvalues/README.md @@ -1,4 +1,4 @@ -# lodash.mapvalues v4.1.1 +# lodash.mapvalues v4.2.0 The [lodash](https://lodash.com/) method `_.mapValues` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var mapValues = require('lodash.mapvalues'); ``` -See the [documentation](https://lodash.com/docs#mapValues) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.mapvalues) for more details. +See the [documentation](https://lodash.com/docs#mapValues) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.mapvalues) for more details. diff --git a/lodash.mapvalues/index.js b/lodash.mapvalues/index.js index 815b40823..4cf6a18a5 100644 --- a/lodash.mapvalues/index.js +++ b/lodash.mapvalues/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,25 +7,8 @@ * Available under MIT license */ var baseFor = require('lodash._basefor'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - keys = require('lodash.keys'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'), + keys = require('lodash.keys'); /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -39,248 +22,10 @@ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - /** * Creates an object with the same keys as `object` and values generated by * running each own enumerable property of `object` through `iteratee`. The - * iteratee function is invoked with three arguments: (value, key, object). + * iteratee is invoked with three arguments: (value, key, object). * * @static * @memberOf _ @@ -312,48 +57,4 @@ function mapValues(object, iteratee) { return result; } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = mapValues; diff --git a/lodash.mapvalues/package.json b/lodash.mapvalues/package.json index 51cc507fa..1623359b3 100644 --- a/lodash.mapvalues/package.json +++ b/lodash.mapvalues/package.json @@ -1,6 +1,6 @@ { "name": "lodash.mapvalues", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.mapValues` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,12 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefor": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.keys": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.keys": "^4.0.0" } } diff --git a/lodash.matches/README.md b/lodash.matches/README.md index ba29a62b2..86d22dabc 100644 --- a/lodash.matches/README.md +++ b/lodash.matches/README.md @@ -1,4 +1,4 @@ -# lodash.matches v4.1.1 +# lodash.matches v4.2.0 The [lodash](https://lodash.com/) method `_.matches` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var matches = require('lodash.matches'); ``` -See the [documentation](https://lodash.com/docs#matches) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.matches) for more details. +See the [documentation](https://lodash.com/docs#matches) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.matches) for more details. diff --git a/lodash.matches/index.js b/lodash.matches/index.js index 2a296e148..ab852aeac 100644 --- a/lodash.matches/index.js +++ b/lodash.matches/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,13 +7,17 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), - baseIsMatch = require('lodash._baseismatch'), isBuffer = require('lodash.isbuffer'), keys = require('lodash.keys'), - root = require('lodash._root'), - toPairs = require('lodash.topairs'); + root = require('lodash._root'); + +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', @@ -52,6 +56,21 @@ var reFlags = /\w*$/; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dateTag] = typedArrayTags[errorTag] = +typedArrayTags[funcTag] = typedArrayTags[mapTag] = +typedArrayTags[numberTag] = typedArrayTags[objectTag] = +typedArrayTags[regexpTag] = typedArrayTags[setTag] = +typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = @@ -94,6 +113,47 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -118,6 +178,42 @@ function arrayReduce(array, iteratee, accumulator, initAccum) { return accumulator; } +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; +} + +/** + * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array + * of key-value pairs for `object` corresponding to the property names of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the new array of key-value pairs. + */ +function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); +} + /** * Checks if `value` is a host object in IE < 9. * @@ -195,7 +291,9 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, - getOwnPropertySymbols = Object.getOwnPropertySymbols; + getPrototypeOf = Object.getPrototypeOf, + getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), @@ -317,17 +415,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -341,6 +431,159 @@ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototypeOf(object) === null); +} + +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @param {boolean} [bitmask] The bitmask of comparison flags. + * The bitmask may be composed of the following flags: + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ +function baseIsEqual(value, other, customizer, bitmask, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); +} + +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = arrayTag, + othTag = arrayTag; + + if (!objIsArr) { + objTag = getTag(object); + if (objTag == argsTag) { + objTag = objectTag; + } else if (objTag != objectTag) { + objIsArr = isTypedArray(object); + } + } + if (!othIsArr) { + othTag = getTag(other); + if (othTag == argsTag) { + othTag = objectTag; + } else if (othTag != objectTag) { + othIsArr = isTypedArray(other); + } + } + var objIsObj = objTag == objectTag && !isHostObject(object), + othIsObj = othTag == objectTag && !isHostObject(other), + isSameTag = objTag == othTag; + + if (isSameTag && !(objIsArr || objIsObj)) { + return equalByTag(object, other, objTag, equalFunc, customizer, bitmask); + } + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + if (!isPartial) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack); + return (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack); +} + +/** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ +function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new Stack, + result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; + + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) + : result + )) { + return false; + } + } + } + return true; +} + /** * The base implementation of `_.matches` which doesn't clone `source`. * @@ -461,10 +704,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -517,8 +761,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -537,6 +784,207 @@ function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Object} [stack] Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ +function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { + var index = -1, + isPartial = bitmask & PARTIAL_COMPARE_FLAG, + isUnordered = bitmask & UNORDERED_COMPARE_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked) { + return stacked == other; + } + var result = true; + stack.set(array, other); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (isUnordered) { + if (!arraySome(other, function(othValue) { + return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + result = false; + break; + } + } + stack['delete'](array); + return result; +} + +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { + switch (tag) { + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + // Coerce dates and booleans to numbers, dates to milliseconds and booleans + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + return +object == +other; + + case errorTag: + return object.name == other.name && object.message == other.message; + + case numberTag: + // Treat `NaN` vs. `NaN` as equal. + return (object != +object) ? other != +other : object == +other; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings primitives and string + // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + convert || (convert = setToArray); + + // Recursively compare objects (susceptible to call stack limits). + return (isPartial || object.size == other.size) && + equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG); + + case symbolTag: + return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); + } + return false; +} + +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + objProps = keys(object), + objLength = objProps.length, + othProps = keys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : baseHas(other, key))) { + return false; + } + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + var result = true; + stack.set(object, other); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + return result; +} + /** * Gets the property names, values, and compare flags of `object`. * @@ -753,7 +1201,7 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -797,6 +1245,35 @@ function isFunction(value) { return tag == funcTag || tag == genTag; } +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) @@ -880,9 +1357,56 @@ function isNative(value) { } /** - * Creates a function that performs a deep partial comparison between a given + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +function isTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; +} + +/** + * Creates an array of own enumerable key-value pairs for `object` which + * can be consumed by `_.fromPairs`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the new array of key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairs(new Foo); + * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) + */ +function toPairs(object) { + return baseToPairs(object, keys(object)); +} + +/** + * Creates a function that performs a partial deep comparison between a given * object and `source`, returning `true` if the given object has equivalent - * property values, else `false`. + * property values, else `false`. The created function is equivalent to + * `_.isMatch` with a `source` partially applied. * * **Note:** This method supports comparing the same values as `_.isEqual`. * diff --git a/lodash.matches/package.json b/lodash.matches/package.json index 9a082ccaf..9f12950c6 100644 --- a/lodash.matches/package.json +++ b/lodash.matches/package.json @@ -1,6 +1,6 @@ { "name": "lodash.matches", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.matches` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,13 +15,10 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", - "lodash._baseismatch": "^4.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", "lodash.isbuffer": "^4.0.0", - "lodash.keys": "^4.0.0", - "lodash.topairs": "^4.0.0" + "lodash.keys": "^4.0.0" } } diff --git a/lodash.matchesproperty/README.md b/lodash.matchesproperty/README.md index 4f64eb133..e1be42891 100644 --- a/lodash.matchesproperty/README.md +++ b/lodash.matchesproperty/README.md @@ -1,4 +1,4 @@ -# lodash.matchesproperty v4.1.1 +# lodash.matchesproperty v4.2.0 The [lodash](https://lodash.com/) method `_.matchesProperty` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var matchesProperty = require('lodash.matchesproperty'); ``` -See the [documentation](https://lodash.com/docs#matchesProperty) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.matchesproperty) for more details. +See the [documentation](https://lodash.com/docs#matchesProperty) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.matchesproperty) for more details. diff --git a/lodash.matchesproperty/index.js b/lodash.matchesproperty/index.js index d47d424c0..2d281c291 100644 --- a/lodash.matchesproperty/index.js +++ b/lodash.matchesproperty/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,19 +7,20 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), - baseIsEqual = require('lodash._baseisequal'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), + baseSlice = require('lodash._baseslice'), isBuffer = require('lodash.isbuffer'), keys = require('lodash.keys'), - root = require('lodash._root'); + root = require('lodash._root'), + toString = require('lodash.tostring'); /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', @@ -48,15 +49,41 @@ var arrayBufferTag = '[object ArrayBuffer]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; + /** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dateTag] = typedArrayTags[errorTag] = +typedArrayTags[funcTag] = typedArrayTags[mapTag] = +typedArrayTags[numberTag] = typedArrayTags[objectTag] = +typedArrayTags[regexpTag] = typedArrayTags[setTag] = +typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = @@ -99,6 +126,27 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -123,6 +171,27 @@ function arrayReduce(array, iteratee, accumulator, initAccum) { return accumulator; } +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; +} + /** * Checks if `value` is a host object in IE < 9. * @@ -142,6 +211,20 @@ function isHostObject(value) { return result; } +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; +} + /** * Converts `map` to an array. * @@ -200,7 +283,10 @@ var reIsNative = RegExp('^' + /** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, - getOwnPropertySymbols = Object.getOwnPropertySymbols; + getPrototypeOf = Object.getPrototypeOf, + getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create, + propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), @@ -248,6 +334,17 @@ function baseAssign(object, source) { return object && copyObject(source, keys(source), object); } +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + /** * The base implementation of `_.clone` and `_.cloneDeep` which tracks * traversed objects. @@ -322,17 +419,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -346,6 +435,138 @@ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototypeOf(object) === null); +} + +/** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHasIn(object, key) { + return key in Object(object); +} + +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @param {boolean} [bitmask] The bitmask of comparison flags. + * The bitmask may be composed of the following flags: + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ +function baseIsEqual(value, other, customizer, bitmask, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); +} + +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = arrayTag, + othTag = arrayTag; + + if (!objIsArr) { + objTag = getTag(object); + if (objTag == argsTag) { + objTag = objectTag; + } else if (objTag != objectTag) { + objIsArr = isTypedArray(object); + } + } + if (!othIsArr) { + othTag = getTag(other); + if (othTag == argsTag) { + othTag = objectTag; + } else if (othTag != objectTag) { + othIsArr = isTypedArray(other); + } + } + var objIsObj = objTag == objectTag && !isHostObject(object), + othIsObj = othTag == objectTag && !isHostObject(other), + isSameTag = objTag == othTag; + + if (isSameTag && !(objIsArr || objIsObj)) { + return equalByTag(object, other, objTag, equalFunc, customizer, bitmask); + } + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + if (!isPartial) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack); + return (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack); +} + /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * @@ -363,6 +584,19 @@ function baseMatchesProperty(path, srcValue) { }; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + /** * Creates a clone of `buffer`. * @@ -457,10 +691,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -513,8 +748,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -533,6 +771,219 @@ function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Object} [stack] Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ +function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { + var index = -1, + isPartial = bitmask & PARTIAL_COMPARE_FLAG, + isUnordered = bitmask & UNORDERED_COMPARE_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked) { + return stacked == other; + } + var result = true; + stack.set(array, other); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (isUnordered) { + if (!arraySome(other, function(othValue) { + return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + result = false; + break; + } + } + stack['delete'](array); + return result; +} + +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { + switch (tag) { + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + // Coerce dates and booleans to numbers, dates to milliseconds and booleans + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. + return +object == +other; + + case errorTag: + return object.name == other.name && object.message == other.message; + + case numberTag: + // Treat `NaN` vs. `NaN` as equal. + return (object != +object) ? other != +other : object == +other; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings primitives and string + // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + convert || (convert = setToArray); + + // Recursively compare objects (susceptible to call stack limits). + return (isPartial || object.size == other.size) && + equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG); + + case symbolTag: + return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); + } + return false; +} + +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + objProps = keys(object), + objLength = objProps.length, + othProps = keys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : baseHas(other, key))) { + return false; + } + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + var result = true; + stack.set(object, other); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + return result; +} + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + /** * Gets the native function at `key` of `object`. * @@ -588,6 +1039,35 @@ if ((Map && getTag(new Map) != mapTag) || }; } +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ +function hasPath(object, path, hasFunc) { + if (object == null) { + return false; + } + var result = hasFunc(object, path); + if (!result && !isKey(path)) { + path = baseCastPath(path); + object = parent(object, path); + if (object != null) { + path = last(path); + result = hasFunc(object, path); + } + } + var length = object ? object.length : undefined; + return result || ( + !!length && isLength(length) && isIndex(path, length) && + (isArray(object) || isString(object) || isArguments(object)) + ); +} + /** * Initializes an array clone. * @@ -667,6 +1147,23 @@ function initCloneByTag(object, tag, isDeep) { } } +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + if (typeof value == 'number') { + return true; + } + return !isArray(value) && + (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object))); +} + /** * Checks if `value` is likely a prototype object. * @@ -681,6 +1178,51 @@ function isPrototype(value) { return value === proto; } +/** + * Gets the parent value at `path` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path to get the parent value of. + * @returns {*} Returns the parent value. + */ +function parent(object, path) { + return path.length == 1 ? object : get(object, baseSlice(path, 0, -1)); +} + +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ +function stringToPath(string) { + var result = []; + toString(string).replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +} + +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; +} + /** * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. @@ -715,12 +1257,34 @@ function eq(value, other) { return value === other || (value !== value && other !== other); } +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -740,6 +1304,62 @@ function eq(value, other) { */ var isArray = Array.isArray; +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && + !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + /** * Checks if `value` is classified as a `Function` object. * @@ -764,6 +1384,35 @@ function isFunction(value) { return tag == funcTag || tag == genTag; } +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) @@ -847,7 +1496,107 @@ function isNative(value) { } /** - * Creates a function that performs a deep partial comparison between the + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +function isTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; +} + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + +/** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b.c'); + * // => true + * + * _.hasIn(object, ['a', 'b', 'c']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ +function hasIn(object, path) { + return hasPath(object, path, baseHasIn); +} + +/** + * Creates a function that performs a partial deep comparison between the * value at `path` of a given object to `srcValue`, returning `true` if the * object value is equivalent, else `false`. * diff --git a/lodash.matchesproperty/package.json b/lodash.matchesproperty/package.json index 79cb8369d..03079c124 100644 --- a/lodash.matchesproperty/package.json +++ b/lodash.matchesproperty/package.json @@ -1,6 +1,6 @@ { "name": "lodash.matchesproperty", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.matchesProperty` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,14 +15,12 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", - "lodash._baseisequal": "^4.0.0", + "lodash._baseslice": "^4.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", "lodash.isbuffer": "^4.0.0", - "lodash.keys": "^4.0.0" + "lodash.keys": "^4.0.0", + "lodash.tostring": "^4.0.0" } } diff --git a/lodash.maxby/README.md b/lodash.maxby/README.md index 2bd2b5ecb..4650435a2 100644 --- a/lodash.maxby/README.md +++ b/lodash.maxby/README.md @@ -1,4 +1,4 @@ -# lodash.maxby v4.1.1 +# lodash.maxby v4.2.0 The [lodash](https://lodash.com/) method `_.maxBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var maxBy = require('lodash.maxby'); ``` -See the [documentation](https://lodash.com/docs#maxBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.maxby) for more details. +See the [documentation](https://lodash.com/docs#maxBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.maxby) for more details. diff --git a/lodash.maxby/index.js b/lodash.maxby/index.js index 545e2cc84..1a66552f2 100644 --- a/lodash.maxby/index.js +++ b/lodash.maxby/index.js @@ -1,29 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +var baseIteratee = require('lodash._baseiteratee'); /** * The base implementation of methods like `_.max` and `_.min` which accepts a @@ -54,191 +37,6 @@ function baseExtremum(array, iteratee, comparator) { return result; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Checks if `value` is greater than `other`. * @@ -263,103 +61,6 @@ function gt(value, other) { return value > other; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - /** * This method is like `_.max` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which diff --git a/lodash.maxby/package.json b/lodash.maxby/package.json index c4686054b..579ac56ef 100644 --- a/lodash.maxby/package.json +++ b/lodash.maxby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.maxby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.maxBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,11 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.merge/README.md b/lodash.merge/README.md index b4a371323..9a93bd759 100644 --- a/lodash.merge/README.md +++ b/lodash.merge/README.md @@ -1,4 +1,4 @@ -# lodash.merge v4.1.1 +# lodash.merge v4.2.0 The [lodash](https://lodash.com/) method `_.merge` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var merge = require('lodash.merge'); ``` -See the [documentation](https://lodash.com/docs#merge) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.merge) for more details. +See the [documentation](https://lodash.com/docs#merge) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.merge) for more details. diff --git a/lodash.merge/index.js b/lodash.merge/index.js index 6399a54e5..088df336d 100644 --- a/lodash.merge/index.js +++ b/lodash.merge/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), isBuffer = require('lodash.isbuffer'), isPlainObject = require('lodash.isplainobject'), @@ -116,6 +115,27 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -232,6 +252,7 @@ var reIsNative = RegExp('^' + var Symbol = root.Symbol, Uint8Array = root.Uint8Array, getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references that are verified to be native. */ @@ -369,17 +390,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -407,7 +420,10 @@ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } - var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source); + var props = (isArray(source) || isTypedArray(source)) + ? undefined + : keysIn(source); + arrayEach(props || source, function(srcValue, key) { if (props) { key = srcValue; @@ -418,7 +434,10 @@ function baseMerge(object, source, srcIndex, customizer, stack) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { - var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; + var newValue = customizer + ? customizer(object[key], srcValue, (key + ''), object, source, stack) + : undefined; + if (newValue === undefined) { newValue = srcValue; } @@ -450,21 +469,24 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta assignMergeValue(object, key, stacked); return; } - var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined, - isCommon = newValue === undefined; + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; if (isCommon) { newValue = srcValue; if (isArray(srcValue) || isTypedArray(srcValue)) { if (isArray(objValue)) { - newValue = srcIndex ? copyArray(objValue) : objValue; + newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { @@ -473,10 +495,10 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta } else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } else { - newValue = srcIndex ? baseClone(objValue) : objValue; + newValue = objValue; } } else { @@ -599,10 +621,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -655,8 +678,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -689,7 +715,10 @@ function createAssigner(assigner) { customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; - customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; + customizer = typeof customizer == 'function' + ? (length--, customizer) + : undefined; + if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; @@ -948,7 +977,7 @@ function isArguments(value) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -975,7 +1004,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -1004,7 +1032,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -1075,7 +1102,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -1177,7 +1205,8 @@ function isNative(value) { * // => false */ function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } /** @@ -1208,12 +1237,12 @@ function toPlainObject(value) { } /** - * Recursively merges own and inherited enumerable properties of source - * objects into the destination object, skipping source properties that resolve - * to `undefined`. Array and plain object properties are merged recursively. - * Other objects and value types are overridden by assignment. Source objects - * are applied from left to right. Subsequent sources overwrite property - * assignments of previous sources. + * Recursively merges own and inherited enumerable properties of source objects + * into the destination object. Source properties that resolve to `undefined` + * are skipped if a destination value exists. Array and plain object properties + * are merged recursively. Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * diff --git a/lodash.merge/package.json b/lodash.merge/package.json index 71ad0ba99..23c0a04c2 100644 --- a/lodash.merge/package.json +++ b/lodash.merge/package.json @@ -1,6 +1,6 @@ { "name": "lodash.merge", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.merge` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", diff --git a/lodash.mergewith/README.md b/lodash.mergewith/README.md index 96e144e73..47038580f 100644 --- a/lodash.mergewith/README.md +++ b/lodash.mergewith/README.md @@ -1,4 +1,4 @@ -# lodash.mergewith v4.1.1 +# lodash.mergewith v4.2.0 The [lodash](https://lodash.com/) method `_.mergeWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var mergeWith = require('lodash.mergewith'); ``` -See the [documentation](https://lodash.com/docs#mergeWith) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.mergewith) for more details. +See the [documentation](https://lodash.com/docs#mergeWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.mergewith) for more details. diff --git a/lodash.mergewith/index.js b/lodash.mergewith/index.js index 88361714c..71d34ab0b 100644 --- a/lodash.mergewith/index.js +++ b/lodash.mergewith/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var Stack = require('lodash._stack'), - arrayEach = require('lodash._arrayeach'), baseFor = require('lodash._basefor'), isBuffer = require('lodash.isbuffer'), isPlainObject = require('lodash.isplainobject'), @@ -116,6 +115,27 @@ function addSetEntry(set, value) { return set; } +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. @@ -232,6 +252,7 @@ var reIsNative = RegExp('^' + var Symbol = root.Symbol, Uint8Array = root.Uint8Array, getOwnPropertySymbols = Object.getOwnPropertySymbols, + objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references that are verified to be native. */ @@ -369,17 +390,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -407,7 +420,10 @@ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } - var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source); + var props = (isArray(source) || isTypedArray(source)) + ? undefined + : keysIn(source); + arrayEach(props || source, function(srcValue, key) { if (props) { key = srcValue; @@ -418,7 +434,10 @@ function baseMerge(object, source, srcIndex, customizer, stack) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { - var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; + var newValue = customizer + ? customizer(object[key], srcValue, (key + ''), object, source, stack) + : undefined; + if (newValue === undefined) { newValue = srcValue; } @@ -450,21 +469,24 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta assignMergeValue(object, key, stacked); return; } - var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined, - isCommon = newValue === undefined; + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; if (isCommon) { newValue = srcValue; if (isArray(srcValue) || isTypedArray(srcValue)) { if (isArray(objValue)) { - newValue = srcIndex ? copyArray(objValue) : objValue; + newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { @@ -473,10 +495,10 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta } else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { isCommon = false; - newValue = baseClone(srcValue); + newValue = baseClone(srcValue, true); } else { - newValue = srcIndex ? baseClone(objValue) : objValue; + newValue = objValue; } } else { @@ -599,10 +621,11 @@ function cloneSymbol(symbol) { * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = typedArray.buffer, + var arrayBuffer = typedArray.buffer, + buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer, Ctor = typedArray.constructor; - return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); + return new Ctor(buffer, typedArray.byteOffset, typedArray.length); } /** @@ -655,8 +678,11 @@ function copyObjectWith(source, props, object, customizer) { length = props.length; while (++index < length) { - var key = props[index], - newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key]; + var key = props[index]; + + var newValue = customizer + ? customizer(object[key], source[key], key, object, source) + : source[key]; assignValue(object, key, newValue); } @@ -689,7 +715,10 @@ function createAssigner(assigner) { customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; - customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; + customizer = typeof customizer == 'function' + ? (length--, customizer) + : undefined; + if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; @@ -948,7 +977,7 @@ function isArguments(value) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -975,7 +1004,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -1004,7 +1032,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -1075,7 +1102,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -1177,7 +1205,8 @@ function isNative(value) { * // => false */ function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } /** diff --git a/lodash.mergewith/package.json b/lodash.mergewith/package.json index 75183c7ee..faa8f1ec8 100644 --- a/lodash.mergewith/package.json +++ b/lodash.mergewith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.mergewith", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.mergeWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", "lodash._root": "^3.0.0", "lodash._stack": "^4.0.0", diff --git a/lodash.method/README.md b/lodash.method/README.md index 0ecf0d324..f11a80b1c 100644 --- a/lodash.method/README.md +++ b/lodash.method/README.md @@ -1,4 +1,4 @@ -# lodash.method v4.1.1 +# lodash.method v4.2.0 The [lodash](https://lodash.com/) method `_.method` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var method = require('lodash.method'); ``` -See the [documentation](https://lodash.com/docs#method) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.method) for more details. +See the [documentation](https://lodash.com/docs#method) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.method) for more details. diff --git a/lodash.method/index.js b/lodash.method/index.js index 9311ac85f..ad6e561b1 100644 --- a/lodash.method/index.js +++ b/lodash.method/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), rest = require('lodash.rest'), toString = require('lodash.tostring'); @@ -40,6 +39,37 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + /** * The base implementation of `_.invoke` without support for individual * method arguments. @@ -52,7 +82,7 @@ function apply(func, thisArg, args) { */ function baseInvoke(object, path, args) { if (!isKey(path, object)) { - path = baseToPath(path); + path = baseCastPath(path); object = parent(object, path); path = last(path); } @@ -60,18 +90,6 @@ function baseInvoke(object, path, args) { return func == null ? undefined : apply(func, object, args); } -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Checks if `value` is a property name and not a property path. * @@ -139,7 +157,7 @@ function last(array) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -159,6 +177,35 @@ function last(array) { */ var isArray = Array.isArray; +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + /** * Creates a function that invokes the method at `path` of a given object. * Any additional arguments are provided to the invoked method. diff --git a/lodash.method/package.json b/lodash.method/package.json index 0e5e74640..82cbb4bd3 100644 --- a/lodash.method/package.json +++ b/lodash.method/package.json @@ -1,6 +1,6 @@ { "name": "lodash.method", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.method` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", "lodash.rest": "^4.0.0", "lodash.tostring": "^4.0.0" } diff --git a/lodash.methodof/README.md b/lodash.methodof/README.md index c24af19d6..d714244b2 100644 --- a/lodash.methodof/README.md +++ b/lodash.methodof/README.md @@ -1,4 +1,4 @@ -# lodash.methodof v4.1.1 +# lodash.methodof v4.2.0 The [lodash](https://lodash.com/) method `_.methodOf` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var methodOf = require('lodash.methodof'); ``` -See the [documentation](https://lodash.com/docs#methodOf) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.methodof) for more details. +See the [documentation](https://lodash.com/docs#methodOf) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.methodof) for more details. diff --git a/lodash.methodof/index.js b/lodash.methodof/index.js index 4d76a3945..479a70bd5 100644 --- a/lodash.methodof/index.js +++ b/lodash.methodof/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), rest = require('lodash.rest'), toString = require('lodash.tostring'); @@ -40,6 +39,37 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { + return isArray(value) ? value : stringToPath(value); +} + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + /** * The base implementation of `_.invoke` without support for individual * method arguments. @@ -52,7 +82,7 @@ function apply(func, thisArg, args) { */ function baseInvoke(object, path, args) { if (!isKey(path, object)) { - path = baseToPath(path); + path = baseCastPath(path); object = parent(object, path); path = last(path); } @@ -60,18 +90,6 @@ function baseInvoke(object, path, args) { return func == null ? undefined : apply(func, object, args); } -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Checks if `value` is a property name and not a property path. * @@ -139,7 +157,7 @@ function last(array) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -159,6 +177,35 @@ function last(array) { */ var isArray = Array.isArray; +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + /** * The opposite of `_.method`; this method creates a function that invokes * the method at a given path of `object`. Any additional arguments are diff --git a/lodash.methodof/package.json b/lodash.methodof/package.json index d8736120c..5a6e023db 100644 --- a/lodash.methodof/package.json +++ b/lodash.methodof/package.json @@ -1,6 +1,6 @@ { "name": "lodash.methodof", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.methodOf` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", "lodash.rest": "^4.0.0", "lodash.tostring": "^4.0.0" } diff --git a/lodash.minby/README.md b/lodash.minby/README.md index 1b733c1c7..5b93a915e 100644 --- a/lodash.minby/README.md +++ b/lodash.minby/README.md @@ -1,4 +1,4 @@ -# lodash.minby v4.1.1 +# lodash.minby v4.2.0 The [lodash](https://lodash.com/) method `_.minBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var minBy = require('lodash.minby'); ``` -See the [documentation](https://lodash.com/docs#minBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.minby) for more details. +See the [documentation](https://lodash.com/docs#minBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.minby) for more details. diff --git a/lodash.minby/index.js b/lodash.minby/index.js index fb59457eb..d3dc507ed 100644 --- a/lodash.minby/index.js +++ b/lodash.minby/index.js @@ -1,29 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +var baseIteratee = require('lodash._baseiteratee'); /** * The base implementation of methods like `_.max` and `_.min` which accepts a @@ -54,244 +37,6 @@ function baseExtremum(array, iteratee, comparator) { return result; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - /** * Checks if `value` is less than `other`. * @@ -316,50 +61,6 @@ function lt(value, other) { return value < other; } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - /** * This method is like `_.min` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which diff --git a/lodash.minby/package.json b/lodash.minby/package.json index 7c8f4e0ea..d9f67e6bb 100644 --- a/lodash.minby/package.json +++ b/lodash.minby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.minby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.minBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,11 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.mixin/README.md b/lodash.mixin/README.md index ba18ff76c..9b3e423ca 100644 --- a/lodash.mixin/README.md +++ b/lodash.mixin/README.md @@ -1,4 +1,4 @@ -# lodash.mixin v4.1.2 +# lodash.mixin v4.2.0 The [lodash](https://lodash.com/) method `_.mixin` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var mixin = require('lodash.mixin'); ``` -See the [documentation](https://lodash.com/docs#mixin) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.mixin) for more details. +See the [documentation](https://lodash.com/docs#mixin) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.mixin) for more details. diff --git a/lodash.mixin/index.js b/lodash.mixin/index.js index 2f27c5599..7cbab022f 100644 --- a/lodash.mixin/index.js +++ b/lodash.mixin/index.js @@ -6,24 +6,31 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var keys = require('lodash.keys'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + stringTag = '[object String]'; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { if (iteratee(array[index], index, array) === false) { @@ -38,13 +45,13 @@ function arrayEach(array, iteratee) { * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, - length = array.length, + length = array ? array.length : 0, resIndex = 0, result = []; @@ -76,9 +83,58 @@ function arrayPush(array, values) { return array; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +/** + * Creates a function that invokes `func` with its first argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + /** Used for built-in method references. */ var objectProto = Object.prototype; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) @@ -86,6 +142,13 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetPrototype = Object.getPrototypeOf, + nativeKeys = Object.keys; + /** * The base implementation of `_.functions` which creates an array of * `object` function property names filtered from `props`. @@ -101,6 +164,33 @@ function baseFunctions(object, props) { }); } +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return object != null && + (hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null)); +} + +/** + * The base implementation of `_.keys` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +var baseKeys = overArg(nativeKeys, Object); + /** * Copies the values of `source` to `array`. * @@ -120,6 +210,181 @@ function copyArray(source, array) { return array; } +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ +var getPrototype = overArg(nativeGetPrototype, Object); + +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + /** * Checks if `value` is classified as a `Function` object. * @@ -128,8 +393,7 @@ function copyArray(source, array) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -146,6 +410,38 @@ function isFunction(value) { return tag == funcTag || tag == genTag; } +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) @@ -176,6 +472,104 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + var isProto = isPrototype(object); + if (!(isProto || isArrayLike(object))) { + return baseKeys(object); + } + var indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + for (var key in object) { + if (baseHas(object, key) && + !(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(isProto && key == 'constructor')) { + result.push(key); + } + } + return result; +} + /** * Adds all own enumerable string keyed function properties of a source * object to the destination object. If `object` is a function, then methods diff --git a/lodash.mixin/package.json b/lodash.mixin/package.json index 710a4cd9c..8b06d89a1 100644 --- a/lodash.mixin/package.json +++ b/lodash.mixin/package.json @@ -1,6 +1,6 @@ { "name": "lodash.mixin", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.mixin` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,8 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.keys": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.ntharg/README.md b/lodash.ntharg/README.md index c38439f8a..79323ebed 100644 --- a/lodash.ntharg/README.md +++ b/lodash.ntharg/README.md @@ -1,4 +1,4 @@ -# lodash.ntharg v4.1.1 +# lodash.ntharg v4.2.0 The [lodash](https://lodash.com/) method `_.nthArg` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var nthArg = require('lodash.ntharg'); ``` -See the [documentation](https://lodash.com/docs#nthArg) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.ntharg) for more details. +See the [documentation](https://lodash.com/docs#nthArg) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.ntharg) for more details. diff --git a/lodash.ntharg/index.js b/lodash.ntharg/index.js index d39198261..6b3584e57 100644 --- a/lodash.ntharg/index.js +++ b/lodash.ntharg/index.js @@ -6,7 +6,6 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var rest = require('lodash.rest'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, @@ -37,6 +36,26 @@ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -47,8 +66,11 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + /** - * The base implementation of `_.nth` which doesn't coerce `n` to an integer. + * The base implementation of `_.nth` which doesn't coerce arguments. * * @private * @param {Array} array The array to query. @@ -64,6 +86,35 @@ function baseNth(array, n) { return isIndex(n, length) ? array[n] : undefined; } +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + /** * Checks if `value` is a valid array-like index. * @@ -87,8 +138,7 @@ function isIndex(value, length) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -171,8 +221,7 @@ function isObjectLike(value) { * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); @@ -224,7 +273,7 @@ function toFinite(value) { /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on + * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static @@ -299,7 +348,7 @@ function toNumber(value) { } /** - * Creates a function that gets the argument at `n` index. If `n` is negative, + * Creates a function that gets the argument at index `n`. If `n` is negative, * the nth argument from the end is returned. * * @static @@ -320,7 +369,7 @@ function toNumber(value) { */ function nthArg(n) { n = toInteger(n); - return rest(function(args) { + return baseRest(function(args) { return baseNth(args, n); }); } diff --git a/lodash.ntharg/package.json b/lodash.ntharg/package.json index 651830643..ef04400e3 100644 --- a/lodash.ntharg/package.json +++ b/lodash.ntharg/package.json @@ -1,6 +1,6 @@ { "name": "lodash.ntharg", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.nthArg` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,8 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.rest": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.omit/README.md b/lodash.omit/README.md index af8ffce26..b3d7bab8e 100644 --- a/lodash.omit/README.md +++ b/lodash.omit/README.md @@ -1,4 +1,4 @@ -# lodash.omit v4.1.2 +# lodash.omit v4.2.0 The [lodash](https://lodash.com/) method `_.omit` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var omit = require('lodash.omit'); ``` -See the [documentation](https://lodash.com/docs#omit) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.omit) for more details. +See the [documentation](https://lodash.com/docs#omit) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.omit) for more details. diff --git a/lodash.omit/index.js b/lodash.omit/index.js index a835aa3a5..82d7dfdc3 100644 --- a/lodash.omit/index.js +++ b/lodash.omit/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -82,7 +82,8 @@ function arrayReduce(array, iteratee, accumulator, initAccum) { var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; diff --git a/lodash.omit/package.json b/lodash.omit/package.json index 47388fd48..1e4026b40 100644 --- a/lodash.omit/package.json +++ b/lodash.omit/package.json @@ -1,6 +1,6 @@ { "name": "lodash.omit", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.omit` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basedifference": "~4.4.0", - "lodash._baseflatten": "~4.1.0", + "lodash._baseflatten": "~4.2.0", "lodash.keysin": "^4.0.0", "lodash.rest": "^4.0.0" } diff --git a/lodash.omitby/README.md b/lodash.omitby/README.md index f0cb5f001..6f9f4de74 100644 --- a/lodash.omitby/README.md +++ b/lodash.omitby/README.md @@ -1,4 +1,4 @@ -# lodash.omitby v4.1.1 +# lodash.omitby v4.2.0 The [lodash](https://lodash.com/) method `_.omitBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var omitBy = require('lodash.omitby'); ``` -See the [documentation](https://lodash.com/docs#omitBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.omitby) for more details. +See the [documentation](https://lodash.com/docs#omitBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.omitby) for more details. diff --git a/lodash.omitby/index.js b/lodash.omitby/index.js index 2eeef3af3..7fdd16fc0 100644 --- a/lodash.omitby/index.js +++ b/lodash.omitby/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,25 +7,8 @@ * Available under MIT license */ var baseFor = require('lodash._basefor'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - keysIn = require('lodash.keysin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'), + keysIn = require('lodash.keysin'); /** * The base implementation of `_.forIn` without support for iteratee shorthands. @@ -39,92 +22,6 @@ function baseForIn(object, iteratee) { return object == null ? object : baseFor(object, iteratee, keysIn); } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * @@ -143,158 +40,6 @@ function basePickBy(object, predicate) { return result; } -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - /** * The opposite of `_.pickBy`; this method creates an object composed of the * own and inherited enumerable properties of `object` that `predicate` @@ -320,48 +65,4 @@ function omitBy(object, predicate) { }); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = omitBy; diff --git a/lodash.omitby/package.json b/lodash.omitby/package.json index f77251a46..ffe29b8d0 100644 --- a/lodash.omitby/package.json +++ b/lodash.omitby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.omitby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.omitBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,12 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefor": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.keysin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.keysin": "^4.0.0" } } diff --git a/lodash.orderby/README.md b/lodash.orderby/README.md index d17f5a9d9..bc43bb894 100644 --- a/lodash.orderby/README.md +++ b/lodash.orderby/README.md @@ -1,4 +1,4 @@ -# lodash.orderby v4.1.1 +# lodash.orderby v4.2.0 The [lodash](https://lodash.com/) method `_.orderBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var orderBy = require('lodash.orderby'); ``` -See the [documentation](https://lodash.com/docs#orderBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.orderby) for more details. +See the [documentation](https://lodash.com/docs#orderBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.orderby) for more details. diff --git a/lodash.orderby/index.js b/lodash.orderby/index.js index 19e77044e..aff4336f8 100644 --- a/lodash.orderby/index.js +++ b/lodash.orderby/index.js @@ -1,23 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - baseEach = require('lodash._baseeach'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; +var baseEach = require('lodash._baseeach'), + baseIteratee = require('lodash._baseiteratee'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -26,13 +16,25 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} /** * The base implementation of `_.sortBy` which uses `comparer` to define @@ -136,49 +138,6 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - /** * The base implementation of `_.map` without support for iteratee shorthands. * @@ -197,49 +156,6 @@ function baseMap(collection, iteratee) { return result; } -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.orderBy` without param guards. * @@ -282,31 +198,6 @@ function baseProperty(key) { }; } -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -319,67 +210,6 @@ function baseToPath(value) { */ var getLength = baseProperty('length'); -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * This method is like `_.sortBy` except that it allows specifying the sort * orders of the iteratees to sort by. If `orders` is unspecified, all values @@ -426,7 +256,7 @@ function orderBy(collection, iteratees, orders, guard) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -453,7 +283,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -525,7 +354,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -556,48 +386,4 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = orderBy; diff --git a/lodash.orderby/package.json b/lodash.orderby/package.json index b6ad4a8e4..2e0874544 100644 --- a/lodash.orderby/package.json +++ b/lodash.orderby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.orderby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.orderBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,13 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash._baseeach": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.over/README.md b/lodash.over/README.md index 2fb69e9be..6a740f5c5 100644 --- a/lodash.over/README.md +++ b/lodash.over/README.md @@ -1,4 +1,4 @@ -# lodash.over v4.1.1 +# lodash.over v4.2.0 The [lodash](https://lodash.com/) method `_.over` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var over = require('lodash.over'); ``` -See the [documentation](https://lodash.com/docs#over) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.over) for more details. +See the [documentation](https://lodash.com/docs#over) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.over) for more details. diff --git a/lodash.over/index.js b/lodash.over/index.js index d229c8e90..f316e34df 100644 --- a/lodash.over/index.js +++ b/lodash.over/index.js @@ -1,32 +1,14 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - baseFlatten = require('lodash._baseflatten'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +var baseFlatten = require('lodash._baseflatten'), + baseIteratee = require('lodash._baseiteratee'), + rest = require('lodash.rest'); /** * A faster alternative to `Function#apply`, this function invokes `func` @@ -50,127 +32,23 @@ function apply(func, thisArg, args) { } /** - * The base implementation of `_.get` without support for default values. + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. * * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; + while (++index < length) { + result[index] = iteratee(array[index], index, array); } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); + return result; } /** @@ -182,7 +60,7 @@ function baseToPath(value) { */ function createOver(arrayFunc) { return rest(function(iteratees) { - iteratees = arrayMap(baseFlatten(iteratees), baseIteratee); + iteratees = arrayMap(baseFlatten(iteratees, 1), baseIteratee); return rest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { @@ -192,139 +70,6 @@ function createOver(arrayFunc) { }); } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - /** * Creates a function that invokes `iteratees` with the arguments provided * to the created function and returns their results. @@ -343,29 +88,4 @@ function identity(value) { */ var over = createOver(arrayMap); -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = over; diff --git a/lodash.over/package.json b/lodash.over/package.json index 4082d3d32..f3c24e922 100644 --- a/lodash.over/package.json +++ b/lodash.over/package.json @@ -1,6 +1,6 @@ { "name": "lodash.over", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.over` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,14 +15,8 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash._baseflatten": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.overargs/README.md b/lodash.overargs/README.md index ca9463361..767b74ae0 100644 --- a/lodash.overargs/README.md +++ b/lodash.overargs/README.md @@ -1,4 +1,4 @@ -# lodash.overargs v4.1.1 +# lodash.overargs v4.2.0 The [lodash](https://lodash.com/) method `_.overArgs` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var overArgs = require('lodash.overargs'); ``` -See the [documentation](https://lodash.com/docs#overArgs) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.overargs) for more details. +See the [documentation](https://lodash.com/docs#overArgs) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.overargs) for more details. diff --git a/lodash.overargs/index.js b/lodash.overargs/index.js index 965a5b91a..fb689d0bf 100644 --- a/lodash.overargs/index.js +++ b/lodash.overargs/index.js @@ -1,32 +1,14 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - baseFlatten = require('lodash._baseflatten'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +var baseFlatten = require('lodash._baseflatten'), + baseIteratee = require('lodash._baseiteratee'), + rest = require('lodash.rest'); /** * A faster alternative to `Function#apply`, this function invokes `func` @@ -49,194 +31,29 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMin = Math.min; -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates a function that invokes `func` with arguments transformed by * corresponding `transforms`. @@ -269,7 +86,7 @@ function stringToPath(string) { * // => [100, 10] */ var overArgs = rest(function(func, transforms) { - transforms = arrayMap(baseFlatten(transforms), baseIteratee); + transforms = arrayMap(baseFlatten(transforms, 1), baseIteratee); var funcsLength = transforms.length; return rest(function(args) { @@ -283,101 +100,4 @@ var overArgs = rest(function(func, transforms) { }); }); -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = overArgs; diff --git a/lodash.overargs/package.json b/lodash.overargs/package.json index 88672280f..cf9857a12 100644 --- a/lodash.overargs/package.json +++ b/lodash.overargs/package.json @@ -1,6 +1,6 @@ { "name": "lodash.overargs", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.overArgs` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,14 +15,8 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash._baseflatten": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.overevery/README.md b/lodash.overevery/README.md index d05994722..52370aa52 100644 --- a/lodash.overevery/README.md +++ b/lodash.overevery/README.md @@ -1,4 +1,4 @@ -# lodash.overevery v4.1.1 +# lodash.overevery v4.2.0 The [lodash](https://lodash.com/) method `_.overEvery` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var overEvery = require('lodash.overevery'); ``` -See the [documentation](https://lodash.com/docs#overEvery) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.overevery) for more details. +See the [documentation](https://lodash.com/docs#overEvery) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.overevery) for more details. diff --git a/lodash.overevery/index.js b/lodash.overevery/index.js index 158a9dc40..f04d5977e 100644 --- a/lodash.overevery/index.js +++ b/lodash.overevery/index.js @@ -1,32 +1,14 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - baseFlatten = require('lodash._baseflatten'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +var baseFlatten = require('lodash._baseflatten'), + baseIteratee = require('lodash._baseiteratee'), + rest = require('lodash.rest'); /** * A faster alternative to `Function#apply`, this function invokes `func` @@ -71,127 +53,23 @@ function arrayEvery(array, predicate) { } /** - * The base implementation of `_.get` without support for default values. + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. * * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; + while (++index < length) { + result[index] = iteratee(array[index], index, array); } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); + return result; } /** @@ -203,7 +81,7 @@ function baseToPath(value) { */ function createOver(arrayFunc) { return rest(function(iteratees) { - iteratees = arrayMap(baseFlatten(iteratees), baseIteratee); + iteratees = arrayMap(baseFlatten(iteratees, 1), baseIteratee); return rest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { @@ -213,139 +91,6 @@ function createOver(arrayFunc) { }); } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - /** * Creates a function that checks if **all** of the `predicates` return * truthy when invoked with the arguments provided to the created function. @@ -370,29 +115,4 @@ function identity(value) { */ var overEvery = createOver(arrayEvery); -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = overEvery; diff --git a/lodash.overevery/package.json b/lodash.overevery/package.json index 210cdab42..f41bed46b 100644 --- a/lodash.overevery/package.json +++ b/lodash.overevery/package.json @@ -1,6 +1,6 @@ { "name": "lodash.overevery", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.overEvery` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,14 +15,8 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash._baseflatten": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.oversome/README.md b/lodash.oversome/README.md index ea0be2a62..467db623d 100644 --- a/lodash.oversome/README.md +++ b/lodash.oversome/README.md @@ -1,4 +1,4 @@ -# lodash.oversome v4.1.1 +# lodash.oversome v4.2.0 The [lodash](https://lodash.com/) method `_.overSome` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var overSome = require('lodash.oversome'); ``` -See the [documentation](https://lodash.com/docs#overSome) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.oversome) for more details. +See the [documentation](https://lodash.com/docs#overSome) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.oversome) for more details. diff --git a/lodash.oversome/index.js b/lodash.oversome/index.js index 48c225386..a1f1a123e 100644 --- a/lodash.oversome/index.js +++ b/lodash.oversome/index.js @@ -1,32 +1,14 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - baseFlatten = require('lodash._baseflatten'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +var baseFlatten = require('lodash._baseflatten'), + baseIteratee = require('lodash._baseiteratee'), + rest = require('lodash.rest'); /** * A faster alternative to `Function#apply`, this function invokes `func` @@ -49,6 +31,26 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. @@ -70,130 +72,6 @@ function arraySome(array, predicate) { return false; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Creates a function like `_.over`. * @@ -203,7 +81,7 @@ function baseToPath(value) { */ function createOver(arrayFunc) { return rest(function(iteratees) { - iteratees = arrayMap(baseFlatten(iteratees), baseIteratee); + iteratees = arrayMap(baseFlatten(iteratees, 1), baseIteratee); return rest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { @@ -213,139 +91,6 @@ function createOver(arrayFunc) { }); } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - /** * Creates a function that checks if **any** of the `predicates` return * truthy when invoked with the arguments provided to the created function. @@ -370,29 +115,4 @@ function identity(value) { */ var overSome = createOver(arraySome); -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = overSome; diff --git a/lodash.oversome/package.json b/lodash.oversome/package.json index da8db49ef..f96c9c5bd 100644 --- a/lodash.oversome/package.json +++ b/lodash.oversome/package.json @@ -1,6 +1,6 @@ { "name": "lodash.oversome", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.overSome` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,14 +15,8 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash._baseflatten": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.pad/LICENSE b/lodash.pad/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.pad/LICENSE +++ b/lodash.pad/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.pad/README.md b/lodash.pad/README.md index f43453bf2..ae17f5d60 100644 --- a/lodash.pad/README.md +++ b/lodash.pad/README.md @@ -1,4 +1,4 @@ -# lodash.pad v4.1.0 +# lodash.pad v4.2.0 The [lodash](https://lodash.com/) method `_.pad` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var pad = require('lodash.pad'); ``` -See the [documentation](https://lodash.com/docs#pad) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.pad) for more details. +See the [documentation](https://lodash.com/docs#pad) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.pad) for more details. diff --git a/lodash.pad/index.js b/lodash.pad/index.js index 88a0180a2..bf150626a 100644 --- a/lodash.pad/index.js +++ b/lodash.pad/index.js @@ -1,22 +1,23 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var repeat = require('lodash.repeat'), - toString = require('lodash.tostring'); +var toString = require('lodash.tostring'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 1.7976931348623157e+308, NAN = 0 / 0; /** `Object#toString` result references. */ var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; @@ -95,7 +96,8 @@ function stringToArray(string) { var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -104,30 +106,54 @@ var objectToString = objectProto.toString; var nativeCeil = Math.ceil, nativeFloor = Math.floor; +/** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ +function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; +} + /** * Creates the padding for `string` based on `length`. The `chars` string * is truncated if the number of characters exceeds `length`. * * @private - * @param {string} string The string to create padding for. - * @param {number} [length=0] The padding length. + * @param {number} length The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padding for `string`. */ -function createPadding(string, length, chars) { - length = toInteger(length); - - var strLength = stringSize(string); - if (!length || strLength >= length) { - return ''; - } - var padLength = length - strLength; +function createPadding(length, chars) { chars = chars === undefined ? ' ' : (chars + ''); - var result = repeat(chars, nativeCeil(padLength / stringSize(chars))); + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); return reHasComplexSymbol.test(chars) - ? stringToArray(result).slice(0, padLength).join('') - : result.slice(0, padLength); + ? stringToArray(result).slice(0, length).join('') + : result.slice(0, length); } /** @@ -135,9 +161,11 @@ function createPadding(string, length, chars) { * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isFunction(_); @@ -155,11 +183,13 @@ function isFunction(value) { } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. @@ -183,12 +213,65 @@ function isObject(value) { } /** - * Converts `value` to an integer. - * - * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". * * @static * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to an integer. + * + * **Note:** This function is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. @@ -224,6 +307,7 @@ function toInteger(value) { * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. @@ -242,6 +326,12 @@ function toInteger(value) { * // => 3 */ function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } if (isObject(value)) { var other = isFunction(value.valueOf) ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; @@ -262,6 +352,7 @@ function toNumber(value) { * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. @@ -282,15 +373,16 @@ function pad(string, length, chars) { string = toString(string); length = toInteger(length); - var strLength = stringSize(string); + var strLength = length ? stringSize(string) : 0; if (!length || strLength >= length) { return string; } - var mid = (length - strLength) / 2, - leftLength = nativeFloor(mid), - rightLength = nativeCeil(mid); - - return createPadding('', leftLength, chars) + string + createPadding('', rightLength, chars); + var mid = (length - strLength) / 2; + return ( + createPadding(nativeFloor(mid), chars) + + string + + createPadding(nativeCeil(mid), chars) + ); } module.exports = pad; diff --git a/lodash.pad/package.json b/lodash.pad/package.json index 879c45d81..39992a36e 100644 --- a/lodash.pad/package.json +++ b/lodash.pad/package.json @@ -1,6 +1,6 @@ { "name": "lodash.pad", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.pad` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,13 +9,12 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash.repeat": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.padend/README.md b/lodash.padend/README.md index 35b9023ed..ac8498784 100644 --- a/lodash.padend/README.md +++ b/lodash.padend/README.md @@ -1,4 +1,4 @@ -# lodash.padend v4.1.1 +# lodash.padend v4.2.0 The [lodash](https://lodash.com/) method `_.padEnd` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var padEnd = require('lodash.padend'); ``` -See the [documentation](https://lodash.com/docs#padEnd) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.padend) for more details. +See the [documentation](https://lodash.com/docs#padEnd) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.padend) for more details. diff --git a/lodash.padend/index.js b/lodash.padend/index.js index d374933d1..22c6f08e1 100644 --- a/lodash.padend/index.js +++ b/lodash.padend/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -147,8 +147,8 @@ function createPadding(string, length, chars) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } diff --git a/lodash.padend/package.json b/lodash.padend/package.json index a5904dc20..5a54ef402 100644 --- a/lodash.padend/package.json +++ b/lodash.padend/package.json @@ -1,6 +1,6 @@ { "name": "lodash.padend", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.padEnd` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash.repeat": "^3.0.0", + "lodash.repeat": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.padstart/README.md b/lodash.padstart/README.md index ec05f0dbc..d3176b001 100644 --- a/lodash.padstart/README.md +++ b/lodash.padstart/README.md @@ -1,4 +1,4 @@ -# lodash.padstart v4.1.1 +# lodash.padstart v4.2.0 The [lodash](https://lodash.com/) method `_.padStart` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var padStart = require('lodash.padstart'); ``` -See the [documentation](https://lodash.com/docs#padStart) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.padstart) for more details. +See the [documentation](https://lodash.com/docs#padStart) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.padstart) for more details. diff --git a/lodash.padstart/index.js b/lodash.padstart/index.js index 7bfff4589..f8586d0a7 100644 --- a/lodash.padstart/index.js +++ b/lodash.padstart/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -147,8 +147,8 @@ function createPadding(string, length, chars) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } diff --git a/lodash.padstart/package.json b/lodash.padstart/package.json index 049ac16c8..6b6d31145 100644 --- a/lodash.padstart/package.json +++ b/lodash.padstart/package.json @@ -1,6 +1,6 @@ { "name": "lodash.padstart", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.padStart` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash.repeat": "^3.0.0", + "lodash.repeat": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.partial/README.md b/lodash.partial/README.md index 16260b9b9..2257eb340 100644 --- a/lodash.partial/README.md +++ b/lodash.partial/README.md @@ -1,4 +1,4 @@ -# lodash.partial v4.1.4 +# lodash.partial v4.2.0 The [lodash](https://lodash.com/) method `_.partial` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var partial = require('lodash.partial'); ``` -See the [documentation](https://lodash.com/docs#partial) or [package source](https://github.com/lodash/lodash/blob/4.1.4-npm-packages/lodash.partial) for more details. +See the [documentation](https://lodash.com/docs#partial) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.partial) for more details. diff --git a/lodash.partial/index.js b/lodash.partial/index.js index 222efaa06..569d5466c 100644 --- a/lodash.partial/index.js +++ b/lodash.partial/index.js @@ -6,14 +6,253 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var createWrapper = require('lodash._createwrapper'), - rest = require('lodash.rest'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; -/** Used to compose bitmasks for wrapper metadata. */ -var PARTIAL_FLAG = 32; +/** Used to compose bitmasks for function metadata. */ +var BIND_FLAG = 1, + BIND_KEY_FLAG = 2, + CURRY_BOUND_FLAG = 4, + CURRY_FLAG = 8, + CURRY_RIGHT_FLAG = 16, + PARTIAL_FLAG = 32, + PARTIAL_RIGHT_FLAG = 64, + ARY_FLAG = 128, + REARG_FLAG = 256, + FLIP_FLAG = 512; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + +/** Used to associate wrap methods with their bit flags. */ +var wrapFlags = [ + ['ary', ARY_FLAG], + ['bind', BIND_FLAG], + ['bindKey', BIND_KEY_FLAG], + ['curry', CURRY_FLAG], + ['curryRight', CURRY_RIGHT_FLAG], + ['flip', FLIP_FLAG], + ['partial', PARTIAL_FLAG], + ['partialRight', PARTIAL_RIGHT_FLAG], + ['rearg', REARG_FLAG] +]; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to match wrap detail comments. */ +var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to search. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ +function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + result++; + } + } + return result; +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} /** * Replaces all `placeholder` elements in `array` with an internal placeholder @@ -40,6 +279,511 @@ function replaceHolders(array, placeholder) { return result; } +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var objectCreate = Object.create; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/* Used to set `toString` methods. */ +var defineProperty = (function() { + var func = getNative(Object, 'defineProperty'), + name = getNative.name; + + return (name && name.length > 2) ? func : undefined; +}()); + +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + +/** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; +} + +/** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; +} + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +/** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createBind(func, bitmask, thisArg) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; +} + +/** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ +function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; +} + +/** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & ARY_FLAG, + isBind = bitmask & BIND_FLAG, + isBindKey = bitmask & BIND_KEY_FLAG, + isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG), + isFlip = bitmask & FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ +function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); + + if (!(bitmask & CURRY_BOUND_FLAG)) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + + var result = wrapFunc(func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity); + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); +} + +/** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * The bitmask may be composed of the following flags: + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] == null + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { + bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + return setWrapToString(result, func, bitmask); +} + /** * Gets the argument placeholder value for `func`. * @@ -52,6 +796,152 @@ function getHolder(func) { return object.placeholder; } +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ +function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; +} + +/** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ +function insertWrapDetails(source, details) { + var length = details.length, + lastIndex = length - 1; + + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ +function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; +} + +/** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ +var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { + var source = (reference + ''); + return defineProperty(wrapper, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) + }); +}; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ +function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); +} + /** * Creates a function that invokes `func` with `partials` prepended to the * arguments it receives. This method is like `_.bind` except it does **not** @@ -72,9 +962,9 @@ function getHolder(func) { * @returns {Function} Returns the new partially applied function. * @example * - * var greet = function(greeting, name) { + * function greet(greeting, name) { * return greeting + ' ' + name; - * }; + * } * * var sayHelloTo = _.partial(greet, 'hello'); * sayHelloTo('fred'); @@ -85,11 +975,273 @@ function getHolder(func) { * greetFred('hi'); * // => 'hi fred' */ -var partial = rest(function(func, partials) { +var partial = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partial)); - return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); + return createWrap(func, PARTIAL_FLAG, undefined, partials, holders); }); +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; +} + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + // Assign default placeholders. partial.placeholder = {}; diff --git a/lodash.partial/package.json b/lodash.partial/package.json index 0d776624c..72be6e1d2 100644 --- a/lodash.partial/package.json +++ b/lodash.partial/package.json @@ -1,6 +1,6 @@ { "name": "lodash.partial", - "version": "4.1.4", + "version": "4.2.0", "description": "The lodash method `_.partial` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._createwrapper": "~4.0.0", - "lodash.rest": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.partialright/README.md b/lodash.partialright/README.md index 60045f744..84701e91a 100644 --- a/lodash.partialright/README.md +++ b/lodash.partialright/README.md @@ -1,4 +1,4 @@ -# lodash.partialright v4.1.4 +# lodash.partialright v4.2.0 The [lodash](https://lodash.com/) method `_.partialRight` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var partialRight = require('lodash.partialright'); ``` -See the [documentation](https://lodash.com/docs#partialRight) or [package source](https://github.com/lodash/lodash/blob/4.1.4-npm-packages/lodash.partialright) for more details. +See the [documentation](https://lodash.com/docs#partialRight) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.partialright) for more details. diff --git a/lodash.partialright/index.js b/lodash.partialright/index.js index a589673fd..6d532b127 100644 --- a/lodash.partialright/index.js +++ b/lodash.partialright/index.js @@ -6,14 +6,253 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var createWrapper = require('lodash._createwrapper'), - rest = require('lodash.rest'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; -/** Used to compose bitmasks for wrapper metadata. */ -var PARTIAL_RIGHT_FLAG = 64; +/** Used to compose bitmasks for function metadata. */ +var BIND_FLAG = 1, + BIND_KEY_FLAG = 2, + CURRY_BOUND_FLAG = 4, + CURRY_FLAG = 8, + CURRY_RIGHT_FLAG = 16, + PARTIAL_FLAG = 32, + PARTIAL_RIGHT_FLAG = 64, + ARY_FLAG = 128, + REARG_FLAG = 256, + FLIP_FLAG = 512; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + +/** Used to associate wrap methods with their bit flags. */ +var wrapFlags = [ + ['ary', ARY_FLAG], + ['bind', BIND_FLAG], + ['bindKey', BIND_KEY_FLAG], + ['curry', CURRY_FLAG], + ['curryRight', CURRY_RIGHT_FLAG], + ['flip', FLIP_FLAG], + ['partial', PARTIAL_FLAG], + ['partialRight', PARTIAL_RIGHT_FLAG], + ['rearg', REARG_FLAG] +]; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to match wrap detail comments. */ +var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to search. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ +function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + result++; + } + } + return result; +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} /** * Replaces all `placeholder` elements in `array` with an internal placeholder @@ -40,6 +279,511 @@ function replaceHolders(array, placeholder) { return result; } +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var objectCreate = Object.create; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/* Used to set `toString` methods. */ +var defineProperty = (function() { + var func = getNative(Object, 'defineProperty'), + name = getNative.name; + + return (name && name.length > 2) ? func : undefined; +}()); + +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + +/** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; +} + +/** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; +} + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +/** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createBind(func, bitmask, thisArg) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; +} + +/** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ +function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; +} + +/** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & ARY_FLAG, + isBind = bitmask & BIND_FLAG, + isBindKey = bitmask & BIND_KEY_FLAG, + isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG), + isFlip = bitmask & FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ +function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); + + if (!(bitmask & CURRY_BOUND_FLAG)) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + + var result = wrapFunc(func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity); + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); +} + +/** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * The bitmask may be composed of the following flags: + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] == null + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { + bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + return setWrapToString(result, func, bitmask); +} + /** * Gets the argument placeholder value for `func`. * @@ -52,6 +796,152 @@ function getHolder(func) { return object.placeholder; } +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ +function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; +} + +/** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ +function insertWrapDetails(source, details) { + var length = details.length, + lastIndex = length - 1; + + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ +function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; +} + +/** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ +var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { + var source = (reference + ''); + return defineProperty(wrapper, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) + }); +}; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ +function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); +} + /** * This method is like `_.partial` except that partially applied arguments * are appended to the arguments it receives. @@ -71,9 +961,9 @@ function getHolder(func) { * @returns {Function} Returns the new partially applied function. * @example * - * var greet = function(greeting, name) { + * function greet(greeting, name) { * return greeting + ' ' + name; - * }; + * } * * var greetFred = _.partialRight(greet, 'fred'); * greetFred('hi'); @@ -84,11 +974,273 @@ function getHolder(func) { * sayHelloTo('fred'); * // => 'hello fred' */ -var partialRight = rest(function(func, partials) { +var partialRight = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partialRight)); - return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); + return createWrap(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; +} + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + // Assign default placeholders. partialRight.placeholder = {}; diff --git a/lodash.partialright/package.json b/lodash.partialright/package.json index 2f7dfe72f..442119564 100644 --- a/lodash.partialright/package.json +++ b/lodash.partialright/package.json @@ -1,6 +1,6 @@ { "name": "lodash.partialright", - "version": "4.1.4", + "version": "4.2.0", "description": "The lodash method `_.partialRight` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._createwrapper": "~4.0.0", - "lodash.rest": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.partition/README.md b/lodash.partition/README.md index 53f5f80ff..f42e14560 100644 --- a/lodash.partition/README.md +++ b/lodash.partition/README.md @@ -1,4 +1,4 @@ -# lodash.partition v4.1.1 +# lodash.partition v4.2.0 The [lodash](https://lodash.com/) method `_.partition` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var partition = require('lodash.partition'); ``` -See the [documentation](https://lodash.com/docs#partition) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.partition) for more details. +See the [documentation](https://lodash.com/docs#partition) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.partition) for more details. diff --git a/lodash.partition/index.js b/lodash.partition/index.js index 50b7d238c..8ede91299 100644 --- a/lodash.partition/index.js +++ b/lodash.partition/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,24 +7,7 @@ * Available under MIT license */ var baseEach = require('lodash._baseeach'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'); /** * A specialized version of `baseAggregator` for arrays. @@ -65,130 +48,6 @@ function baseAggregator(collection, setter, iteratee, accumulator) { return accumulator; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Creates a function like `_.groupBy`. * @@ -206,67 +65,6 @@ function createAggregator(setter, initializer) { }; } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates an array of elements split into two groups, the first of which * contains elements `predicate` returns truthy for, the second of which @@ -311,7 +109,7 @@ var partition = createAggregator(function(result, value, key) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -331,76 +129,4 @@ var partition = createAggregator(function(result, value, key) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = partition; diff --git a/lodash.partition/package.json b/lodash.partition/package.json index 2e312a133..be7ad6115 100644 --- a/lodash.partition/package.json +++ b/lodash.partition/package.json @@ -1,6 +1,6 @@ { "name": "lodash.partition", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.partition` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,11 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeach": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.pick/LICENSE b/lodash.pick/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.pick/LICENSE +++ b/lodash.pick/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.pick/README.md b/lodash.pick/README.md index bcaba8c28..82e4a6270 100644 --- a/lodash.pick/README.md +++ b/lodash.pick/README.md @@ -1,4 +1,4 @@ -# lodash.pick v4.1.1 +# lodash.pick v4.2.0 The [lodash](https://lodash.com/) method `_.pick` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var pick = require('lodash.pick'); ``` -See the [documentation](https://lodash.com/docs#pick) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.pick) for more details. +See the [documentation](https://lodash.com/docs#pick) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.pick) for more details. diff --git a/lodash.pick/index.js b/lodash.pick/index.js index d6a6b7b9f..562370a98 100644 --- a/lodash.pick/index.js +++ b/lodash.pick/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseFlatten = require('lodash._baseflatten'), rest = require('lodash.rest'); @@ -61,8 +61,7 @@ function basePick(object, props) { * @memberOf _ * @category Object * @param {Object} object The source object. - * @param {...(string|string[])} [props] The property identifiers to pick, - * specified individually or in arrays. + * @param {...(string|string[])} [props] The property identifiers to pick. * @returns {Object} Returns the new object. * @example * diff --git a/lodash.pick/package.json b/lodash.pick/package.json index 2e3d46f61..bb99a4921 100644 --- a/lodash.pick/package.json +++ b/lodash.pick/package.json @@ -1,6 +1,6 @@ { "name": "lodash.pick", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.pick` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseflatten": "~4.1.0", + "lodash._baseflatten": "~4.2.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.pickby/README.md b/lodash.pickby/README.md index 43434f1b3..70c278b03 100644 --- a/lodash.pickby/README.md +++ b/lodash.pickby/README.md @@ -1,4 +1,4 @@ -# lodash.pickby v4.1.1 +# lodash.pickby v4.2.0 The [lodash](https://lodash.com/) method `_.pickBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var pickBy = require('lodash.pickby'); ``` -See the [documentation](https://lodash.com/docs#pickBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.pickby) for more details. +See the [documentation](https://lodash.com/docs#pickBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.pickby) for more details. diff --git a/lodash.pickby/index.js b/lodash.pickby/index.js index b33b7d5b8..1837f5228 100644 --- a/lodash.pickby/index.js +++ b/lodash.pickby/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,25 +7,8 @@ * Available under MIT license */ var baseFor = require('lodash._basefor'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - keysIn = require('lodash.keysin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'), + keysIn = require('lodash.keysin'); /** * The base implementation of `_.forIn` without support for iteratee shorthands. @@ -39,92 +22,6 @@ function baseForIn(object, iteratee) { return object == null ? object : baseFor(object, iteratee, keysIn); } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * @@ -143,158 +40,6 @@ function basePickBy(object, predicate) { return result; } -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - /** * Creates an object composed of the `object` properties `predicate` returns * truthy for. The predicate is invoked with two arguments: (value, key). @@ -316,48 +61,4 @@ function pickBy(object, predicate) { return object == null ? {} : basePickBy(object, baseIteratee(predicate, 2)); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = pickBy; diff --git a/lodash.pickby/package.json b/lodash.pickby/package.json index 3144330ef..12476d985 100644 --- a/lodash.pickby/package.json +++ b/lodash.pickby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.pickby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.pickBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,12 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefor": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.keysin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.keysin": "^4.0.0" } } diff --git a/lodash.property/LICENSE b/lodash.property/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.property/LICENSE +++ b/lodash.property/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.property/README.md b/lodash.property/README.md index 8b2f523f0..31c8b112d 100644 --- a/lodash.property/README.md +++ b/lodash.property/README.md @@ -1,4 +1,4 @@ -# lodash.property v4.1.2 +# lodash.property v4.2.0 The [lodash](https://lodash.com/) method `_.property` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var property = require('lodash.property'); ``` -See the [documentation](https://lodash.com/docs#property) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.property) for more details. +See the [documentation](https://lodash.com/docs#property) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.property) for more details. diff --git a/lodash.property/index.js b/lodash.property/index.js index 4debf5fe5..8fae1c266 100644 --- a/lodash.property/index.js +++ b/lodash.property/index.js @@ -1,20 +1,29 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var toString = require('lodash.tostring'); +var stringToPath = require('lodash._stringtopath'); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; + reIsPlainProp = /^\w*$/; -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; /** * Casts `value` to a path array if it's not one. @@ -36,7 +45,7 @@ function baseCastPath(value) { * @returns {*} Returns the resolved value. */ function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseCastPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = 0, length = path.length; @@ -82,38 +91,26 @@ function basePropertyDeep(path) { * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { - if (typeof value == 'number') { + var type = typeof value; + if (type == 'number' || type == 'symbol') { return true; } return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ + * @since 0.1.0 * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -130,25 +127,77 @@ function stringToPath(string) { */ var isArray = Array.isArray; +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ + * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new function. * @example * * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } * ]; * - * _.map(objects, _.property('a.b.c')); + * _.map(objects, _.property('a.b')); * // => [2, 1] * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { diff --git a/lodash.property/package.json b/lodash.property/package.json index 34f15deda..7457bfed7 100644 --- a/lodash.property/package.json +++ b/lodash.property/package.json @@ -1,6 +1,6 @@ { "name": "lodash.property", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.property` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,12 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash.tostring": "^4.0.0" + "lodash._stringtopath": "~4.7.0" } } diff --git a/lodash.propertyof/LICENSE b/lodash.propertyof/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.propertyof/LICENSE +++ b/lodash.propertyof/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.propertyof/README.md b/lodash.propertyof/README.md index 8171a3bc4..0cdd9fa5f 100644 --- a/lodash.propertyof/README.md +++ b/lodash.propertyof/README.md @@ -1,4 +1,4 @@ -# lodash.propertyof v4.1.2 +# lodash.propertyof v4.2.0 The [lodash](https://lodash.com/) method `_.propertyOf` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var propertyOf = require('lodash.propertyof'); ``` -See the [documentation](https://lodash.com/docs#propertyOf) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.propertyof) for more details. +See the [documentation](https://lodash.com/docs#propertyOf) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.propertyof) for more details. diff --git a/lodash.propertyof/index.js b/lodash.propertyof/index.js index d665d78ba..9b4e56f2a 100644 --- a/lodash.propertyof/index.js +++ b/lodash.propertyof/index.js @@ -1,20 +1,29 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var toString = require('lodash.tostring'); +var stringToPath = require('lodash._stringtopath'); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; + reIsPlainProp = /^\w*$/; -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; /** * Casts `value` to a path array if it's not one. @@ -36,7 +45,7 @@ function baseCastPath(value) { * @returns {*} Returns the resolved value. */ function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseCastPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = 0, length = path.length; @@ -56,38 +65,26 @@ function baseGet(object, path) { * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { - if (typeof value == 'number') { + var type = typeof value; + if (type == 'number' || type == 'symbol') { return true; } return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ + * @since 0.1.0 * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -104,12 +101,64 @@ function stringToPath(string) { */ var isArray = Array.isArray; +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + /** * The opposite of `_.property`; this method creates a function that returns * the value at a given path of `object`. * * @static * @memberOf _ + * @since 3.0.0 * @category Util * @param {Object} object The object to query. * @returns {Function} Returns the new function. diff --git a/lodash.propertyof/package.json b/lodash.propertyof/package.json index c4550864a..a0b7d4237 100644 --- a/lodash.propertyof/package.json +++ b/lodash.propertyof/package.json @@ -1,6 +1,6 @@ { "name": "lodash.propertyof", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.propertyOf` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,12 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash.tostring": "^4.0.0" + "lodash._stringtopath": "~4.7.0" } } diff --git a/lodash.pullall/LICENSE b/lodash.pullall/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.pullall/LICENSE +++ b/lodash.pullall/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.pullall/README.md b/lodash.pullall/README.md index 6a295bec6..99db3e57f 100644 --- a/lodash.pullall/README.md +++ b/lodash.pullall/README.md @@ -1,4 +1,4 @@ -# lodash.pullall v4.1.1 +# lodash.pullall v4.2.0 The [lodash](https://lodash.com/) method `_.pullAll` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var pullAll = require('lodash.pullall'); ``` -See the [documentation](https://lodash.com/docs#pullAll) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.pullall) for more details. +See the [documentation](https://lodash.com/docs#pullAll) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.pullall) for more details. diff --git a/lodash.pullall/index.js b/lodash.pullall/index.js index acc1c8910..fbc87bb2c 100644 --- a/lodash.pullall/index.js +++ b/lodash.pullall/index.js @@ -1,12 +1,187 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var basePullAll = require('lodash._basepullall'); + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array ? array.length : 0, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/** + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + */ +function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; + + if (array === values) { + values = copyArray(values); + } + if (iteratee) { + seen = arrayMap(array, baseUnary(iteratee)); + } + while (++index < length) { + var fromIndex = 0, + value = values[index], + computed = iteratee ? iteratee(value) : value; + + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; +} + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} /** * This method is like `_.pull` except that it accepts an array of values to remove. @@ -22,11 +197,11 @@ var basePullAll = require('lodash._basepullall'); * @returns {Array} Returns `array`. * @example * - * var array = [1, 2, 3, 1, 2, 3]; + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; * - * _.pullAll(array, [2, 3]); + * _.pullAll(array, ['a', 'c']); * console.log(array); - * // => [1, 1] + * // => ['b', 'b'] */ function pullAll(array, values) { return (array && array.length && values && values.length) diff --git a/lodash.pullall/package.json b/lodash.pullall/package.json index 56ec205cf..2164bd772 100644 --- a/lodash.pullall/package.json +++ b/lodash.pullall/package.json @@ -1,6 +1,6 @@ { "name": "lodash.pullall", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.pullAll` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,8 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._basepullall": "~4.6.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.pullallby/README.md b/lodash.pullallby/README.md index 4c1096fc4..46e3032c4 100644 --- a/lodash.pullallby/README.md +++ b/lodash.pullallby/README.md @@ -1,4 +1,4 @@ -# lodash.pullallby v4.1.1 +# lodash.pullallby v4.2.0 The [lodash](https://lodash.com/) method `_.pullAllBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var pullAllBy = require('lodash.pullallby'); ``` -See the [documentation](https://lodash.com/docs#pullAllBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.pullallby) for more details. +See the [documentation](https://lodash.com/docs#pullAllBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.pullallby) for more details. diff --git a/lodash.pullallby/index.js b/lodash.pullallby/index.js index 8ad7214af..4e409154d 100644 --- a/lodash.pullallby/index.js +++ b/lodash.pullallby/index.js @@ -1,215 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - basePullAllBy = require('lodash._basepullallby'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} +var baseIteratee = require('lodash._baseiteratee'), + basePullAllBy = require('lodash._basepullallby'); /** * This method is like `_.pullAll` except that it accepts `iteratee` which is @@ -239,101 +37,4 @@ function pullAllBy(array, values, iteratee) { : array; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = pullAllBy; diff --git a/lodash.pullallby/package.json b/lodash.pullallby/package.json index 01e4d932d..519c0479d 100644 --- a/lodash.pullallby/package.json +++ b/lodash.pullallby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.pullallby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.pullAllBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._basepullallby": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._basepullallby": "^4.0.0" } } diff --git a/lodash.pullat/LICENSE b/lodash.pullat/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.pullat/LICENSE +++ b/lodash.pullat/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.pullat/README.md b/lodash.pullat/README.md index e79535016..a632166bb 100644 --- a/lodash.pullat/README.md +++ b/lodash.pullat/README.md @@ -1,4 +1,4 @@ -# lodash.pullat v4.1.1 +# lodash.pullat v4.2.0 The [lodash](https://lodash.com/) method `_.pullAt` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var pullAt = require('lodash.pullat'); ``` -See the [documentation](https://lodash.com/docs#pullAt) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.pullat) for more details. +See the [documentation](https://lodash.com/docs#pullAt) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.pullat) for more details. diff --git a/lodash.pullat/index.js b/lodash.pullat/index.js index 6741336d2..e56380024 100644 --- a/lodash.pullat/index.js +++ b/lodash.pullat/index.js @@ -1,23 +1,22 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseFlatten = require('lodash._baseflatten'), basePullAt = require('lodash._basepullat'), rest = require('lodash.rest'), - toString = require('lodash.tostring'); + stringToPath = require('lodash._stringtopath'); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + reIsPlainProp = /^\w*$/; /** * A specialized version of `_.map` for arrays without support for iteratee @@ -71,6 +70,15 @@ function compareAscending(value, other) { return 0; } +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + /** * The base implementation of `_.at` without support for individual paths. * @@ -111,7 +119,7 @@ function baseCastPath(value) { * @returns {*} Returns the resolved value. */ function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseCastPath(path); + path = isKey(path, object) ? [path] : baseCastPath(path); var index = 0, length = path.length; @@ -131,29 +139,15 @@ function baseGet(object, path) { * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { - if (typeof value == 'number') { + var type = typeof value; + if (type == 'number' || type == 'symbol') { return true; } return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object))); } -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Removes elements from `array` corresponding to `indexes` and returns an * array of removed elements. @@ -162,6 +156,7 @@ function stringToPath(string) { * * @static * @memberOf _ + * @since 3.0.0 * @category Array * @param {Array} array The array to modify. * @param {...(number|number[])} [indexes] The indexes of elements to remove, @@ -191,10 +186,12 @@ var pullAt = rest(function(array, indexes) { * * @static * @memberOf _ + * @since 0.1.0 * @type {Function} * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isArray([1, 2, 3]); @@ -211,16 +208,68 @@ var pullAt = rest(function(array, indexes) { */ var isArray = Array.isArray; +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + /** * Gets the value at `path` of `object`. If the resolved value is * `undefined` the `defaultValue` is used in its place. * * @static * @memberOf _ + * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * diff --git a/lodash.pullat/package.json b/lodash.pullat/package.json index 6f7147f6c..923da3e11 100644 --- a/lodash.pullat/package.json +++ b/lodash.pullat/package.json @@ -1,6 +1,6 @@ { "name": "lodash.pullat", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.pullAt` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,8 +16,8 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseflatten": "~4.1.0", - "lodash._basepullat": "~4.2.0", - "lodash.rest": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._basepullat": "~4.3.0", + "lodash._stringtopath": "~4.7.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.rangeright/README.md b/lodash.rangeright/README.md index 8484c0124..a56569f9d 100644 --- a/lodash.rangeright/README.md +++ b/lodash.rangeright/README.md @@ -1,4 +1,4 @@ -# lodash.rangeright v4.1.0 +# lodash.rangeright v4.2.0 The [lodash](https://lodash.com/) method `_.rangeRight` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var rangeRight = require('lodash.rangeright'); ``` -See the [documentation](https://lodash.com/docs#rangeRight) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.rangeright) for more details. +See the [documentation](https://lodash.com/docs#rangeRight) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.rangeright) for more details. diff --git a/lodash.rangeright/index.js b/lodash.rangeright/index.js index 2e0b63b2b..f42b9608c 100644 --- a/lodash.rangeright/index.js +++ b/lodash.rangeright/index.js @@ -36,25 +36,12 @@ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -111,19 +98,6 @@ function createRange(fromRight) { }; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Checks if `value` is a valid array-like index. * @@ -165,7 +139,7 @@ function isIterateeCall(value, index, object) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -225,7 +199,7 @@ function eq(value, other) { * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -247,8 +221,7 @@ function isArrayLike(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -256,16 +229,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -287,7 +259,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -431,7 +403,7 @@ function toNumber(value) { return NAN; } if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { diff --git a/lodash.rangeright/package.json b/lodash.rangeright/package.json index 4a57fcc69..883fc3952 100644 --- a/lodash.rangeright/package.json +++ b/lodash.rangeright/package.json @@ -1,6 +1,6 @@ { "name": "lodash.rangeright", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.rangeRight` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.rearg/LICENSE b/lodash.rearg/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.rearg/LICENSE +++ b/lodash.rearg/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.rearg/README.md b/lodash.rearg/README.md index 246ec943d..e97c956fc 100644 --- a/lodash.rearg/README.md +++ b/lodash.rearg/README.md @@ -1,4 +1,4 @@ -# lodash.rearg v4.1.1 +# lodash.rearg v4.2.0 The [lodash](https://lodash.com/) method `_.rearg` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var rearg = require('lodash.rearg'); ``` -See the [documentation](https://lodash.com/docs#rearg) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.rearg) for more details. +See the [documentation](https://lodash.com/docs#rearg) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.rearg) for more details. diff --git a/lodash.rearg/index.js b/lodash.rearg/index.js index 464e5f69d..4d43b3abd 100644 --- a/lodash.rearg/index.js +++ b/lodash.rearg/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseFlatten = require('lodash._baseflatten'), createWrapper = require('lodash._createwrapper'), @@ -15,7 +15,7 @@ var REARG_FLAG = 256; /** * Creates a function that invokes `func` with arguments arranged according - * to the specified indexes where the argument value at the first index is + * to the specified `indexes` where the argument value at the first index is * provided as the first argument, the argument value at the second index is * provided as the second argument, and so on. * @@ -24,8 +24,7 @@ var REARG_FLAG = 256; * @since 3.0.0 * @category Function * @param {Function} func The function to rearrange arguments for. - * @param {...(number|number[])} indexes The arranged argument indexes, - * specified individually or in arrays. + * @param {...(number|number[])} indexes The arranged argument indexes. * @returns {Function} Returns the new function. * @example * diff --git a/lodash.rearg/package.json b/lodash.rearg/package.json index 7b0e51533..fec773d00 100644 --- a/lodash.rearg/package.json +++ b/lodash.rearg/package.json @@ -1,6 +1,6 @@ { "name": "lodash.rearg", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.rearg` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseflatten": "~4.1.0", + "lodash._baseflatten": "~4.2.0", "lodash._createwrapper": "~4.0.0", "lodash.rest": "^4.0.0" } diff --git a/lodash.reduce/README.md b/lodash.reduce/README.md index 226721195..1b4b8a668 100644 --- a/lodash.reduce/README.md +++ b/lodash.reduce/README.md @@ -1,4 +1,4 @@ -# lodash.reduce v4.1.1 +# lodash.reduce v4.2.0 The [lodash](https://lodash.com/) method `_.reduce` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var reduce = require('lodash.reduce'); ``` -See the [documentation](https://lodash.com/docs#reduce) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.reduce) for more details. +See the [documentation](https://lodash.com/docs#reduce) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.reduce) for more details. diff --git a/lodash.reduce/index.js b/lodash.reduce/index.js index fbfbd4a1f..807f44ee5 100644 --- a/lodash.reduce/index.js +++ b/lodash.reduce/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,25 +7,8 @@ * Available under MIT license */ var baseEach = require('lodash._baseeach'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - baseReduce = require('lodash._basereduce'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'), + baseReduce = require('lodash._basereduce'); /** * A specialized version of `_.reduce` for arrays without support for @@ -51,191 +34,6 @@ function arrayReduce(array, iteratee, accumulator, initAccum) { return accumulator; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Reduces `collection` to a value which is the accumulated result of running * each element in `collection` through `iteratee`, where each successive @@ -283,7 +81,7 @@ function reduce(collection, iteratee, accumulator) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -303,76 +101,4 @@ function reduce(collection, iteratee, accumulator) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = reduce; diff --git a/lodash.reduce/package.json b/lodash.reduce/package.json index d280dd96a..5b7e2ad0a 100644 --- a/lodash.reduce/package.json +++ b/lodash.reduce/package.json @@ -1,6 +1,6 @@ { "name": "lodash.reduce", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.reduce` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,12 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeach": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._basereduce": "^3.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._basereduce": "^3.0.0" } } diff --git a/lodash.reduceright/README.md b/lodash.reduceright/README.md index 5c5b6005b..d628566c7 100644 --- a/lodash.reduceright/README.md +++ b/lodash.reduceright/README.md @@ -1,4 +1,4 @@ -# lodash.reduceright v4.1.1 +# lodash.reduceright v4.2.0 The [lodash](https://lodash.com/) method `_.reduceRight` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var reduceRight = require('lodash.reduceright'); ``` -See the [documentation](https://lodash.com/docs#reduceRight) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.reduceright) for more details. +See the [documentation](https://lodash.com/docs#reduceRight) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.reduceright) for more details. diff --git a/lodash.reduceright/index.js b/lodash.reduceright/index.js index 6433e57dd..54bf9561a 100644 --- a/lodash.reduceright/index.js +++ b/lodash.reduceright/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,25 +7,8 @@ * Available under MIT license */ var baseEachRight = require('lodash._baseeachright'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - baseReduce = require('lodash._basereduce'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; + baseIteratee = require('lodash._baseiteratee'), + baseReduce = require('lodash._basereduce'); /** * A specialized version of `_.reduceRight` for arrays without support for @@ -49,191 +32,6 @@ function arrayReduceRight(array, iteratee, accumulator, initAccum) { return accumulator; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * This method is like `_.reduce` except that it iterates over elements of * `collection` from right to left. @@ -266,7 +64,7 @@ function reduceRight(collection, iteratee, accumulator) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -286,76 +84,4 @@ function reduceRight(collection, iteratee, accumulator) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = reduceRight; diff --git a/lodash.reduceright/package.json b/lodash.reduceright/package.json index 922c731c0..ea4ffacae 100644 --- a/lodash.reduceright/package.json +++ b/lodash.reduceright/package.json @@ -1,6 +1,6 @@ { "name": "lodash.reduceright", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.reduceRight` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,12 +16,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeachright": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._basereduce": "^3.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._basereduce": "^3.0.0" } } diff --git a/lodash.reject/README.md b/lodash.reject/README.md index 3b8ac54cb..05084c642 100644 --- a/lodash.reject/README.md +++ b/lodash.reject/README.md @@ -1,4 +1,4 @@ -# lodash.reject v4.1.1 +# lodash.reject v4.2.0 The [lodash](https://lodash.com/) method `_.reject` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var reject = require('lodash.reject'); ``` -See the [documentation](https://lodash.com/docs#reject) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.reject) for more details. +See the [documentation](https://lodash.com/docs#reject) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.reject) for more details. diff --git a/lodash.reject/index.js b/lodash.reject/index.js index 7c13d0c59..6c13dbe48 100644 --- a/lodash.reject/index.js +++ b/lodash.reject/index.js @@ -1,214 +1,35 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayFilter = require('lodash._arrayfilter'), - baseFilter = require('lodash._basefilter'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +var baseFilter = require('lodash._basefilter'), + baseIteratee = require('lodash._baseiteratee'); /** - * The base implementation of `_.get` without support for default values. + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. * * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); +function arrayFilter(array, predicate) { + var index = -1, + length = array.length, + resIndex = -1, + result = []; - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[++resIndex] = value; + } } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); return result; } @@ -257,7 +78,7 @@ function reject(collection, predicate) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -277,76 +98,4 @@ function reject(collection, predicate) { */ var isArray = Array.isArray; -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = reject; diff --git a/lodash.reject/package.json b/lodash.reject/package.json index 19c7bd336..2a89754e3 100644 --- a/lodash.reject/package.json +++ b/lodash.reject/package.json @@ -1,6 +1,6 @@ { "name": "lodash.reject", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.reject` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,13 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayfilter": "^3.0.0", "lodash._basefilter": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.remove/README.md b/lodash.remove/README.md index 017c52b3e..b761b1666 100644 --- a/lodash.remove/README.md +++ b/lodash.remove/README.md @@ -1,4 +1,4 @@ -# lodash.remove v4.1.1 +# lodash.remove v4.2.0 The [lodash](https://lodash.com/) method `_.remove` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var remove = require('lodash.remove'); ``` -See the [documentation](https://lodash.com/docs#remove) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.remove) for more details. +See the [documentation](https://lodash.com/docs#remove) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.remove) for more details. diff --git a/lodash.remove/index.js b/lodash.remove/index.js index f98fd3043..e8f57ee2f 100644 --- a/lodash.remove/index.js +++ b/lodash.remove/index.js @@ -1,222 +1,21 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - basePullAt = require('lodash._basepullat'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} +var baseIteratee = require('lodash._baseiteratee'), + basePullAt = require('lodash._basepullat'); /** * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked with - * three arguments: (value, index, array). + * and returns an array of the removed elements. The predicate is invoked + * with three arguments: (value, index, array). * - * **Note:** Unlike `_.filter`, this method mutates `array`. + * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` + * to pull elements from an array by value. * * @static * @memberOf _ @@ -258,101 +57,4 @@ function remove(array, predicate) { return result; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = remove; diff --git a/lodash.remove/package.json b/lodash.remove/package.json index 35a588a38..8b88f732f 100644 --- a/lodash.remove/package.json +++ b/lodash.remove/package.json @@ -1,6 +1,6 @@ { "name": "lodash.remove", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.remove` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._basepullat": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._basepullat": "^4.0.0" } } diff --git a/lodash.result/README.md b/lodash.result/README.md index b08030b02..8d7eb3a20 100644 --- a/lodash.result/README.md +++ b/lodash.result/README.md @@ -1,4 +1,4 @@ -# lodash.result v4.1.1 +# lodash.result v4.2.0 The [lodash](https://lodash.com/) method `_.result` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var result = require('lodash.result'); ``` -See the [documentation](https://lodash.com/docs#result) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.result) for more details. +See the [documentation](https://lodash.com/docs#result) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.result) for more details. diff --git a/lodash.result/index.js b/lodash.result/index.js index 08c47e6cc..8a348a193 100644 --- a/lodash.result/index.js +++ b/lodash.result/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,6 @@ * Available under MIT license */ var baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), toString = require('lodash.tostring'); /** `Object#toString` result references. */ @@ -32,17 +31,36 @@ var objectProto = Object.prototype; var objectToString = objectProto.toString; /** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. + * Casts `value` to a path array if it's not one. * * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. */ -function baseToPath(value) { +function baseCastPath(value) { return isArray(value) ? value : stringToPath(value); } +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + /** * Checks if `value` is a property name and not a property path. * @@ -92,7 +110,7 @@ function stringToPath(string) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -130,8 +148,8 @@ var isArray = Array.isArray; */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -164,6 +182,35 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + /** * This method is like `_.get` except that if the resolved value is a function * it's invoked with the `this` binding of its parent object and its result @@ -194,7 +241,7 @@ function isObject(value) { */ function result(object, path, defaultValue) { if (!isKey(path, object)) { - path = baseToPath(path); + path = baseCastPath(path); var result = get(object, path); object = parent(object, path); } else { diff --git a/lodash.result/package.json b/lodash.result/package.json index 1469c504b..3209d0389 100644 --- a/lodash.result/package.json +++ b/lodash.result/package.json @@ -1,6 +1,6 @@ { "name": "lodash.result", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.result` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.sample/LICENSE b/lodash.sample/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.sample/LICENSE +++ b/lodash.sample/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.sample/README.md b/lodash.sample/README.md index 4c6a9f6cd..00be507b3 100644 --- a/lodash.sample/README.md +++ b/lodash.sample/README.md @@ -1,4 +1,4 @@ -# lodash.sample v4.1.1 +# lodash.sample v4.2.0 The [lodash](https://lodash.com/) method `_.sample` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var sample = require('lodash.sample'); ``` -See the [documentation](https://lodash.com/docs#sample) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.sample) for more details. +See the [documentation](https://lodash.com/docs#sample) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.sample) for more details. diff --git a/lodash.sample/index.js b/lodash.sample/index.js index 9b272767a..02d8f857f 100644 --- a/lodash.sample/index.js +++ b/lodash.sample/index.js @@ -1,32 +1,36 @@ /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var keys = require('lodash.keys'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + stringTag = '[object String]'; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array.length, + length = array ? array.length : 0, result = Array(length); while (++index < length) { @@ -35,6 +39,38 @@ function arrayMap(array, iteratee) { return result; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names @@ -51,9 +87,26 @@ function baseValues(object, props) { }); } +/** + * Creates a function that invokes `func` with its first argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + /** Used for built-in method references. */ var objectProto = Object.prototype; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) @@ -61,23 +114,42 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeFloor = Math.floor, + nativeGetPrototype = Object.getPrototypeOf, + nativeKeys = Object.keys, nativeRandom = Math.random; /** - * The base implementation of `_.property` without support for deep paths. + * The base implementation of `_.has` without support for deep paths. * * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return object != null && + (hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null)); } +/** + * The base implementation of `_.keys` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +var baseKeys = overArg(nativeKeys, Object); + /** * The base implementation of `_.random` without support for returning * floating-point numbers. @@ -104,6 +176,61 @@ function baseRandom(lower, upper) { */ var getLength = baseProperty('length'); +/** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ +var getPrototype = overArg(nativeGetPrototype, Object); + +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + /** * Gets a random element from `collection`. * @@ -125,6 +252,55 @@ function sample(collection) { return length > 0 ? array[baseRandom(0, length - 1)] : undefined; } +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -154,6 +330,35 @@ function isArrayLike(value) { return value != null && isLength(getLength(value)) && !isFunction(value); } +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + /** * Checks if `value` is classified as a `Function` object. * @@ -162,8 +367,7 @@ function isArrayLike(value) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -242,6 +446,104 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + var isProto = isPrototype(object); + if (!(isProto || isArrayLike(object))) { + return baseKeys(object); + } + var indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + for (var key in object) { + if (baseHas(object, key) && + !(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(isProto && key == 'constructor')) { + result.push(key); + } + } + return result; +} + /** * Creates an array of the own enumerable string keyed property values of `object`. * diff --git a/lodash.sample/package.json b/lodash.sample/package.json index 8a34e7577..23f8fd9ed 100644 --- a/lodash.sample/package.json +++ b/lodash.sample/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sample", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.sample` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,8 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.keys": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.samplesize/README.md b/lodash.samplesize/README.md index 07a5327fe..fa775001d 100644 --- a/lodash.samplesize/README.md +++ b/lodash.samplesize/README.md @@ -1,4 +1,4 @@ -# lodash.samplesize v4.1.0 +# lodash.samplesize v4.2.0 The [lodash](https://lodash.com/) method `_.sampleSize` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var sampleSize = require('lodash.samplesize'); ``` -See the [documentation](https://lodash.com/docs#sampleSize) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.samplesize) for more details. +See the [documentation](https://lodash.com/docs#sampleSize) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.samplesize) for more details. diff --git a/lodash.samplesize/index.js b/lodash.samplesize/index.js index 569e5c943..4877a0ba5 100644 --- a/lodash.samplesize/index.js +++ b/lodash.samplesize/index.js @@ -29,7 +29,7 @@ var dataViewTag = '[object DataView]'; /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -75,7 +75,10 @@ var reOptMod = rsModifier + '?', rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; @@ -110,16 +113,14 @@ function arrayMap(array, iteratee) { } /** - * The base implementation of `_.property` without support for deep paths. + * Converts an ASCII `string` to an array. * * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; +function asciiToArray(string) { + return string.split(''); } /** @@ -169,6 +170,17 @@ function getValue(object, key) { return object == null ? undefined : object[key]; } +/** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ +function hasUnicode(string) { + return reHasUnicode.test(string); +} + /** * Checks if `value` is a host object in IE < 9. * @@ -223,7 +235,7 @@ function mapToArray(map) { } /** - * Creates a function that invokes `func` with its first argument transformed. + * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. @@ -261,11 +273,25 @@ function setToArray(set) { * @returns {Array} Returns the converted array. */ function stringToArray(string) { - return string.match(reComplexSymbol); + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); +} + +/** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function unicodeToArray(string) { + return string.match(reUnicode) || []; } /** Used for built-in method references. */ -var objectProto = Object.prototype; +var funcProto = Function.prototype, + objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; @@ -277,14 +303,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -302,8 +328,7 @@ var Symbol = root.Symbol, /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeFloor = Math.floor, - nativeGetPrototype = Object.getPrototypeOf, - nativeKeys = Object.keys, + nativeKeys = overArg(Object.keys, Object), nativeRandom = Math.random; /* Built-in method references that are verified to be native. */ @@ -320,6 +345,33 @@ var dataViewCtorString = toSource(DataView), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + /** * The base implementation of `_.clamp` which doesn't coerce arguments. * @@ -352,23 +404,6 @@ function baseGetTag(value) { return objectToString.call(value); } -/** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); -} - /** * The base implementation of `_.isNative` without bad shim checks. * @@ -386,14 +421,24 @@ function baseIsNative(value) { } /** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} /** * The base implementation of `_.random` without support for returning @@ -427,19 +472,6 @@ function copyArray(source, array) { return array; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Gets the native function at `key` of `object`. * @@ -453,15 +485,6 @@ function getNative(object, key) { return baseIsNative(value) ? value : undefined; } -/** - * Gets the `[[Prototype]]` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {null|Object} Returns the `[[Prototype]]`. - */ -var getPrototype = overArg(nativeGetPrototype, Object); - /** * Gets the `toStringTag` of `value`. * @@ -472,7 +495,7 @@ var getPrototype = overArg(nativeGetPrototype, Object); var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge, and promises in Node.js. +// for data views in Edge < 14, and promises in Node.js. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || @@ -496,23 +519,6 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || }; } -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -640,7 +646,7 @@ function sampleSize(collection, n, guard) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -693,7 +699,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -749,7 +755,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -800,8 +806,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -809,16 +814,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -840,7 +844,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -1018,7 +1022,7 @@ function toFinite(value) { * Converts `value` to an integer. * * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ @@ -1078,7 +1082,7 @@ function toNumber(value) { return NAN; } if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { @@ -1095,7 +1099,7 @@ function toNumber(value) { * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -1120,23 +1124,7 @@ function toNumber(value) { * // => ['0', '1'] */ function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** diff --git a/lodash.samplesize/package.json b/lodash.samplesize/package.json index ce84c08ca..b316173ac 100644 --- a/lodash.samplesize/package.json +++ b/lodash.samplesize/package.json @@ -1,6 +1,6 @@ { "name": "lodash.samplesize", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.sampleSize` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.set/README.md b/lodash.set/README.md index 1c7a3ef12..863f3dd04 100644 --- a/lodash.set/README.md +++ b/lodash.set/README.md @@ -1,4 +1,4 @@ -# lodash.set v4.1.0 +# lodash.set v4.2.0 The [lodash](https://lodash.com/) method `_.set` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var set = require('lodash.set'); ``` -See the [documentation](https://lodash.com/docs#set) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.set) for more details. +See the [documentation](https://lodash.com/docs#set) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.set) for more details. diff --git a/lodash.set/index.js b/lodash.set/index.js index fc89f2ad0..bb009236f 100644 --- a/lodash.set/index.js +++ b/lodash.set/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license diff --git a/lodash.set/package.json b/lodash.set/package.json index a44c2087d..2053c727d 100644 --- a/lodash.set/package.json +++ b/lodash.set/package.json @@ -1,6 +1,6 @@ { "name": "lodash.set", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.set` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseset": "~4.2.0" + "lodash._baseset": "~4.3.0" } } diff --git a/lodash.setwith/README.md b/lodash.setwith/README.md index 41775db7c..a4fe93142 100644 --- a/lodash.setwith/README.md +++ b/lodash.setwith/README.md @@ -1,4 +1,4 @@ -# lodash.setwith v4.1.0 +# lodash.setwith v4.2.0 The [lodash](https://lodash.com/) method `_.setWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var setWith = require('lodash.setwith'); ``` -See the [documentation](https://lodash.com/docs#setWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.setwith) for more details. +See the [documentation](https://lodash.com/docs#setWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.setwith) for more details. diff --git a/lodash.setwith/index.js b/lodash.setwith/index.js index 3dffc1dc0..9c0226598 100644 --- a/lodash.setwith/index.js +++ b/lodash.setwith/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license diff --git a/lodash.setwith/package.json b/lodash.setwith/package.json index d00bc43c3..237977314 100644 --- a/lodash.setwith/package.json +++ b/lodash.setwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.setwith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.setWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseset": "~4.2.0" + "lodash._baseset": "~4.3.0" } } diff --git a/lodash.shuffle/README.md b/lodash.shuffle/README.md index c3a80c59d..c68ff7207 100644 --- a/lodash.shuffle/README.md +++ b/lodash.shuffle/README.md @@ -1,4 +1,4 @@ -# lodash.shuffle v4.1.0 +# lodash.shuffle v4.2.0 The [lodash](https://lodash.com/) method `_.shuffle` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var shuffle = require('lodash.shuffle'); ``` -See the [documentation](https://lodash.com/docs#shuffle) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.shuffle) for more details. +See the [documentation](https://lodash.com/docs#shuffle) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.shuffle) for more details. diff --git a/lodash.shuffle/index.js b/lodash.shuffle/index.js index 0f64c1d7d..281bcc791 100644 --- a/lodash.shuffle/index.js +++ b/lodash.shuffle/index.js @@ -32,7 +32,7 @@ var dataViewTag = '[object DataView]'; /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -78,7 +78,10 @@ var reOptMod = rsModifier + '?', rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; @@ -113,16 +116,14 @@ function arrayMap(array, iteratee) { } /** - * The base implementation of `_.property` without support for deep paths. + * Converts an ASCII `string` to an array. * * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; +function asciiToArray(string) { + return string.split(''); } /** @@ -172,6 +173,17 @@ function getValue(object, key) { return object == null ? undefined : object[key]; } +/** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ +function hasUnicode(string) { + return reHasUnicode.test(string); +} + /** * Checks if `value` is a host object in IE < 9. * @@ -226,7 +238,7 @@ function mapToArray(map) { } /** - * Creates a function that invokes `func` with its first argument transformed. + * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. @@ -264,11 +276,25 @@ function setToArray(set) { * @returns {Array} Returns the converted array. */ function stringToArray(string) { - return string.match(reComplexSymbol); + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); +} + +/** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function unicodeToArray(string) { + return string.match(reUnicode) || []; } /** Used for built-in method references. */ -var objectProto = Object.prototype; +var funcProto = Function.prototype, + objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; @@ -280,14 +306,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -305,8 +331,7 @@ var Symbol = root.Symbol, /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeFloor = Math.floor, - nativeGetPrototype = Object.getPrototypeOf, - nativeKeys = Object.keys, + nativeKeys = overArg(Object.keys, Object), nativeRandom = Math.random; /* Built-in method references that are verified to be native. */ @@ -323,6 +348,33 @@ var dataViewCtorString = toSource(DataView), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + /** * The base implementation of `_.clamp` which doesn't coerce arguments. * @@ -355,23 +407,6 @@ function baseGetTag(value) { return objectToString.call(value); } -/** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); -} - /** * The base implementation of `_.isNative` without bad shim checks. * @@ -389,14 +424,24 @@ function baseIsNative(value) { } /** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} /** * The base implementation of `_.random` without support for returning @@ -430,19 +475,6 @@ function copyArray(source, array) { return array; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Gets the native function at `key` of `object`. * @@ -456,15 +488,6 @@ function getNative(object, key) { return baseIsNative(value) ? value : undefined; } -/** - * Gets the `[[Prototype]]` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {null|Object} Returns the `[[Prototype]]`. - */ -var getPrototype = overArg(nativeGetPrototype, Object); - /** * Gets the `toStringTag` of `value`. * @@ -475,7 +498,7 @@ var getPrototype = overArg(nativeGetPrototype, Object); var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge, and promises in Node.js. +// for data views in Edge < 14, and promises in Node.js. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || @@ -499,23 +522,6 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || }; } -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -662,7 +668,7 @@ function shuffle(collection) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -715,7 +721,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -771,7 +777,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -822,8 +828,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -831,16 +836,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -862,7 +866,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -1040,7 +1044,7 @@ function toFinite(value) { * Converts `value` to an integer. * * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ @@ -1100,7 +1104,7 @@ function toNumber(value) { return NAN; } if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { @@ -1117,7 +1121,7 @@ function toNumber(value) { * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -1142,23 +1146,7 @@ function toNumber(value) { * // => ['0', '1'] */ function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** diff --git a/lodash.shuffle/package.json b/lodash.shuffle/package.json index dad5e65dc..44fa7a719 100644 --- a/lodash.shuffle/package.json +++ b/lodash.shuffle/package.json @@ -1,6 +1,6 @@ { "name": "lodash.shuffle", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.shuffle` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.size/README.md b/lodash.size/README.md index 728727647..e0e9e42d5 100644 --- a/lodash.size/README.md +++ b/lodash.size/README.md @@ -1,4 +1,4 @@ -# lodash.size v4.1.0 +# lodash.size v4.2.0 The [lodash](https://lodash.com/) method `_.size` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var size = require('lodash.size'); ``` -See the [documentation](https://lodash.com/docs#size) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.size) for more details. +See the [documentation](https://lodash.com/docs#size) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.size) for more details. diff --git a/lodash.size/index.js b/lodash.size/index.js index d7468ec46..13321d405 100644 --- a/lodash.size/index.js +++ b/lodash.size/index.js @@ -11,8 +11,7 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - funcTag = '[object Function]', +var funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', objectTag = '[object Object]', @@ -25,16 +24,13 @@ var dataViewTag = '[object DataView]'; /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; -/** Used to detect unsigned integer values. */ -var reIsUint = /^(?:0|[1-9]\d*)$/; - /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', @@ -59,10 +55,10 @@ var reOptMod = rsModifier + '?', rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ -var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; @@ -73,6 +69,15 @@ var freeSelf = typeof self == 'object' && self && self.Object === Object && self /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); +/** + * Gets the size of an ASCII `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ +var asciiSize = baseProperty('length'); + /** * The base implementation of `_.property` without support for deep paths. * @@ -86,25 +91,6 @@ function baseProperty(key) { }; } -/** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ -function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; -} - /** * Gets the value at `key` of `object`. * @@ -117,6 +103,17 @@ function getValue(object, key) { return object == null ? undefined : object[key]; } +/** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ +function hasUnicode(string) { + return reHasUnicode.test(string); +} + /** * Checks if `value` is a host object in IE < 9. * @@ -137,7 +134,7 @@ function isHostObject(value) { } /** - * Creates a function that invokes `func` with its first argument transformed. + * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. @@ -158,18 +155,29 @@ function overArg(func, transform) { * @returns {number} Returns the string size. */ function stringSize(string) { - if (!(string && reHasComplexSymbol.test(string))) { - return string.length; - } - var result = reComplexSymbol.lastIndex = 0; - while (reComplexSymbol.test(string)) { + return hasUnicode(string) + ? unicodeSize(string) + : asciiSize(string); +} + +/** + * Gets the size of a Unicode `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ +function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { result++; } return result; } /** Used for built-in method references. */ -var objectProto = Object.prototype; +var funcProto = Function.prototype, + objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; @@ -181,14 +189,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -199,12 +207,8 @@ var reIsNative = RegExp('^' + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); -/** Built-in value references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetPrototype = Object.getPrototypeOf, - nativeKeys = Object.keys; +var nativeKeys = overArg(Object.keys, Object); /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'), @@ -231,23 +235,6 @@ function baseGetTag(value) { return objectToString.call(value); } -/** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); -} - /** * The base implementation of `_.isNative` without bad shim checks. * @@ -265,27 +252,24 @@ function baseIsNative(value) { } /** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); - -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} /** * Gets the native function at `key` of `object`. @@ -300,15 +284,6 @@ function getNative(object, key) { return baseIsNative(value) ? value : undefined; } -/** - * Gets the `[[Prototype]]` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {null|Object} Returns the `[[Prototype]]`. - */ -var getPrototype = overArg(nativeGetPrototype, Object); - /** * Gets the `toStringTag` of `value`. * @@ -319,7 +294,7 @@ var getPrototype = overArg(nativeGetPrototype, Object); var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge, and promises in Node.js. +// for data views in Edge < 14, and promises in Node.js. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || @@ -343,38 +318,6 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || }; } -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); -} - /** * Checks if `func` has its source masked. * @@ -427,7 +370,7 @@ function toSource(func) { * @memberOf _ * @since 0.1.0 * @category Collection - * @param {Array|Object} collection The collection to inspect. + * @param {Array|Object|string} collection The collection to inspect. * @returns {number} Returns the collection size. * @example * @@ -445,40 +388,13 @@ function size(collection) { return 0; } if (isArrayLike(collection)) { - var result = collection.length; - return (result && isString(collection)) ? stringSize(collection) : result; + return isString(collection) ? stringSize(collection) : collection.length; } - if (isObjectLike(collection)) { - var tag = getTag(collection); - if (tag == mapTag || tag == setTag) { - return collection.size; - } + var tag = getTag(collection); + if (tag == mapTag || tag == setTag) { + return collection.size; } - return keys(collection).length; -} - -/** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. - return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && - (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); + return baseKeys(collection).length; } /** @@ -532,36 +448,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); -} - -/** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ -function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -583,8 +470,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -592,16 +478,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -623,7 +508,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -701,52 +586,4 @@ function isString(value) { (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); } -/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ -function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; -} - module.exports = size; diff --git a/lodash.size/package.json b/lodash.size/package.json index 71e71e83d..a4cc372d4 100644 --- a/lodash.size/package.json +++ b/lodash.size/package.json @@ -1,6 +1,6 @@ { "name": "lodash.size", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.size` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.slice/README.md b/lodash.slice/README.md index 873b288bf..ea194cf49 100644 --- a/lodash.slice/README.md +++ b/lodash.slice/README.md @@ -1,4 +1,4 @@ -# lodash.slice v4.1.0 +# lodash.slice v4.2.0 The [lodash](https://lodash.com/) method `_.slice` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var slice = require('lodash.slice'); ``` -See the [documentation](https://lodash.com/docs#slice) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.slice) for more details. +See the [documentation](https://lodash.com/docs#slice) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.slice) for more details. diff --git a/lodash.slice/index.js b/lodash.slice/index.js index 5eec2fbb4..0117990fb 100644 --- a/lodash.slice/index.js +++ b/lodash.slice/index.js @@ -36,25 +36,12 @@ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -89,19 +76,6 @@ function baseSlice(array, start, end) { return result; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Checks if `value` is a valid array-like index. * @@ -175,7 +149,7 @@ function slice(array, start, end) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -235,7 +209,7 @@ function eq(value, other) { * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -257,8 +231,7 @@ function isArrayLike(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -266,16 +239,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -297,7 +269,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -414,7 +386,7 @@ function toFinite(value) { * Converts `value` to an integer. * * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ @@ -474,7 +446,7 @@ function toNumber(value) { return NAN; } if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { diff --git a/lodash.slice/package.json b/lodash.slice/package.json index 56b191a5b..be0394501 100644 --- a/lodash.slice/package.json +++ b/lodash.slice/package.json @@ -1,6 +1,6 @@ { "name": "lodash.slice", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.slice` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.some/README.md b/lodash.some/README.md index 5acc47046..9afcee7f6 100644 --- a/lodash.some/README.md +++ b/lodash.some/README.md @@ -1,4 +1,4 @@ -# lodash.some v4.1.1 +# lodash.some v4.2.0 The [lodash](https://lodash.com/) method `_.some` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var some = require('lodash.some'); ``` -See the [documentation](https://lodash.com/docs#some) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.some) for more details. +See the [documentation](https://lodash.com/docs#some) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.some) for more details. diff --git a/lodash.some/index.js b/lodash.some/index.js index 685f39535..7fe1eca45 100644 --- a/lodash.some/index.js +++ b/lodash.some/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,16 +7,7 @@ * Available under MIT license */ var baseEach = require('lodash._baseeach'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; + baseIteratee = require('lodash._baseiteratee'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -25,14 +16,6 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; @@ -80,92 +63,6 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.property` without support for deep paths. * @@ -179,19 +76,6 @@ function baseProperty(key) { }; } -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - /** * The base implementation of `_.some` without support for iteratee shorthands. * @@ -210,18 +94,6 @@ function baseSome(collection, predicate) { return !!result; } -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -234,23 +106,6 @@ function baseToPath(value) { */ var getLength = baseProperty('length'); -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - /** * Checks if the given arguments are from an iteratee call. * @@ -273,50 +128,6 @@ function isIterateeCall(value, index, object) { return false; } -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Checks if `predicate` returns truthy for **any** element of `collection`. * Iteration is stopped once `predicate` returns truthy. The predicate is @@ -398,7 +209,7 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -425,7 +236,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -497,7 +307,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -528,48 +339,4 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = some; diff --git a/lodash.some/package.json b/lodash.some/package.json index 450facca9..7832a5214 100644 --- a/lodash.some/package.json +++ b/lodash.some/package.json @@ -1,6 +1,6 @@ { "name": "lodash.some", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.some` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,11 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeach": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.sortby/README.md b/lodash.sortby/README.md index cee186a0d..3849c27d8 100644 --- a/lodash.sortby/README.md +++ b/lodash.sortby/README.md @@ -1,4 +1,4 @@ -# lodash.sortby v4.1.1 +# lodash.sortby v4.2.0 The [lodash](https://lodash.com/) method `_.sortBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var sortBy = require('lodash.sortby'); ``` -See the [documentation](https://lodash.com/docs#sortBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.sortby) for more details. +See the [documentation](https://lodash.com/docs#sortBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.sortby) for more details. diff --git a/lodash.sortby/index.js b/lodash.sortby/index.js index 027868f46..1fb7a87bb 100644 --- a/lodash.sortby/index.js +++ b/lodash.sortby/index.js @@ -1,25 +1,15 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - baseEach = require('lodash._baseeach'), +var baseEach = require('lodash._baseeach'), baseFlatten = require('lodash._baseflatten'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; + baseIteratee = require('lodash._baseiteratee'), + rest = require('lodash.rest'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -28,17 +18,29 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + /** * The base implementation of `_.sortBy` which uses `comparer` to define * the sort order of `array` and replaces criteria objects with their @@ -155,49 +157,6 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - /** * The base implementation of `_.map` without support for iteratee shorthands. * @@ -216,49 +175,6 @@ function baseMap(collection, iteratee) { return result; } -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.orderBy` without param guards. * @@ -301,31 +217,6 @@ function baseProperty(key) { }; } -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - /** * Gets the "length" property value of `object`. * @@ -338,23 +229,6 @@ function baseToPath(value) { */ var getLength = baseProperty('length'); -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - /** * Checks if the given arguments are from an iteratee call. * @@ -377,50 +251,6 @@ function isIterateeCall(value, index, object) { return false; } -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates an array of elements, sorted in ascending order by the results of * running each element in a collection through each iteratee. This method @@ -464,7 +294,7 @@ var sortBy = rest(function(collection, iteratees) { } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees.length = 1; } - return baseOrderBy(collection, baseFlatten(iteratees), []); + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); /** @@ -501,31 +331,6 @@ function eq(value, other) { return value === other || (value !== value && other !== other); } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -533,7 +338,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -605,7 +409,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -636,48 +441,4 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = sortBy; diff --git a/lodash.sortby/package.json b/lodash.sortby/package.json index 1446dcb2c..ed9e80484 100644 --- a/lodash.sortby/package.json +++ b/lodash.sortby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sortby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.sortBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,15 +15,9 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash._baseeach": "^4.0.0", "lodash._baseflatten": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.sortedindexby/README.md b/lodash.sortedindexby/README.md index cd6209ab0..7e2496e46 100644 --- a/lodash.sortedindexby/README.md +++ b/lodash.sortedindexby/README.md @@ -1,4 +1,4 @@ -# lodash.sortedindexby v4.1.1 +# lodash.sortedindexby v4.2.0 The [lodash](https://lodash.com/) method `_.sortedIndexBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var sortedIndexBy = require('lodash.sortedindexby'); ``` -See the [documentation](https://lodash.com/docs#sortedIndexBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.sortedindexby) for more details. +See the [documentation](https://lodash.com/docs#sortedIndexBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.sortedindexby) for more details. diff --git a/lodash.sortedindexby/index.js b/lodash.sortedindexby/index.js index 41efd5d7f..4dccb1c3b 100644 --- a/lodash.sortedindexby/index.js +++ b/lodash.sortedindexby/index.js @@ -1,215 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - baseSortedIndexBy = require('lodash._basesortedindexby'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} +var baseIteratee = require('lodash._baseiteratee'), + baseSortedIndexBy = require('lodash._basesortedindexby'); /** * This method is like `_.sortedIndex` except that it accepts `iteratee` @@ -238,101 +36,4 @@ function sortedIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, baseIteratee(iteratee)); } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = sortedIndexBy; diff --git a/lodash.sortedindexby/package.json b/lodash.sortedindexby/package.json index ba6b23527..c8bd9eb52 100644 --- a/lodash.sortedindexby/package.json +++ b/lodash.sortedindexby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sortedindexby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.sortedIndexBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._basesortedindexby": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._basesortedindexby": "^4.0.0" } } diff --git a/lodash.sortedlastindexby/README.md b/lodash.sortedlastindexby/README.md index 2aa479a8a..b76e12d72 100644 --- a/lodash.sortedlastindexby/README.md +++ b/lodash.sortedlastindexby/README.md @@ -1,4 +1,4 @@ -# lodash.sortedlastindexby v4.1.1 +# lodash.sortedlastindexby v4.2.0 The [lodash](https://lodash.com/) method `_.sortedLastIndexBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var sortedLastIndexBy = require('lodash.sortedlastindexby'); ``` -See the [documentation](https://lodash.com/docs#sortedLastIndexBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.sortedlastindexby) for more details. +See the [documentation](https://lodash.com/docs#sortedLastIndexBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.sortedlastindexby) for more details. diff --git a/lodash.sortedlastindexby/index.js b/lodash.sortedlastindexby/index.js index 0265054e0..3c37a8902 100644 --- a/lodash.sortedlastindexby/index.js +++ b/lodash.sortedlastindexby/index.js @@ -1,215 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - baseSortedIndexBy = require('lodash._basesortedindexby'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} +var baseIteratee = require('lodash._baseiteratee'), + baseSortedIndexBy = require('lodash._basesortedindexby'); /** * This method is like `_.sortedLastIndex` except that it accepts `iteratee` @@ -233,101 +31,4 @@ function sortedLastIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, baseIteratee(iteratee), true); } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = sortedLastIndexBy; diff --git a/lodash.sortedlastindexby/package.json b/lodash.sortedlastindexby/package.json index 3a033337b..126f06988 100644 --- a/lodash.sortedlastindexby/package.json +++ b/lodash.sortedlastindexby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sortedlastindexby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.sortedLastIndexBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._basesortedindexby": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._basesortedindexby": "^4.0.0" } } diff --git a/lodash.sorteduniq/README.md b/lodash.sorteduniq/README.md index 86b0cfed0..53d79a24e 100644 --- a/lodash.sorteduniq/README.md +++ b/lodash.sorteduniq/README.md @@ -1,4 +1,4 @@ -# lodash.sorteduniq v4.1.0 +# lodash.sorteduniq v4.2.0 The [lodash](https://lodash.com/) method `_.sortedUniq` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var sortedUniq = require('lodash.sorteduniq'); ``` -See the [documentation](https://lodash.com/docs#sortedUniq) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.sorteduniq) for more details. +See the [documentation](https://lodash.com/docs#sortedUniq) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.sorteduniq) for more details. diff --git a/lodash.sorteduniq/index.js b/lodash.sorteduniq/index.js index 8bf9b716a..201b638e6 100644 --- a/lodash.sorteduniq/index.js +++ b/lodash.sorteduniq/index.js @@ -6,7 +6,33 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseSortedUniq = require('lodash._basesorteduniq'); + +/** + * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ +function baseSortedUniq(array, iteratee) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + if (!index || !eq(computed, seen)) { + var seen = computed; + result[resIndex++] = value === 0 ? 0 : value; + } + } + return result; +} /** * This method is like `_.uniq` except that it's designed and optimized @@ -29,4 +55,40 @@ function sortedUniq(array) { : []; } +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + module.exports = sortedUniq; diff --git a/lodash.sorteduniq/package.json b/lodash.sorteduniq/package.json index 8beb7e83a..cf2cde233 100644 --- a/lodash.sorteduniq/package.json +++ b/lodash.sorteduniq/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sorteduniq", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.sortedUniq` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,8 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._basesorteduniq": "~4.12.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.sorteduniqby/README.md b/lodash.sorteduniqby/README.md index e5f66090c..2661431bd 100644 --- a/lodash.sorteduniqby/README.md +++ b/lodash.sorteduniqby/README.md @@ -1,4 +1,4 @@ -# lodash.sorteduniqby v4.1.1 +# lodash.sorteduniqby v4.2.0 The [lodash](https://lodash.com/) method `_.sortedUniqBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var sortedUniqBy = require('lodash.sorteduniqby'); ``` -See the [documentation](https://lodash.com/docs#sortedUniqBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.sorteduniqby) for more details. +See the [documentation](https://lodash.com/docs#sortedUniqBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.sorteduniqby) for more details. diff --git a/lodash.sorteduniqby/index.js b/lodash.sorteduniqby/index.js index b2af235c4..d467fa482 100644 --- a/lodash.sorteduniqby/index.js +++ b/lodash.sorteduniqby/index.js @@ -1,215 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - baseSortedUniqBy = require('lodash._basesorteduniqby'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} +var baseIteratee = require('lodash._baseiteratee'), + baseSortedUniqBy = require('lodash._basesorteduniqby'); /** * This method is like `_.uniqBy` except that it's designed and optimized @@ -232,101 +30,4 @@ function sortedUniqBy(array, iteratee) { : []; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = sortedUniqBy; diff --git a/lodash.sorteduniqby/package.json b/lodash.sorteduniqby/package.json index d277819f7..b0c4a30a5 100644 --- a/lodash.sorteduniqby/package.json +++ b/lodash.sorteduniqby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sorteduniqby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.sortedUniqBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._basesorteduniqby": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._basesorteduniqby": "^4.0.0" } } diff --git a/lodash.split/README.md b/lodash.split/README.md index b38a80e22..1d88cbe99 100644 --- a/lodash.split/README.md +++ b/lodash.split/README.md @@ -1,4 +1,4 @@ -# lodash.split v4.1.2 +# lodash.split v4.2.0 The [lodash](https://lodash.com/) method `_.split` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var split = require('lodash.split'); ``` -See the [documentation](https://lodash.com/docs#split) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.split) for more details. +See the [documentation](https://lodash.com/docs#split) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.split) for more details. diff --git a/lodash.split/index.js b/lodash.split/index.js index 1b0f5aa88..8f09d7471 100644 --- a/lodash.split/index.js +++ b/lodash.split/index.js @@ -1,15 +1,27 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var toString = require('lodash.tostring'); +var baseSlice = require('lodash._baseslice'), + toString = require('lodash.tostring'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** Used as references for the maximum length and index of an array. */ +var MAX_ARRAY_LENGTH = 4294967295; /** `Object#toString` result references. */ -var regexpTag = '[object RegExp]'; +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + regexpTag = '[object RegExp]'; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', @@ -40,6 +52,20 @@ var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; +} + /** * Converts `string` to an array. * @@ -61,6 +87,194 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; +} + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) @@ -133,6 +347,13 @@ function isRegExp(value) { * // => ['a', 'b'] */ function split(string, separator, limit) { + if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { + separator = limit = undefined; + } + limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; + if (!limit) { + return []; + } string = toString(string); if (string && ( typeof separator == 'string' || @@ -140,8 +361,7 @@ function split(string, separator, limit) { )) { separator += ''; if (separator == '' && reHasComplexSymbol.test(string)) { - var strSymbols = stringToArray(string); - return limit === undefined ? strSymbols : strSymbols.slice(0, limit < 0 ? 0 : limit); + return castSlice(stringToArray(string), 0, limit); } } return string.split(separator, limit); diff --git a/lodash.split/package.json b/lodash.split/package.json index 7005a845a..4ae48c303 100644 --- a/lodash.split/package.json +++ b/lodash.split/package.json @@ -1,6 +1,6 @@ { "name": "lodash.split", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.split` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { + "lodash._baseslice": "~4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.spread/README.md b/lodash.spread/README.md index 83c79cfc1..a93d47e75 100644 --- a/lodash.spread/README.md +++ b/lodash.spread/README.md @@ -1,4 +1,4 @@ -# lodash.spread v4.1.1 +# lodash.spread v4.2.0 The [lodash](https://lodash.com/) method `_.spread` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var spread = require('lodash.spread'); ``` -See the [documentation](https://lodash.com/docs#spread) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.spread) for more details. +See the [documentation](https://lodash.com/docs#spread) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.spread) for more details. diff --git a/lodash.spread/index.js b/lodash.spread/index.js index 0f04e434c..f297de3e4 100644 --- a/lodash.spread/index.js +++ b/lodash.spread/index.js @@ -6,8 +6,6 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseSlice = require('lodash._baseslice'), - rest = require('lodash.rest'); /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -48,8 +46,7 @@ var freeParseInt = parseInt; * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { - var length = args.length; - switch (length) { + switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); @@ -90,6 +87,65 @@ var objectToString = objectProto.toString; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} + /** * Casts `array` to a slice if it's needed. * @@ -144,7 +200,7 @@ function spread(func, start) { throw new TypeError(FUNC_ERROR_TEXT); } start = start === undefined ? 0 : nativeMax(toInteger(start), 0); - return rest(function(args) { + return baseRest(function(args) { var array = args[start], otherArgs = castSlice(args, 0, start); @@ -163,8 +219,7 @@ function spread(func, start) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -247,8 +302,7 @@ function isObjectLike(value) { * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); @@ -300,7 +354,7 @@ function toFinite(value) { /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on + * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static diff --git a/lodash.spread/package.json b/lodash.spread/package.json index 17e7b4921..33c9483d3 100644 --- a/lodash.spread/package.json +++ b/lodash.spread/package.json @@ -1,6 +1,6 @@ { "name": "lodash.spread", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.spread` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._baseslice": "~4.0.0", - "lodash.rest": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.startcase/LICENSE b/lodash.startcase/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.startcase/LICENSE +++ b/lodash.startcase/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.startcase/README.md b/lodash.startcase/README.md index 4b9d0ccd5..f0a89c148 100644 --- a/lodash.startcase/README.md +++ b/lodash.startcase/README.md @@ -1,4 +1,4 @@ -# lodash.startcase v4.1.0 +# lodash.startcase v4.2.0 The [lodash](https://lodash.com/) method `_.startCase` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var startCase = require('lodash.startcase'); ``` -See the [documentation](https://lodash.com/docs#startCase) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.startcase) for more details. +See the [documentation](https://lodash.com/docs#startCase) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.startcase) for more details. diff --git a/lodash.startcase/index.js b/lodash.startcase/index.js index 82622cbb8..9667f98b3 100644 --- a/lodash.startcase/index.js +++ b/lodash.startcase/index.js @@ -1,13 +1,13 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var capitalize = require('lodash.capitalize'), - deburr = require('lodash.deburr'), +var deburr = require('lodash.deburr'), + upperFirst = require('lodash.upperfirst'), words = require('lodash.words'); /** @@ -18,7 +18,8 @@ var capitalize = require('lodash.capitalize'), * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { @@ -48,26 +49,28 @@ function createCompounder(callback) { } /** - * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * Converts `string` to + * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). * * @static * @memberOf _ + * @since 3.1.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the start cased string. * @example * - * _.startCase('--foo-bar'); + * _.startCase('--foo-bar--'); * // => 'Foo Bar' * * _.startCase('fooBar'); * // => 'Foo Bar' * - * _.startCase('__foo_bar__'); - * // => 'Foo Bar' + * _.startCase('__FOO_BAR__'); + * // => 'FOO BAR' */ var startCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + capitalize(word); + return result + (index ? ' ' : '') + upperFirst(word); }); module.exports = startCase; diff --git a/lodash.startcase/package.json b/lodash.startcase/package.json index 87f30f4ec..324adaf9a 100644 --- a/lodash.startcase/package.json +++ b/lodash.startcase/package.json @@ -1,6 +1,6 @@ { "name": "lodash.startcase", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.startCase` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,14 +9,14 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash.capitalize": "^4.0.0", "lodash.deburr": "^4.0.0", + "lodash.upperfirst": "^4.0.0", "lodash.words": "^4.0.0" } } diff --git a/lodash.startswith/README.md b/lodash.startswith/README.md index 7a47efba3..0ad94219b 100644 --- a/lodash.startswith/README.md +++ b/lodash.startswith/README.md @@ -1,4 +1,4 @@ -# lodash.startswith v4.1.0 +# lodash.startswith v4.2.0 The [lodash](https://lodash.com/) method `_.startsWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var startsWith = require('lodash.startswith'); ``` -See the [documentation](https://lodash.com/docs#startsWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.startswith) for more details. +See the [documentation](https://lodash.com/docs#startsWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.startswith) for more details. diff --git a/lodash.startswith/index.js b/lodash.startswith/index.js index 1d25525fd..2742bddc2 100644 --- a/lodash.startswith/index.js +++ b/lodash.startswith/index.js @@ -6,8 +6,6 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseToString = require('lodash._basetostring'), - toString = require('lodash.tostring'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, @@ -34,6 +32,15 @@ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -44,8 +51,15 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + /** - * The base implementation of `_.clamp` which doesn't coerce arguments to numbers. + * The base implementation of `_.clamp` which doesn't coerce arguments. * * @private * @param {number} number The number to clamp. @@ -65,6 +79,26 @@ function baseClamp(number, lower, upper) { return number; } +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + /** * Checks if `value` is classified as a `Function` object. * @@ -73,8 +107,7 @@ function baseClamp(number, lower, upper) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -157,8 +190,7 @@ function isObjectLike(value) { * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); @@ -210,7 +242,7 @@ function toFinite(value) { /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on + * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static @@ -284,6 +316,31 @@ function toNumber(value) { : (reIsBadHex.test(value) ? NAN : +value); } +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + /** * Checks if `string` starts with the given target string. * @@ -310,7 +367,8 @@ function toNumber(value) { function startsWith(string, target, position) { string = toString(string); position = baseClamp(toInteger(position), 0, string.length); - return string.lastIndexOf(baseToString(target), position) == position; + target = baseToString(target); + return string.slice(position, position + target.length) == target; } module.exports = startsWith; diff --git a/lodash.startswith/package.json b/lodash.startswith/package.json index f1509f3a0..37ffb47ce 100644 --- a/lodash.startswith/package.json +++ b/lodash.startswith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.startswith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.startsWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._basetostring": "~4.12.0", - "lodash.tostring": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.subtract/README.md b/lodash.subtract/README.md index 82e24d474..2bf64a040 100644 --- a/lodash.subtract/README.md +++ b/lodash.subtract/README.md @@ -1,4 +1,4 @@ -# lodash.subtract v4.1.0 +# lodash.subtract v4.2.0 The [lodash](https://lodash.com/) method `_.subtract` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var subtract = require('lodash.subtract'); ``` -See the [documentation](https://lodash.com/docs#subtract) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.subtract) for more details. +See the [documentation](https://lodash.com/docs#subtract) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.subtract) for more details. diff --git a/lodash.subtract/index.js b/lodash.subtract/index.js index be8621314..a36041619 100644 --- a/lodash.subtract/index.js +++ b/lodash.subtract/index.js @@ -6,21 +6,91 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseToNumber = require('lodash._basetonumber'), - baseToString = require('lodash._basetostring'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + NAN = 0 / 0; + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.toNumber` which doesn't ensure correct + * conversions of binary, hexadecimal, or octal string values. + * + * @private + * @param {*} value The value to process. + * @returns {number} Returns the number. + */ +function baseToNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + return +value; +} + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} /** * Creates a function that performs a mathematical operation on two values. * * @private * @param {Function} operator The function to perform the operation. + * @param {number} [defaultValue] The value used for `undefined` arguments. * @returns {Function} Returns the new mathematical operation function. */ -function createMathOperation(operator) { +function createMathOperation(operator, defaultValue) { return function(value, other) { var result; if (value === undefined && other === undefined) { - return 0; + return defaultValue; } if (value !== undefined) { result = value; @@ -42,6 +112,56 @@ function createMathOperation(operator) { }; } +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + /** * Subtract two numbers. * @@ -59,6 +179,6 @@ function createMathOperation(operator) { */ var subtract = createMathOperation(function(minuend, subtrahend) { return minuend - subtrahend; -}); +}, 0); module.exports = subtract; diff --git a/lodash.subtract/package.json b/lodash.subtract/package.json index bffe42388..4f1f99dd5 100644 --- a/lodash.subtract/package.json +++ b/lodash.subtract/package.json @@ -1,6 +1,6 @@ { "name": "lodash.subtract", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.subtract` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._basetonumber": "~4.12.0", - "lodash._basetostring": "~4.12.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.sumby/README.md b/lodash.sumby/README.md index 1c75910b0..87a9f4796 100644 --- a/lodash.sumby/README.md +++ b/lodash.sumby/README.md @@ -1,4 +1,4 @@ -# lodash.sumby v4.1.1 +# lodash.sumby v4.2.0 The [lodash](https://lodash.com/) method `_.sumBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var sumBy = require('lodash.sumby'); ``` -See the [documentation](https://lodash.com/docs#sumBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.sumby) for more details. +See the [documentation](https://lodash.com/docs#sumBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.sumby) for more details. diff --git a/lodash.sumby/index.js b/lodash.sumby/index.js index 37e04543a..bf5c6b1e4 100644 --- a/lodash.sumby/index.js +++ b/lodash.sumby/index.js @@ -1,29 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; +var baseIteratee = require('lodash._baseiteratee'); /** * The base implementation of `_.sum` without support for iteratee shorthands. @@ -47,288 +30,6 @@ function baseSum(array, iteratee) { return result; } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - /** * This method is like `_.sum` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the value to be summed. diff --git a/lodash.sumby/package.json b/lodash.sumby/package.json index 08e5d89ff..8e9341dd5 100644 --- a/lodash.sumby/package.json +++ b/lodash.sumby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sumby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.sumBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,11 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0" } } diff --git a/lodash.takerightwhile/README.md b/lodash.takerightwhile/README.md index 86374d746..df862e982 100644 --- a/lodash.takerightwhile/README.md +++ b/lodash.takerightwhile/README.md @@ -1,4 +1,4 @@ -# lodash.takerightwhile v4.1.1 +# lodash.takerightwhile v4.2.0 The [lodash](https://lodash.com/) method `_.takeRightWhile` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var takeRightWhile = require('lodash.takerightwhile'); ``` -See the [documentation](https://lodash.com/docs#takeRightWhile) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.takerightwhile) for more details. +See the [documentation](https://lodash.com/docs#takeRightWhile) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.takerightwhile) for more details. diff --git a/lodash.takerightwhile/index.js b/lodash.takerightwhile/index.js index e36992d2a..1e97ca07c 100644 --- a/lodash.takerightwhile/index.js +++ b/lodash.takerightwhile/index.js @@ -1,154 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} +var baseIteratee = require('lodash._baseiteratee'), + baseSlice = require('lodash._baseslice'); /** * The base implementation of methods like `_.dropWhile` and `_.takeWhile` @@ -173,67 +32,6 @@ function baseWhile(array, predicate, isDrop, fromRight) { : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates a slice of `array` with elements taken from the end. Elements are * taken until `predicate` returns falsey. The predicate is invoked with three @@ -274,101 +72,4 @@ function takeRightWhile(array, predicate) { : []; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = takeRightWhile; diff --git a/lodash.takerightwhile/package.json b/lodash.takerightwhile/package.json index dbcd1a8ec..74055b1d4 100644 --- a/lodash.takerightwhile/package.json +++ b/lodash.takerightwhile/package.json @@ -1,6 +1,6 @@ { "name": "lodash.takerightwhile", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.takeRightWhile` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._baseslice": "^4.0.0" } } diff --git a/lodash.takewhile/README.md b/lodash.takewhile/README.md index 5b6c78024..d7ef3355f 100644 --- a/lodash.takewhile/README.md +++ b/lodash.takewhile/README.md @@ -1,4 +1,4 @@ -# lodash.takewhile v4.1.1 +# lodash.takewhile v4.2.0 The [lodash](https://lodash.com/) method `_.takeWhile` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var takeWhile = require('lodash.takewhile'); ``` -See the [documentation](https://lodash.com/docs#takeWhile) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.takewhile) for more details. +See the [documentation](https://lodash.com/docs#takeWhile) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.takewhile) for more details. diff --git a/lodash.takewhile/index.js b/lodash.takewhile/index.js index 998bbc774..75b17fee6 100644 --- a/lodash.takewhile/index.js +++ b/lodash.takewhile/index.js @@ -1,154 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} +var baseIteratee = require('lodash._baseiteratee'), + baseSlice = require('lodash._baseslice'); /** * The base implementation of methods like `_.dropWhile` and `_.takeWhile` @@ -173,67 +32,6 @@ function baseWhile(array, predicate, isDrop, fromRight) { : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Creates a slice of `array` with elements taken from the beginning. Elements * are taken until `predicate` returns falsey. The predicate is invoked with @@ -274,101 +72,4 @@ function takeWhile(array, predicate) { : []; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = takeWhile; diff --git a/lodash.takewhile/package.json b/lodash.takewhile/package.json index 1227bb605..d44d8472f 100644 --- a/lodash.takewhile/package.json +++ b/lodash.takewhile/package.json @@ -1,6 +1,6 @@ { "name": "lodash.takewhile", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.takeWhile` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._baseslice": "^4.0.0" } } diff --git a/lodash.template/README.md b/lodash.template/README.md index 6a0fcd559..231eceb04 100644 --- a/lodash.template/README.md +++ b/lodash.template/README.md @@ -1,4 +1,4 @@ -# lodash.template v4.1.1 +# lodash.template v4.2.0 The [lodash](https://lodash.com/) method `_.template` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var template = require('lodash.template'); ``` -See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.template) for more details. +See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.template) for more details. diff --git a/lodash.template/index.js b/lodash.template/index.js index 5c657b7fa..a4a1ce6a5 100644 --- a/lodash.template/index.js +++ b/lodash.template/index.js @@ -1,13 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - assignInWith = require('lodash.assigninwith'), +var assignInWith = require('lodash.assigninwith'), keys = require('lodash.keys'), reInterpolate = require('lodash._reinterpolate'), rest = require('lodash.rest'), @@ -70,6 +69,26 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names @@ -229,7 +248,6 @@ function eq(value, other) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -270,8 +288,12 @@ function isArrayLike(value) { * // => false */ function isError(value) { - return isObjectLike(value) && - typeof value.message == 'string' && objectToString.call(value) == errorTag; + if (!isObjectLike(value)) { + return false; + } + var Ctor = value.constructor; + return (objectToString.call(value) == errorTag) || + (typeof Ctor == 'function' && objectToString.call(Ctor.prototype) == errorTag); } /** @@ -323,7 +345,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -567,7 +590,8 @@ function template(string, options, guard) { 'return __p\n}'; var result = attempt(function() { - return Function(importsKeys, sourceURL + 'return ' + source).apply(undefined, importsValues); + return Function(importsKeys, sourceURL + 'return ' + source) + .apply(undefined, importsValues); }); // Provide the compiled function's source by its `toString` method or @@ -603,7 +627,7 @@ var attempt = rest(function(func, args) { try { return apply(func, undefined, args); } catch (e) { - return isObject(e) ? e : new Error(e); + return isError(e) ? e : new Error(e); } }); diff --git a/lodash.template/package.json b/lodash.template/package.json index 0645d85be..d1b2dc158 100644 --- a/lodash.template/package.json +++ b/lodash.template/package.json @@ -1,6 +1,6 @@ { "name": "lodash.template", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.template` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,11 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash._reinterpolate": "^3.0.0", "lodash.assigninwith": "^4.0.0", "lodash.keys": "^4.0.0", "lodash.rest": "^4.0.0", - "lodash.templatesettings": "^3.0.0", + "lodash.templatesettings": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.templatesettings/LICENSE b/lodash.templatesettings/LICENSE index e0c69d560..77c42f140 100644 --- a/lodash.templatesettings/LICENSE +++ b/lodash.templatesettings/LICENSE @@ -1,4 +1,4 @@ -Copyright jQuery Foundation and other contributors +Copyright OpenJS Foundation and other contributors Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors diff --git a/lodash.templatesettings/README.md b/lodash.templatesettings/README.md index dac06625a..e66d0ee9f 100644 --- a/lodash.templatesettings/README.md +++ b/lodash.templatesettings/README.md @@ -1,6 +1,6 @@ -# lodash.templatesettings v4.1.0 +# lodash.templatesettings v4.2.0 -The [lodash](https://lodash.com/) method `_.templateSettings` exported as a [Node.js](https://nodejs.org/) module. +The [Lodash](https://lodash.com/) method `_.templateSettings` exported as a [Node.js](https://nodejs.org/) module. ## Installation @@ -15,4 +15,4 @@ In Node.js: var templateSettings = require('lodash.templatesettings'); ``` -See the [documentation](https://lodash.com/docs#templateSettings) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.templatesettings) for more details. +See the [documentation](https://lodash.com/docs#templateSettings) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.templatesettings) for more details. diff --git a/lodash.templatesettings/index.js b/lodash.templatesettings/index.js index d28212362..b75de5d7d 100644 --- a/lodash.templatesettings/index.js +++ b/lodash.templatesettings/index.js @@ -1,7 +1,7 @@ /** - * lodash (Custom Build) + * Lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors @@ -12,10 +12,12 @@ var reInterpolate = require('lodash._reinterpolate'); var INFINITY = 1 / 0; /** `Object#toString` result references. */ -var symbolTag = '[object Symbol]'; +var nullTag = '[object Null]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]'; /** Used to match HTML entities and HTML characters. */ -var reUnescapedHtml = /[&<>"'`]/g, +var reUnescapedHtml = /[&<>"']/g, reHasUnescapedHtml = RegExp(reUnescapedHtml.source); /** Used to match template delimiters. */ @@ -28,8 +30,7 @@ var htmlEscapes = { '<': '<', '>': '>', '"': '"', - "'": ''', - '`': '`' + "'": ''' }; /** Detect free variable `global` from Node.js. */ @@ -41,6 +42,26 @@ var freeSelf = typeof self == 'object' && self && self.Object === Object && self /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + /** * The base implementation of `_.propertyOf` without support for deep paths. * @@ -66,15 +87,19 @@ var escapeHtmlChar = basePropertyOf(htmlEscapes); /** Used for built-in method references. */ var objectProto = Object.prototype; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ -var objectToString = objectProto.toString; +var nativeObjectToString = objectProto.toString; /** Built-in value references. */ -var Symbol = root.Symbol; +var Symbol = root.Symbol, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, @@ -82,8 +107,8 @@ var symbolProto = Symbol ? Symbol.prototype : undefined, /** * By default, the template delimiters used by lodash are like those in - * embedded Ruby (ERB). Change the following template settings to use - * alternative delimiters. + * embedded Ruby (ERB) as well as ES2015 template strings. Change the + * following template settings to use alternative delimiters. * * @static * @memberOf _ @@ -141,6 +166,22 @@ var templateSettings = { } }; +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} + /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. @@ -154,6 +195,10 @@ function baseToString(value) { if (typeof value == 'string') { return value; } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } @@ -161,6 +206,69 @@ function baseToString(value) { return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} + +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString(value) { + return nativeObjectToString.call(value); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". @@ -186,7 +294,7 @@ function baseToString(value) { * // => false */ function isObjectLike(value) { - return !!value && typeof value == 'object'; + return value != null && typeof value == 'object'; } /** @@ -208,7 +316,7 @@ function isObjectLike(value) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -219,8 +327,8 @@ function isSymbol(value) { * @memberOf _ * @since 4.0.0 * @category Lang - * @param {*} value The value to process. - * @returns {string} Returns the string. + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. * @example * * _.toString(null); @@ -237,8 +345,8 @@ function toString(value) { } /** - * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to - * their corresponding HTML entities. + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional * characters use a third-party library like [_he_](https://mths.be/he). @@ -249,12 +357,6 @@ function toString(value) { * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * - * Backticks are escaped because in IE < 9, they can break out of - * attribute values or HTML comments. See [#59](https://html5sec.org/#59), - * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and - * [#133](https://html5sec.org/#133) of the - * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. - * * When working with HTML you should always * [quote attribute values](http://wonko.com/post/html-escaping) to reduce * XSS vectors. diff --git a/lodash.templatesettings/package.json b/lodash.templatesettings/package.json index 1b0875cbc..a499e91a9 100644 --- a/lodash.templatesettings/package.json +++ b/lodash.templatesettings/package.json @@ -1,20 +1,19 @@ { "name": "lodash.templatesettings", - "version": "4.1.0", - "description": "The lodash method `_.templateSettings` exported as a module.", + "version": "4.2.0", + "description": "The Lodash method `_.templateSettings` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", "license": "MIT", "keywords": "lodash-modularized, templatesettings", - "author": "John-David Dalton (http://allyoucanleet.com/)", + "author": "John-David Dalton ", "contributors": [ - "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", - "Mathias Bynens (https://mathiasbynens.be/)" + "John-David Dalton ", + "Mathias Bynens " ], "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._reinterpolate": "~3.0.0" + "lodash._reinterpolate": "^3.0.0" } } diff --git a/lodash.times/README.md b/lodash.times/README.md index a98833cc5..ecc18a9bb 100644 --- a/lodash.times/README.md +++ b/lodash.times/README.md @@ -1,4 +1,4 @@ -# lodash.times v4.1.1 +# lodash.times v4.2.0 The [lodash](https://lodash.com/) method `_.times` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var times = require('lodash.times'); ``` -See the [documentation](https://lodash.com/docs#times) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.times) for more details. +See the [documentation](https://lodash.com/docs#times) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.times) for more details. diff --git a/lodash.times/package.json b/lodash.times/package.json index 96205e491..a9a6903b4 100644 --- a/lodash.times/package.json +++ b/lodash.times/package.json @@ -1,6 +1,6 @@ { "name": "lodash.times", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.times` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseiteratee": "~4.6.0" + "lodash._baseiteratee": "~4.7.0" } } diff --git a/lodash.toarray/README.md b/lodash.toarray/README.md index ede3d5301..8c1675697 100644 --- a/lodash.toarray/README.md +++ b/lodash.toarray/README.md @@ -1,4 +1,4 @@ -# lodash.toarray v4.1.1 +# lodash.toarray v4.2.0 The [lodash](https://lodash.com/) method `_.toArray` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var toArray = require('lodash.toarray'); ``` -See the [documentation](https://lodash.com/docs#toArray) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.toarray) for more details. +See the [documentation](https://lodash.com/docs#toArray) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.toarray) for more details. diff --git a/lodash.toarray/index.js b/lodash.toarray/index.js index f58677eec..1ccf77098 100644 --- a/lodash.toarray/index.js +++ b/lodash.toarray/index.js @@ -1,13 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - keys = require('lodash.keys'), +var keys = require('lodash.keys'), root = require('lodash._root'); /** Used as references for various `Number` constants. */ @@ -54,6 +53,26 @@ var reOptMod = rsModifier + '?', /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names @@ -279,7 +298,7 @@ if ((Map && getTag(new Map) != mapTag) || * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -306,7 +325,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -378,7 +396,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** diff --git a/lodash.toarray/package.json b/lodash.toarray/package.json index cc8a4c04c..ad0447514 100644 --- a/lodash.toarray/package.json +++ b/lodash.toarray/package.json @@ -1,6 +1,6 @@ { "name": "lodash.toarray", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.toArray` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash._root": "^3.0.0", "lodash.keys": "^4.0.0" } diff --git a/lodash.topairs/README.md b/lodash.topairs/README.md index e7e2cefff..1e3177cbc 100644 --- a/lodash.topairs/README.md +++ b/lodash.topairs/README.md @@ -1,4 +1,4 @@ -# lodash.topairs v4.1.1 +# lodash.topairs v4.2.0 The [lodash](https://lodash.com/) method `_.toPairs` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var toPairs = require('lodash.topairs'); ``` -See the [documentation](https://lodash.com/docs#toPairs) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.topairs) for more details. +See the [documentation](https://lodash.com/docs#toPairs) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.topairs) for more details. diff --git a/lodash.topairs/index.js b/lodash.topairs/index.js index 5b7d01f42..488fbba86 100644 --- a/lodash.topairs/index.js +++ b/lodash.topairs/index.js @@ -6,16 +6,19 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var keys = require('lodash.keys'), - root = require('lodash._root'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ -var funcTag = '[object Function]', +var argsTag = '[object Arguments]', + funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', objectTag = '[object Object]', promiseTag = '[object Promise]', setTag = '[object Set]', + stringTag = '[object String]', weakMapTag = '[object WeakMap]'; var dataViewTag = '[object DataView]'; @@ -29,18 +32,30 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array.length, + length = array ? array.length : 0, result = Array(length); while (++index < length) { @@ -49,6 +64,38 @@ function arrayMap(array, iteratee) { return result; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + /** * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array * of key-value pairs for `object` corresponding to the property names of `props`. @@ -64,6 +111,18 @@ function baseToPairs(object, props) { }); } +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + /** * Checks if `value` is a host object in IE < 9. * @@ -100,6 +159,20 @@ function mapToArray(map) { return result; } +/** + * Creates a function that invokes `func` with its first argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + /** * Converts `set` to its value-value pairs. * @@ -120,6 +193,15 @@ function setToPairs(set) { /** Used for built-in method references. */ var objectProto = Object.prototype; +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + /** Used to resolve the decompiled source of functions. */ var funcToString = Function.prototype.toString; @@ -139,6 +221,13 @@ var reIsNative = RegExp('^' + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetPrototype = Object.getPrototypeOf, + nativeKeys = Object.keys; + /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), @@ -153,6 +242,60 @@ var dataViewCtorString = toSource(DataView), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); +/** + * The base implementation of `getTag`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + return objectToString.call(value); +} + +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return object != null && + (hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null)); +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.keys` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +var baseKeys = overArg(nativeKeys, Object); + /** * Creates a `_.toPairs` or `_.toPairsIn` function. * @@ -173,6 +316,19 @@ function createToPairs(keysFunc) { }; } +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + /** * Gets the native function at `key` of `object`. * @@ -182,10 +338,19 @@ function createToPairs(keysFunc) { * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = object[key]; - return isNative(value) ? value : undefined; + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; } +/** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ +var getPrototype = overArg(nativeGetPrototype, Object); + /** * Gets the `toStringTag` of `value`. * @@ -193,9 +358,7 @@ function getNative(object, key) { * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ -function getTag(value) { - return objectToString.call(value); -} +var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, // for data views in Edge, and promises in Node.js. @@ -222,6 +385,63 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || }; } +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + /** * Converts `func` to its source code. * @@ -241,6 +461,113 @@ function toSource(func) { return ''; } +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + /** * Checks if `value` is classified as a `Function` object. * @@ -249,8 +576,7 @@ function toSource(func) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -267,6 +593,38 @@ function isFunction(value) { return tag == funcTag || tag == genTag; } +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) @@ -298,29 +656,101 @@ function isObject(value) { } /** - * Checks if `value` is a native function. + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". * * @static * @memberOf _ - * @since 3.0.0 + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * - * _.isNative(Array.prototype.push); + * _.isObjectLike({}); * // => true * - * _.isNative(_); + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); * // => false */ -function isNative(value) { - if (!isObject(value)) { - return false; +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + var isProto = isPrototype(object); + if (!(isProto || isArrayLike(object))) { + return baseKeys(object); } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); + var indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + for (var key in object) { + if (baseHas(object, key) && + !(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(isProto && key == 'constructor')) { + result.push(key); + } + } + return result; } /** diff --git a/lodash.topairs/package.json b/lodash.topairs/package.json index 2d4a84615..321e1fb6c 100644 --- a/lodash.topairs/package.json +++ b/lodash.topairs/package.json @@ -1,6 +1,6 @@ { "name": "lodash.topairs", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.toPairs` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._root": "~3.0.0", - "lodash.keys": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.topairsin/README.md b/lodash.topairsin/README.md index 0631abe6f..a8664a734 100644 --- a/lodash.topairsin/README.md +++ b/lodash.topairsin/README.md @@ -1,4 +1,4 @@ -# lodash.topairsin v4.1.1 +# lodash.topairsin v4.2.0 The [lodash](https://lodash.com/) method `_.toPairsIn` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var toPairsIn = require('lodash.topairsin'); ``` -See the [documentation](https://lodash.com/docs#toPairsIn) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.topairsin) for more details. +See the [documentation](https://lodash.com/docs#toPairsIn) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.topairsin) for more details. diff --git a/lodash.topairsin/index.js b/lodash.topairsin/index.js index 802506353..3d09128f5 100644 --- a/lodash.topairsin/index.js +++ b/lodash.topairsin/index.js @@ -6,16 +6,19 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var keysIn = require('lodash.keysin'), - root = require('lodash._root'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ -var funcTag = '[object Function]', +var argsTag = '[object Arguments]', + funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', objectTag = '[object Object]', promiseTag = '[object Promise]', setTag = '[object Set]', + stringTag = '[object String]', weakMapTag = '[object WeakMap]'; var dataViewTag = '[object DataView]'; @@ -29,18 +32,30 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array.length, + length = array ? array.length : 0, result = Array(length); while (++index < length) { @@ -49,6 +64,38 @@ function arrayMap(array, iteratee) { return result; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + /** * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array * of key-value pairs for `object` corresponding to the property names of `props`. @@ -64,6 +111,18 @@ function baseToPairs(object, props) { }); } +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + /** * Checks if `value` is a host object in IE < 9. * @@ -83,6 +142,23 @@ function isHostObject(value) { return result; } +/** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ +function iteratorToArray(iterator) { + var data, + result = []; + + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; +} + /** * Converts `map` to its key-value pairs. * @@ -120,6 +196,15 @@ function setToPairs(set) { /** Used for built-in method references. */ var objectProto = Object.prototype; +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + /** Used to resolve the decompiled source of functions. */ var funcToString = Function.prototype.toString; @@ -139,6 +224,11 @@ var reIsNative = RegExp('^' + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); +/** Built-in value references. */ +var Reflect = root.Reflect, + enumerate = Reflect ? Reflect.enumerate : undefined, + propertyIsEnumerable = objectProto.propertyIsEnumerable; + /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), @@ -153,6 +243,58 @@ var dataViewCtorString = toSource(DataView), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); +/** + * The base implementation of `getTag`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + return objectToString.call(value); +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.keysIn` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeysIn(object) { + object = object == null ? object : Object(object); + + var result = []; + for (var key in object) { + result.push(key); + } + return result; +} + +// Fallback for IE < 9 with es6-shim. +if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { + baseKeysIn = function(object) { + return iteratorToArray(enumerate(object)); + }; +} + /** * Creates a `_.toPairs` or `_.toPairsIn` function. * @@ -173,6 +315,19 @@ function createToPairs(keysFunc) { }; } +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + /** * Gets the native function at `key` of `object`. * @@ -182,8 +337,8 @@ function createToPairs(keysFunc) { * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = object[key]; - return isNative(value) ? value : undefined; + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; } /** @@ -193,9 +348,7 @@ function getNative(object, key) { * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ -function getTag(value) { - return objectToString.call(value); -} +var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, // for data views in Edge, and promises in Node.js. @@ -222,6 +375,63 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || }; } +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + /** * Converts `func` to its source code. * @@ -241,6 +451,113 @@ function toSource(func) { return ''; } +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + /** * Checks if `value` is classified as a `Function` object. * @@ -249,8 +566,7 @@ function toSource(func) { * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -267,6 +583,38 @@ function isFunction(value) { return tag == funcTag || tag == genTag; } +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) @@ -298,29 +646,96 @@ function isObject(value) { } /** - * Checks if `value` is a native function. + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. * @example * - * _.isNative(Array.prototype.push); - * // => true + * function Foo() { + * this.a = 1; + * this.b = 2; + * } * - * _.isNative(_); - * // => false + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ -function isNative(value) { - if (!isObject(value)) { - return false; +function keysIn(object) { + var index = -1, + isProto = isPrototype(object), + props = baseKeysIn(object), + propsLength = props.length, + indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + while (++index < propsLength) { + var key = props[index]; + if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); + return result; } /** diff --git a/lodash.topairsin/package.json b/lodash.topairsin/package.json index 5d723bd3c..2249fc7ac 100644 --- a/lodash.topairsin/package.json +++ b/lodash.topairsin/package.json @@ -1,6 +1,6 @@ { "name": "lodash.topairsin", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.toPairsIn` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._root": "~3.0.0", - "lodash.keysin": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.topath/README.md b/lodash.topath/README.md index 4a282ef13..bb5993ca7 100644 --- a/lodash.topath/README.md +++ b/lodash.topath/README.md @@ -1,4 +1,4 @@ -# lodash.topath v4.1.1 +# lodash.topath v4.2.0 The [lodash](https://lodash.com/) method `_.toPath` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var toPath = require('lodash.topath'); ``` -See the [documentation](https://lodash.com/docs#toPath) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.topath) for more details. +See the [documentation](https://lodash.com/docs#toPath) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.topath) for more details. diff --git a/lodash.topath/index.js b/lodash.topath/index.js index 6044d0142..b67247d49 100644 --- a/lodash.topath/index.js +++ b/lodash.topath/index.js @@ -1,13 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - toString = require('lodash.tostring'); +var toString = require('lodash.tostring'); /** Used to match property names within property paths. */ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; @@ -15,6 +14,26 @@ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\ /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + /** * Converts `string` to a property path array. * @@ -35,7 +54,7 @@ function stringToPath(string) { * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. diff --git a/lodash.topath/package.json b/lodash.topath/package.json index 95072f689..de840ea28 100644 --- a/lodash.topath/package.json +++ b/lodash.topath/package.json @@ -1,6 +1,6 @@ { "name": "lodash.topath", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.toPath` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.toplainobject/README.md b/lodash.toplainobject/README.md index 0b6a740c2..63620f944 100644 --- a/lodash.toplainobject/README.md +++ b/lodash.toplainobject/README.md @@ -1,4 +1,4 @@ -# lodash.toplainobject v4.1.0 +# lodash.toplainobject v4.2.0 The [lodash](https://lodash.com/) method `_.toPlainObject` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var toPlainObject = require('lodash.toplainobject'); ``` -See the [documentation](https://lodash.com/docs#toPlainObject) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.toplainobject) for more details. +See the [documentation](https://lodash.com/docs#toPlainObject) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.toplainobject) for more details. diff --git a/lodash.toplainobject/index.js b/lodash.toplainobject/index.js index ee4945203..03bda53af 100644 --- a/lodash.toplainobject/index.js +++ b/lodash.toplainobject/index.js @@ -13,34 +13,11 @@ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - stringTag = '[object String]'; + genTag = '[object GeneratorFunction]'; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. @@ -60,23 +37,6 @@ function baseTimes(n, iteratee) { return result; } -/** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ -function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -85,19 +45,44 @@ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ -var Reflect = root.Reflect, - enumerate = Reflect ? Reflect.enumerate : undefined, - propertyIsEnumerable = objectProto.propertyIsEnumerable; +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -114,30 +99,27 @@ function assignValue(object, key, value) { } /** - * The base implementation of `_.keysIn` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { - object = object == null ? object : Object(object); + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; - var result = []; for (var key in object) { - result.push(key); + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } } return result; } -// Fallback for IE < 9 with es6-shim. -if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { - baseKeysIn = function(object) { - return iteratorToArray(enumerate(object)); - }; -} - /** * Copies properties of `source` to `object`. * @@ -166,36 +148,6 @@ function copyObject(source, props, object, customizer) { return object; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; -} - /** * Checks if `value` is a valid array-like index. * @@ -225,9 +177,28 @@ function isPrototype(value) { return value === proto; } +/** + * This function is like + * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * except that it includes inherited enumerable properties. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function nativeKeysIn(object) { + var result = []; + if (object != null) { + for (var key in Object(object)) { + result.push(key); + } + } + return result; +} + /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -280,7 +251,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -336,7 +307,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -387,8 +358,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -396,16 +366,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -427,7 +396,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -483,28 +452,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * Converts `value` to a plain object flattening inherited enumerable string * keyed properties of `value` to own properties of the plain object. @@ -557,23 +504,7 @@ function toPlainObject(value) { * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { - var index = -1, - isProto = isPrototype(object), - props = baseKeysIn(object), - propsLength = props.length, - indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - while (++index < propsLength) { - var key = props[index]; - if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } module.exports = toPlainObject; diff --git a/lodash.toplainobject/package.json b/lodash.toplainobject/package.json index 59a41609c..937e4d808 100644 --- a/lodash.toplainobject/package.json +++ b/lodash.toplainobject/package.json @@ -1,6 +1,6 @@ { "name": "lodash.toplainobject", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.toPlainObject` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.transform/README.md b/lodash.transform/README.md index 280be8df9..0ed08890f 100644 --- a/lodash.transform/README.md +++ b/lodash.transform/README.md @@ -1,4 +1,4 @@ -# lodash.transform v4.1.1 +# lodash.transform v4.2.0 The [lodash](https://lodash.com/) method `_.transform` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var transform = require('lodash.transform'); ``` -See the [documentation](https://lodash.com/docs#transform) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.transform) for more details. +See the [documentation](https://lodash.com/docs#transform) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.transform) for more details. diff --git a/lodash.transform/index.js b/lodash.transform/index.js index aeeab3e02..258fda056 100644 --- a/lodash.transform/index.js +++ b/lodash.transform/index.js @@ -1,24 +1,14 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayEach = require('lodash._arrayeach'), - baseFor = require('lodash._basefor'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - keys = require('lodash.keys'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; +var baseFor = require('lodash._basefor'), + baseIteratee = require('lodash._baseiteratee'), + keys = require('lodash.keys'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -50,14 +40,6 @@ var arrayBufferTag = '[object ArrayBuffer]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = @@ -73,6 +55,27 @@ typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -82,6 +85,9 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** Built-in value references. */ +var objectCreate = Object.create; + /** * The base implementation of `_.create` without support for assigning * properties to the created object. @@ -90,17 +96,9 @@ var objectToString = objectProto.toString; * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ -var baseCreate = (function() { - function object() {} - return function(prototype) { - if (isObject(prototype)) { - object.prototype = prototype; - var result = new object; - object.prototype = undefined; - } - return result || {}; - }; -}()); +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} /** * The base implementation of `_.forOwn` without support for iteratee shorthands. @@ -114,197 +112,12 @@ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -373,7 +186,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -448,7 +262,8 @@ function isObjectLike(value) { * // => false */ function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } /** @@ -501,48 +316,4 @@ function transform(object, iteratee, accumulator) { return accumulator; } -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = transform; diff --git a/lodash.transform/package.json b/lodash.transform/package.json index 4ce20dee3..fa63b0eac 100644 --- a/lodash.transform/package.json +++ b/lodash.transform/package.json @@ -1,6 +1,6 @@ { "name": "lodash.transform", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.transform` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,14 +15,8 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayeach": "^3.0.0", "lodash._basefor": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.keys": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash.keys": "^4.0.0" } } diff --git a/lodash.trim/README.md b/lodash.trim/README.md index 85ee87ade..460cc0822 100644 --- a/lodash.trim/README.md +++ b/lodash.trim/README.md @@ -1,4 +1,4 @@ -# lodash.trim v4.1.1 +# lodash.trim v4.2.0 The [lodash](https://lodash.com/) method `_.trim` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var trim = require('lodash.trim'); ``` -See the [documentation](https://lodash.com/docs#trim) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.trim) for more details. +See the [documentation](https://lodash.com/docs#trim) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.trim) for more details. diff --git a/lodash.trim/index.js b/lodash.trim/index.js index 2f35fbfa9..43f725600 100644 --- a/lodash.trim/index.js +++ b/lodash.trim/index.js @@ -1,14 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var charsEndIndex = require('lodash._charsendindex'), - charsStartIndex = require('lodash._charsstartindex'), - toString = require('lodash.tostring'); +var toString = require('lodash.tostring'); /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; @@ -39,6 +37,85 @@ var reOptMod = rsModifier + '?', /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return indexOfNaN(array, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. + */ +function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; + + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; +} + +/** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ +function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; +} + +/** + * Gets the index at which the first occurrence of `NaN` is found in `array`. + * + * @private + * @param {Array} array The array to search. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched `NaN`, else `-1`. + */ +function indexOfNaN(array, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 0 : -1); + + while ((fromRight ? index-- : ++index < length)) { + var other = array[index]; + if (other !== other) { + return index; + } + } + return -1; +} + /** * Converts `string` to an array. * @@ -55,10 +132,11 @@ function stringToArray(string) { * * @static * @memberOf _ + * @since 3.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * @@ -86,7 +164,9 @@ function trim(string, chars, guard) { var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars); - return strSymbols.slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1).join(''); + return strSymbols + .slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1) + .join(''); } module.exports = trim; diff --git a/lodash.trim/package.json b/lodash.trim/package.json index 6b24a981f..5f7477e0b 100644 --- a/lodash.trim/package.json +++ b/lodash.trim/package.json @@ -1,6 +1,6 @@ { "name": "lodash.trim", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.trim` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,8 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._charsendindex": "^4.0.0", - "lodash._charsstartindex": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.trimend/README.md b/lodash.trimend/README.md index 0fdb659ca..d0dd63ae0 100644 --- a/lodash.trimend/README.md +++ b/lodash.trimend/README.md @@ -1,4 +1,4 @@ -# lodash.trimend v4.1.1 +# lodash.trimend v4.2.0 The [lodash](https://lodash.com/) method `_.trimEnd` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var trimEnd = require('lodash.trimend'); ``` -See the [documentation](https://lodash.com/docs#trimEnd) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.trimend) for more details. +See the [documentation](https://lodash.com/docs#trimEnd) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.trimend) for more details. diff --git a/lodash.trimend/index.js b/lodash.trimend/index.js index 5484777fc..9aca195ee 100644 --- a/lodash.trimend/index.js +++ b/lodash.trimend/index.js @@ -1,13 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var charsEndIndex = require('lodash._charsendindex'), - toString = require('lodash.tostring'); +var toString = require('lodash.tostring'); /** Used to match leading and trailing whitespace. */ var reTrimEnd = /\s+$/; @@ -38,6 +37,68 @@ var reOptMod = rsModifier + '?', /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return indexOfNaN(array, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ +function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; +} + +/** + * Gets the index at which the first occurrence of `NaN` is found in `array`. + * + * @private + * @param {Array} array The array to search. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched `NaN`, else `-1`. + */ +function indexOfNaN(array, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 0 : -1); + + while ((fromRight ? index-- : ++index < length)) { + var other = array[index]; + if (other !== other) { + return index; + } + } + return -1; +} + /** * Converts `string` to an array. * @@ -54,10 +115,11 @@ function stringToArray(string) { * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * @@ -80,7 +142,9 @@ function trimEnd(string, chars, guard) { return string; } var strSymbols = stringToArray(string); - return strSymbols.slice(0, charsEndIndex(strSymbols, stringToArray(chars)) + 1).join(''); + return strSymbols + .slice(0, charsEndIndex(strSymbols, stringToArray(chars)) + 1) + .join(''); } module.exports = trimEnd; diff --git a/lodash.trimend/package.json b/lodash.trimend/package.json index 41aaa130b..273b84a21 100644 --- a/lodash.trimend/package.json +++ b/lodash.trimend/package.json @@ -1,6 +1,6 @@ { "name": "lodash.trimend", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.trimEnd` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._charsendindex": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.trimstart/README.md b/lodash.trimstart/README.md index 63961cd51..0aac4c7f0 100644 --- a/lodash.trimstart/README.md +++ b/lodash.trimstart/README.md @@ -1,4 +1,4 @@ -# lodash.trimstart v4.1.1 +# lodash.trimstart v4.2.0 The [lodash](https://lodash.com/) method `_.trimStart` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var trimStart = require('lodash.trimstart'); ``` -See the [documentation](https://lodash.com/docs#trimStart) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.trimstart) for more details. +See the [documentation](https://lodash.com/docs#trimStart) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.trimstart) for more details. diff --git a/lodash.trimstart/index.js b/lodash.trimstart/index.js index 48a8dc634..887c0e3fa 100644 --- a/lodash.trimstart/index.js +++ b/lodash.trimstart/index.js @@ -1,13 +1,12 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var charsStartIndex = require('lodash._charsstartindex'), - toString = require('lodash.tostring'); +var toString = require('lodash.tostring'); /** Used to match leading and trailing whitespace. */ var reTrimStart = /^\s+/; @@ -38,6 +37,69 @@ var reOptMod = rsModifier + '?', /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return indexOfNaN(array, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. + */ +function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; + + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; +} + +/** + * Gets the index at which the first occurrence of `NaN` is found in `array`. + * + * @private + * @param {Array} array The array to search. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched `NaN`, else `-1`. + */ +function indexOfNaN(array, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 0 : -1); + + while ((fromRight ? index-- : ++index < length)) { + var other = array[index]; + if (other !== other) { + return index; + } + } + return -1; +} + /** * Converts `string` to an array. * @@ -54,10 +116,11 @@ function stringToArray(string) { * * @static * @memberOf _ + * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * @@ -80,7 +143,9 @@ function trimStart(string, chars, guard) { return string; } var strSymbols = stringToArray(string); - return strSymbols.slice(charsStartIndex(strSymbols, stringToArray(chars))).join(''); + return strSymbols + .slice(charsStartIndex(strSymbols, stringToArray(chars))) + .join(''); } module.exports = trimStart; diff --git a/lodash.trimstart/package.json b/lodash.trimstart/package.json index a3b99c25c..e75230be5 100644 --- a/lodash.trimstart/package.json +++ b/lodash.trimstart/package.json @@ -1,6 +1,6 @@ { "name": "lodash.trimstart", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.trimStart` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._charsstartindex": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.truncate/README.md b/lodash.truncate/README.md index 3c6f8958a..edb2435c9 100644 --- a/lodash.truncate/README.md +++ b/lodash.truncate/README.md @@ -1,4 +1,4 @@ -# lodash.truncate v4.1.2 +# lodash.truncate v4.2.0 The [lodash](https://lodash.com/) method `_.truncate` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var truncate = require('lodash.truncate'); ``` -See the [documentation](https://lodash.com/docs#truncate) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.truncate) for more details. +See the [documentation](https://lodash.com/docs#truncate) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.truncate) for more details. diff --git a/lodash.truncate/index.js b/lodash.truncate/index.js index df95166f1..a1ab29154 100644 --- a/lodash.truncate/index.js +++ b/lodash.truncate/index.js @@ -1,12 +1,13 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var toString = require('lodash.tostring'); +var baseSlice = require('lodash._baseslice'), + toString = require('lodash.tostring'); /** Used as default options for `_.truncate`. */ var DEFAULT_TRUNC_LENGTH = 30, @@ -109,6 +110,21 @@ var objectProto = Object.prototype; */ var objectToString = objectProto.toString; +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} + /** * Checks if `value` is classified as a `Function` object. * @@ -382,7 +398,7 @@ function truncate(string, options) { return omission; } var result = strSymbols - ? strSymbols.slice(0, end).join('') + ? castSlice(strSymbols, 0, end).join('') : string.slice(0, end); if (separator === undefined) { diff --git a/lodash.truncate/package.json b/lodash.truncate/package.json index d117d1550..e6da6f1ae 100644 --- a/lodash.truncate/package.json +++ b/lodash.truncate/package.json @@ -1,6 +1,6 @@ { "name": "lodash.truncate", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.truncate` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { + "lodash._baseslice": "~4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.unary/LICENSE b/lodash.unary/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.unary/LICENSE +++ b/lodash.unary/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.unary/README.md b/lodash.unary/README.md index ade7af880..b7ab15656 100644 --- a/lodash.unary/README.md +++ b/lodash.unary/README.md @@ -1,4 +1,4 @@ -# lodash.unary v4.1.0 +# lodash.unary v4.2.0 The [lodash](https://lodash.com/) method `_.unary` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var unary = require('lodash.unary'); ``` -See the [documentation](https://lodash.com/docs#unary) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.unary) for more details. +See the [documentation](https://lodash.com/docs#unary) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.unary) for more details. diff --git a/lodash.unary/index.js b/lodash.unary/index.js index 0d56d9f3b..6373608bc 100644 --- a/lodash.unary/index.js +++ b/lodash.unary/index.js @@ -1,12 +1,940 @@ /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var ary = require('lodash.ary'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** Used as the internal argument placeholder. */ +var PLACEHOLDER = '__lodash_placeholder__'; + +/** Used to compose bitmasks for function metadata. */ +var BIND_FLAG = 1, + BIND_KEY_FLAG = 2, + CURRY_BOUND_FLAG = 4, + CURRY_FLAG = 8, + CURRY_RIGHT_FLAG = 16, + PARTIAL_FLAG = 32, + PARTIAL_RIGHT_FLAG = 64, + ARY_FLAG = 128, + REARG_FLAG = 256, + FLIP_FLAG = 512; + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + +/** Used to associate wrap methods with their bit flags. */ +var wrapFlags = [ + ['ary', ARY_FLAG], + ['bind', BIND_FLAG], + ['bindKey', BIND_KEY_FLAG], + ['curry', CURRY_FLAG], + ['curryRight', CURRY_RIGHT_FLAG], + ['flip', FLIP_FLAG], + ['partial', PARTIAL_FLAG], + ['partialRight', PARTIAL_RIGHT_FLAG], + ['rearg', REARG_FLAG] +]; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to match wrap detail comments. */ +var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array ? array.length : 0; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to search. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to search. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); + } + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ +function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + result++; + } + } + return result; +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} + +/** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ +function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + return result; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var objectCreate = Object.create; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/* Used to set `toString` methods. */ +var defineProperty = (function() { + var func = getNative(Object, 'defineProperty'), + name = getNative.name; + + return (name && name.length > 2) ? func : undefined; +}()); + +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; +} + +/** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; +} + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +/** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createBind(func, bitmask, thisArg) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; +} + +/** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ +function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; +} + +/** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & ARY_FLAG, + isBind = bitmask & BIND_FLAG, + isBindKey = bitmask & BIND_KEY_FLAG, + isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG), + isFlip = bitmask & FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ +function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; +} + +/** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); + + if (!(bitmask & CURRY_BOUND_FLAG)) { + bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); + } + + var result = wrapFunc(func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity); + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); +} + +/** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * The bitmask may be composed of the following flags: + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] == null + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { + bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + return setWrapToString(result, func, bitmask); +} + +/** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ +function getHolder(func) { + var object = func; + return object.placeholder; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ +function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; +} + +/** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ +function insertWrapDetails(source, details) { + var length = details.length, + lastIndex = length - 1; + + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ +function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; +} + +/** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ +var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { + var source = (reference + ''); + return defineProperty(wrapper, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) + }); +}; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ +function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); +} + +/** + * Creates a function that invokes `func`, with up to `n` arguments, + * ignoring any additional arguments. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @param {number} [n=func.length] The arity cap. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ +function ary(func, n, guard) { + n = guard ? undefined : n; + n = (func && n == null) ? func.length : n; + return createWrap(func, ARY_FLAG, undefined, undefined, undefined, undefined, n); +} /** * Creates a function that accepts up to one argument, ignoring any @@ -27,4 +955,266 @@ function unary(func) { return ary(func, 1); } +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; +} + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + module.exports = unary; diff --git a/lodash.unary/package.json b/lodash.unary/package.json index d1c4b6a0f..13d2b0771 100644 --- a/lodash.unary/package.json +++ b/lodash.unary/package.json @@ -1,6 +1,6 @@ { "name": "lodash.unary", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.unary` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,9 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.ary": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.union/LICENSE b/lodash.union/LICENSE index b054ca5a3..bcbe13d67 100644 --- a/lodash.union/LICENSE +++ b/lodash.union/LICENSE @@ -1,22 +1,23 @@ +The MIT License (MIT) + Copyright 2012-2016 The Dojo Foundation Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lodash.union/README.md b/lodash.union/README.md index 373d62f2e..e23dd0771 100644 --- a/lodash.union/README.md +++ b/lodash.union/README.md @@ -1,4 +1,4 @@ -# lodash.union v4.1.0 +# lodash.union v4.2.0 The [lodash](https://lodash.com/) method `_.union` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var union = require('lodash.union'); ``` -See the [documentation](https://lodash.com/docs#union) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.union) for more details. +See the [documentation](https://lodash.com/docs#union) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.union) for more details. diff --git a/lodash.union/index.js b/lodash.union/index.js index 264f458e9..36cc1e6bc 100644 --- a/lodash.union/index.js +++ b/lodash.union/index.js @@ -1,175 +1,14 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - baseFlatten = require('lodash._baseflatten'), - cacheHas = require('lodash._cachehas'), - rest = require('lodash.rest'), - root = require('lodash._root'); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); -}; - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} +var baseFlatten = require('lodash._baseflatten'), + baseUniq = require('lodash._baseuniq'), + rest = require('lodash.rest'); /** * Creates an array of unique values, in order, from all given arrays using @@ -187,131 +26,7 @@ function getNative(object, key) { * // => [2, 1, 4] */ var union = rest(function(arrays) { - return baseUniq(baseFlatten(arrays, false, true)); + return baseUniq(baseFlatten(arrays, 1, true)); }); -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -/** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. - * - * @static - * @memberOf _ - * @category Util - * @example - * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true - */ -function noop() { - // No operation performed. -} - module.exports = union; diff --git a/lodash.union/package.json b/lodash.union/package.json index 2f8cab85a..49125b33d 100644 --- a/lodash.union/package.json +++ b/lodash.union/package.json @@ -1,6 +1,6 @@ { "name": "lodash.union", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.union` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,8 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", "lodash._baseflatten": "^4.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._root": "^3.0.0", - "lodash._setcache": "^4.0.0", + "lodash._baseuniq": "^4.0.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.unionby/README.md b/lodash.unionby/README.md index 7bc734dc6..ce2a55f81 100644 --- a/lodash.unionby/README.md +++ b/lodash.unionby/README.md @@ -1,4 +1,4 @@ -# lodash.unionby v4.1.1 +# lodash.unionby v4.2.0 The [lodash](https://lodash.com/) method `_.unionBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var unionBy = require('lodash.unionby'); ``` -See the [documentation](https://lodash.com/docs#unionBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.unionby) for more details. +See the [documentation](https://lodash.com/docs#unionBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.unionby) for more details. diff --git a/lodash.unionby/index.js b/lodash.unionby/index.js index 6b0aa69ce..3d3144a6b 100644 --- a/lodash.unionby/index.js +++ b/lodash.unionby/index.js @@ -1,31 +1,15 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - baseFlatten = require('lodash._baseflatten'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - cacheHas = require('lodash._cachehas'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - root = require('lodash._root'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; +var baseFlatten = require('lodash._baseflatten'), + baseIteratee = require('lodash._baseiteratee'), + baseUniq = require('lodash._baseuniq'), + rest = require('lodash.rest'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -34,166 +18,15 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.property` without support for deep paths. * @@ -207,102 +40,6 @@ function baseProperty(key) { }; } -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); -}; - /** * Gets the "length" property value of `object`. * @@ -315,80 +52,6 @@ var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { */ var getLength = baseProperty('length'); -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Gets the last element of `array`. * @@ -432,34 +95,9 @@ var unionBy = rest(function(arrays) { if (isArrayLikeObject(iteratee)) { iteratee = undefined; } - return baseUniq(baseFlatten(arrays, false, true), baseIteratee(iteratee)); + return baseUniq(baseFlatten(arrays, 1, true), baseIteratee(iteratee)); }); -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -467,7 +105,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -496,7 +133,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -567,7 +203,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -625,93 +262,4 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. - * - * @static - * @memberOf _ - * @category Util - * @example - * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true - */ -function noop() { - // No operation performed. -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = unionBy; diff --git a/lodash.unionby/package.json b/lodash.unionby/package.json index c9196b3e7..f902e1252 100644 --- a/lodash.unionby/package.json +++ b/lodash.unionby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.unionby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.unionBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,18 +15,9 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", "lodash._baseflatten": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._root": "^3.0.0", - "lodash._setcache": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._baseuniq": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.unionwith/LICENSE b/lodash.unionwith/LICENSE index b054ca5a3..bcbe13d67 100644 --- a/lodash.unionwith/LICENSE +++ b/lodash.unionwith/LICENSE @@ -1,22 +1,23 @@ +The MIT License (MIT) + Copyright 2012-2016 The Dojo Foundation Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lodash.unionwith/README.md b/lodash.unionwith/README.md index 79f0aeb94..993bcc62e 100644 --- a/lodash.unionwith/README.md +++ b/lodash.unionwith/README.md @@ -1,4 +1,4 @@ -# lodash.unionwith v4.1.0 +# lodash.unionwith v4.2.0 The [lodash](https://lodash.com/) method `_.unionWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var unionWith = require('lodash.unionwith'); ``` -See the [documentation](https://lodash.com/docs#unionWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.unionwith) for more details. +See the [documentation](https://lodash.com/docs#unionWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.unionwith) for more details. diff --git a/lodash.unionwith/index.js b/lodash.unionwith/index.js index 28cdfec1d..99b6de693 100644 --- a/lodash.unionwith/index.js +++ b/lodash.unionwith/index.js @@ -1,21 +1,14 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - baseFlatten = require('lodash._baseflatten'), - cacheHas = require('lodash._cachehas'), - rest = require('lodash.rest'), - root = require('lodash._root'); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; +var baseFlatten = require('lodash._baseflatten'), + baseUniq = require('lodash._baseuniq'), + rest = require('lodash.rest'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -24,72 +17,15 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - /** * The base implementation of `_.property` without support for deep paths. * @@ -103,77 +39,6 @@ function baseProperty(key) { }; } -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); -}; - /** * Gets the "length" property value of `object`. * @@ -186,19 +51,6 @@ var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { */ var getLength = baseProperty('length'); -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - /** * Gets the last element of `array`. * @@ -241,7 +93,7 @@ var unionWith = rest(function(arrays) { if (isArrayLikeObject(comparator)) { comparator = undefined; } - return baseUniq(baseFlatten(arrays, false, true), undefined, comparator); + return baseUniq(baseFlatten(arrays, 1, true), undefined, comparator); }); /** @@ -251,7 +103,6 @@ var unionWith = rest(function(arrays) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -280,7 +131,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -351,7 +201,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -409,49 +260,4 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -/** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. - * - * @static - * @memberOf _ - * @category Util - * @example - * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true - */ -function noop() { - // No operation performed. -} - module.exports = unionWith; diff --git a/lodash.unionwith/package.json b/lodash.unionwith/package.json index 71a11d9a9..5c64301c8 100644 --- a/lodash.unionwith/package.json +++ b/lodash.unionwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.unionwith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.unionWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,12 +15,8 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", "lodash._baseflatten": "^4.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._root": "^3.0.0", - "lodash._setcache": "^4.0.0", + "lodash._baseuniq": "^4.0.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.uniq/LICENSE b/lodash.uniq/LICENSE index b054ca5a3..bcbe13d67 100644 --- a/lodash.uniq/LICENSE +++ b/lodash.uniq/LICENSE @@ -1,22 +1,23 @@ +The MIT License (MIT) + Copyright 2012-2016 The Dojo Foundation Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lodash.uniq/README.md b/lodash.uniq/README.md index 53a3cd4ea..3204e5847 100644 --- a/lodash.uniq/README.md +++ b/lodash.uniq/README.md @@ -1,4 +1,4 @@ -# lodash.uniq v4.1.0 +# lodash.uniq v4.2.0 The [lodash](https://lodash.com/) method `_.uniq` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var uniq = require('lodash.uniq'); ``` -See the [documentation](https://lodash.com/docs#uniq) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.uniq) for more details. +See the [documentation](https://lodash.com/docs#uniq) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.uniq) for more details. diff --git a/lodash.uniq/index.js b/lodash.uniq/index.js index 174aa2a7a..6c7bde110 100644 --- a/lodash.uniq/index.js +++ b/lodash.uniq/index.js @@ -1,173 +1,12 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - cacheHas = require('lodash._cachehas'), - root = require('lodash._root'); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); -}; - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} +var baseUniq = require('lodash._baseuniq'); /** * Creates a duplicate-free version of an array, using @@ -191,128 +30,4 @@ function uniq(array) { : []; } -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -/** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. - * - * @static - * @memberOf _ - * @category Util - * @example - * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true - */ -function noop() { - // No operation performed. -} - module.exports = uniq; diff --git a/lodash.uniq/package.json b/lodash.uniq/package.json index 963512157..e65a37846 100644 --- a/lodash.uniq/package.json +++ b/lodash.uniq/package.json @@ -1,6 +1,6 @@ { "name": "lodash.uniq", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.uniq` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,10 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._root": "^3.0.0", - "lodash._setcache": "^4.0.0" + "lodash._baseuniq": "^4.0.0" } } diff --git a/lodash.uniqby/README.md b/lodash.uniqby/README.md index 0bbb4a145..1524b892d 100644 --- a/lodash.uniqby/README.md +++ b/lodash.uniqby/README.md @@ -1,4 +1,4 @@ -# lodash.uniqby v4.1.1 +# lodash.uniqby v4.2.0 The [lodash](https://lodash.com/) method `_.uniqBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var uniqBy = require('lodash.uniqby'); ``` -See the [documentation](https://lodash.com/docs#uniqBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.uniqby) for more details. +See the [documentation](https://lodash.com/docs#uniqBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.uniqby) for more details. diff --git a/lodash.uniqby/index.js b/lodash.uniqby/index.js index 2c290c7b4..678a2e4a1 100644 --- a/lodash.uniqby/index.js +++ b/lodash.uniqby/index.js @@ -1,376 +1,13 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - cacheHas = require('lodash._cachehas'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - root = require('lodash._root'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); -}; - -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} +var baseIteratee = require('lodash._baseiteratee'), + baseUniq = require('lodash._baseuniq'); /** * This method is like `_.uniq` except that it accepts `iteratee` which is @@ -398,197 +35,4 @@ function uniqBy(array, iteratee) { : []; } -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. - * - * @static - * @memberOf _ - * @category Util - * @example - * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true - */ -function noop() { - // No operation performed. -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = uniqBy; diff --git a/lodash.uniqby/package.json b/lodash.uniqby/package.json index 79a1014c3..da91130a5 100644 --- a/lodash.uniqby/package.json +++ b/lodash.uniqby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.uniqby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.uniqBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,16 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._root": "^3.0.0", - "lodash._setcache": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._baseuniq": "^4.0.0" } } diff --git a/lodash.uniqwith/LICENSE b/lodash.uniqwith/LICENSE index b054ca5a3..bcbe13d67 100644 --- a/lodash.uniqwith/LICENSE +++ b/lodash.uniqwith/LICENSE @@ -1,22 +1,23 @@ +The MIT License (MIT) + Copyright 2012-2016 The Dojo Foundation Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lodash.uniqwith/README.md b/lodash.uniqwith/README.md index a1872a7c2..501776ad9 100644 --- a/lodash.uniqwith/README.md +++ b/lodash.uniqwith/README.md @@ -1,4 +1,4 @@ -# lodash.uniqwith v4.1.0 +# lodash.uniqwith v4.2.0 The [lodash](https://lodash.com/) method `_.uniqWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var uniqWith = require('lodash.uniqwith'); ``` -See the [documentation](https://lodash.com/docs#uniqWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.uniqwith) for more details. +See the [documentation](https://lodash.com/docs#uniqWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.uniqwith) for more details. diff --git a/lodash.uniqwith/index.js b/lodash.uniqwith/index.js index f04cb5c5a..0b066c010 100644 --- a/lodash.uniqwith/index.js +++ b/lodash.uniqwith/index.js @@ -1,173 +1,12 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - cacheHas = require('lodash._cachehas'), - root = require('lodash._root'); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); -}; - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} +var baseUniq = require('lodash._baseuniq'); /** * This method is like `_.uniq` except that it accepts `comparator` which @@ -193,128 +32,4 @@ function uniqWith(array, comparator) { : []; } -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -/** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. - * - * @static - * @memberOf _ - * @category Util - * @example - * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true - */ -function noop() { - // No operation performed. -} - module.exports = uniqWith; diff --git a/lodash.uniqwith/package.json b/lodash.uniqwith/package.json index 6395a087a..375ec5f89 100644 --- a/lodash.uniqwith/package.json +++ b/lodash.uniqwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.uniqwith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.uniqWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,10 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._root": "^3.0.0", - "lodash._setcache": "^4.0.0" + "lodash._baseuniq": "^4.0.0" } } diff --git a/lodash.unset/README.md b/lodash.unset/README.md index dba4b8fea..51c31aaae 100644 --- a/lodash.unset/README.md +++ b/lodash.unset/README.md @@ -1,4 +1,4 @@ -# lodash.unset v4.1.1 +# lodash.unset v4.2.0 The [lodash](https://lodash.com/) method `_.unset` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var unset = require('lodash.unset'); ``` -See the [documentation](https://lodash.com/docs#unset) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.unset) for more details. +See the [documentation](https://lodash.com/docs#unset) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.unset) for more details. diff --git a/lodash.unset/index.js b/lodash.unset/index.js index d11707eab..e1d007285 100644 --- a/lodash.unset/index.js +++ b/lodash.unset/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,10 +7,17 @@ * Available under MIT license */ var baseSlice = require('lodash._baseslice'), - get = require('lodash.get'), - has = require('lodash.has'), toString = require('lodash.tostring'); +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + stringTag = '[object String]'; + /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, @@ -19,18 +26,99 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + /** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. + * Checks if `value` is a valid array-like index. * * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ -function baseToPath(value) { +function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var getPrototypeOf = Object.getPrototypeOf, + propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function baseCastPath(value) { return isArray(value) ? value : stringToPath(value); } +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path + ''] : baseCastPath(path); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; +} + +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototypeOf(object) === null); +} + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + /** * The base implementation of `_.unset`. * @@ -40,12 +128,53 @@ function baseToPath(value) { * @returns {boolean} Returns `true` if the property is deleted, else `false`. */ function baseUnset(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); + path = isKey(path, object) ? [path + ''] : baseCastPath(path); object = parent(object, path); var key = last(path); return (object != null && has(object, key)) ? delete object[key] : true; } +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ +function hasPath(object, path, hasFunc) { + if (object == null) { + return false; + } + var result = hasFunc(object, path); + if (!result && !isKey(path)) { + path = baseCastPath(path); + object = parent(object, path); + if (object != null) { + path = last(path); + result = hasFunc(object, path); + } + } + var length = object ? object.length : undefined; + return result || ( + !!length && isLength(length) && isIndex(path, length) && + (isArray(object) || isString(object) || isArguments(object)) + ); +} + /** * Checks if `value` is a property name and not a property path. * @@ -108,12 +237,34 @@ function last(array) { return length ? array[length - 1] : undefined; } +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ - * @type Function + * @type {Function} * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @@ -133,6 +284,250 @@ function last(array) { */ var isArray = Array.isArray; +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && + !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array constructors, and + // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + +/** + * Checks if `path` is a direct property of `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ +function has(object, path) { + return hasPath(object, path, baseHas); +} + /** * Removes the property at `path` of `object`. * diff --git a/lodash.unset/package.json b/lodash.unset/package.json index ecfc8e244..03dc877aa 100644 --- a/lodash.unset/package.json +++ b/lodash.unset/package.json @@ -1,6 +1,6 @@ { "name": "lodash.unset", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.unset` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,8 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseslice": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.has": "^4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.unzipwith/LICENSE b/lodash.unzipwith/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.unzipwith/LICENSE +++ b/lodash.unzipwith/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.unzipwith/README.md b/lodash.unzipwith/README.md index f782a1c01..fc08c3791 100644 --- a/lodash.unzipwith/README.md +++ b/lodash.unzipwith/README.md @@ -1,4 +1,4 @@ -# lodash.unzipwith v4.1.0 +# lodash.unzipwith v4.2.0 The [lodash](https://lodash.com/) method `_.unzipWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var unzipWith = require('lodash.unzipwith'); ``` -See the [documentation](https://lodash.com/docs#unzipWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.unzipwith) for more details. +See the [documentation](https://lodash.com/docs#unzipWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.unzipwith) for more details. diff --git a/lodash.unzipwith/index.js b/lodash.unzipwith/index.js index 87b2f845f..119420ead 100644 --- a/lodash.unzipwith/index.js +++ b/lodash.unzipwith/index.js @@ -1,12 +1,18 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var unzip = require('lodash.unzip'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; /** * A faster alternative to `Function#apply`, this function invokes `func` @@ -19,8 +25,7 @@ var unzip = require('lodash.unzip'); * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { - var length = args.length; - switch (length) { + switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); @@ -29,18 +34,42 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } +/** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ +function arrayFilter(array, predicate) { + var index = -1, + length = array ? array.length : 0, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; +} + /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array.length, + length = array ? array.length : 0, result = Array(length); while (++index < length) { @@ -49,6 +78,99 @@ function arrayMap(array, iteratee) { return result; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-zip + * configuration. + * + * @static + * @memberOf _ + * @since 1.2.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + * + * _.unzip(zipped); + * // => [['a', 'b'], [1, 2], [true, false]] + */ +function unzip(array) { + if (!(array && array.length)) { + return []; + } + var length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLikeObject(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + return baseTimes(length, function(index) { + return arrayMap(array, baseProperty(index)); + }); +} + /** * This method is like `_.unzip` except that it accepts `iteratee` to specify * how regrouped values should be combined. The iteratee is invoked with the @@ -83,4 +205,177 @@ function unzipWith(array, iteratee) { }); } +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + module.exports = unzipWith; diff --git a/lodash.unzipwith/package.json b/lodash.unzipwith/package.json index 671199aae..a7d9635a5 100644 --- a/lodash.unzipwith/package.json +++ b/lodash.unzipwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.unzipwith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.unzipWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,9 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.unzip": "^3.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.uppercase/README.md b/lodash.uppercase/README.md index 50a32fb7b..7a03db040 100644 --- a/lodash.uppercase/README.md +++ b/lodash.uppercase/README.md @@ -1,4 +1,4 @@ -# lodash.uppercase v4.1.1 +# lodash.uppercase v4.2.0 The [lodash](https://lodash.com/) method `_.upperCase` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var upperCase = require('lodash.uppercase'); ``` -See the [documentation](https://lodash.com/docs#upperCase) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.uppercase) for more details. +See the [documentation](https://lodash.com/docs#upperCase) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.uppercase) for more details. diff --git a/lodash.uppercase/index.js b/lodash.uppercase/index.js index 3a0fddab2..0ab5ab407 100644 --- a/lodash.uppercase/index.js +++ b/lodash.uppercase/index.js @@ -1,26 +1,123 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var deburr = require('lodash.deburr'), - words = require('lodash.words'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Used to match non-compound words composed of alphanumeric characters. */ +var reBasicWord = /[a-zA-Z0-9]+/g; + +/** Used to match latin-1 supplementary letters (excluding mathematical operators). */ +var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', + rsComboSymbolsRange = '\\u20d0-\\u20f0', + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; /** Used to compose unicode capture groups. */ -var rsApos = "['\u2019]"; +var rsApos = "['\u2019]", + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', + rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq; /** Used to match apostrophes. */ var reApos = RegExp(rsApos, 'g'); +/** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ +var reComboMark = RegExp(rsCombo, 'g'); + +/** Used to match complex or compound words. */ +var reComplexWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', + rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, + rsUpper + '+' + rsOptUpperContr, + rsDigits, + rsEmoji +].join('|'), 'g'); + +/** Used to detect strings that need a more robust regexp to match words. */ +var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + +/** Used to map latin-1 supplementary letters to basic latin letters. */ +var deburredLetters = { + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss' +}; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as @@ -29,7 +126,7 @@ var reApos = RegExp(rsApos, 'g'); */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, - length = array.length; + length = array ? array.length : 0; if (initAccum && length) { accumulator = array[++index]; @@ -40,6 +137,65 @@ function arrayReduce(array, iteratee, accumulator, initAccum) { return accumulator; } +/** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ +var deburrLetter = basePropertyOf(deburredLetters); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + /** * Creates a function like `_.camelCase`. * @@ -53,6 +209,103 @@ function createCompounder(callback) { }; } +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +/** + * Deburrs `string` by converting + * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * to basic latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ +function deburr(string) { + string = toString(string); + return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); +} + /** * Converts `string`, as space separated words, to upper case. * @@ -77,4 +330,33 @@ var upperCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toUpperCase(); }); +/** + * Splits `string` into an array of its words. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {RegExp|string} [pattern] The pattern to match words. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the words of `string`. + * @example + * + * _.words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + * _.words('fred, barney, & pebbles', /[^, ]+/g); + * // => ['fred', 'barney', '&', 'pebbles'] + */ +function words(string, pattern, guard) { + string = toString(string); + pattern = guard ? undefined : pattern; + + if (pattern === undefined) { + pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord; + } + return string.match(pattern) || []; +} + module.exports = upperCase; diff --git a/lodash.uppercase/package.json b/lodash.uppercase/package.json index 908e47b30..8cd441b93 100644 --- a/lodash.uppercase/package.json +++ b/lodash.uppercase/package.json @@ -1,6 +1,6 @@ { "name": "lodash.uppercase", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.upperCase` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.deburr": "^4.0.0", - "lodash.words": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.upperfirst/LICENSE b/lodash.upperfirst/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.upperfirst/LICENSE +++ b/lodash.upperfirst/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.upperfirst/README.md b/lodash.upperfirst/README.md index 8f6327138..fc594d02e 100644 --- a/lodash.upperfirst/README.md +++ b/lodash.upperfirst/README.md @@ -1,4 +1,4 @@ -# lodash.upperfirst v4.1.2 +# lodash.upperfirst v4.2.0 The [lodash](https://lodash.com/) method `_.upperFirst` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var upperFirst = require('lodash.upperfirst'); ``` -See the [documentation](https://lodash.com/docs#upperFirst) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.upperfirst) for more details. +See the [documentation](https://lodash.com/docs#upperFirst) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.upperfirst) for more details. diff --git a/lodash.upperfirst/index.js b/lodash.upperfirst/index.js index 5a82ecb7c..98a4a172b 100644 --- a/lodash.upperfirst/index.js +++ b/lodash.upperfirst/index.js @@ -1,12 +1,13 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var toString = require('lodash.tostring'); +var baseSlice = require('lodash._baseslice'), + toString = require('lodash.tostring'); /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', @@ -48,12 +49,27 @@ function stringToArray(string) { return string.match(reComplexSymbol); } +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} + /** * Creates a function like `_.lowerFirst`. * * @private * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new case function. */ function createCaseFirst(methodName) { return function(string) { @@ -63,8 +79,13 @@ function createCaseFirst(methodName) { ? stringToArray(string) : undefined; - var chr = strSymbols ? strSymbols[0] : string.charAt(0), - trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1); + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); return chr[methodName]() + trailing; }; diff --git a/lodash.upperfirst/package.json b/lodash.upperfirst/package.json index 5d76e6d32..88268bb4f 100644 --- a/lodash.upperfirst/package.json +++ b/lodash.upperfirst/package.json @@ -1,6 +1,6 @@ { "name": "lodash.upperfirst", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.upperFirst` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,13 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { + "lodash._baseslice": "~4.0.0", "lodash.tostring": "^4.0.0" } } diff --git a/lodash.values/LICENSE b/lodash.values/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.values/LICENSE +++ b/lodash.values/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.values/README.md b/lodash.values/README.md index 6244ed4cf..81423a894 100644 --- a/lodash.values/README.md +++ b/lodash.values/README.md @@ -1,4 +1,4 @@ -# lodash.values v4.1.0 +# lodash.values v4.2.0 The [lodash](https://lodash.com/) method `_.values` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var values = require('lodash.values'); ``` -See the [documentation](https://lodash.com/docs#values) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.values) for more details. +See the [documentation](https://lodash.com/docs#values) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.values) for more details. diff --git a/lodash.values/index.js b/lodash.values/index.js index 7ee0834d2..08b614b69 100644 --- a/lodash.values/index.js +++ b/lodash.values/index.js @@ -1,25 +1,36 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var keys = require('lodash.keys'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + stringTag = '[object String]'; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array.length, + length = array ? array.length : 0, result = Array(length); while (++index < length) { @@ -28,6 +39,38 @@ function arrayMap(array, iteratee) { return result; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names @@ -44,6 +87,427 @@ function baseValues(object, props) { }); } +/** + * Creates a function that invokes `func` with its first argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetPrototype = Object.getPrototypeOf, + nativeKeys = Object.keys; + +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHas(object, key) { + // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, + // that are composed entirely of index properties, return `false` for + // `hasOwnProperty` checks of them. + return object != null && + (hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null)); +} + +/** + * The base implementation of `_.keys` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +var baseKeys = overArg(nativeKeys, Object); + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Gets the `[[Prototype]]` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {null|Object} Returns the `[[Prototype]]`. + */ +var getPrototype = overArg(nativeGetPrototype, Object); + +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + var isProto = isPrototype(object); + if (!(isProto || isArrayLike(object))) { + return baseKeys(object); + } + var indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + for (var key in object) { + if (baseHas(object, key) && + !(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(isProto && key == 'constructor')) { + result.push(key); + } + } + return result; +} + /** * Creates an array of the own enumerable string keyed property values of `object`. * diff --git a/lodash.values/package.json b/lodash.values/package.json index 63d4bbaa8..2caced06c 100644 --- a/lodash.values/package.json +++ b/lodash.values/package.json @@ -1,6 +1,6 @@ { "name": "lodash.values", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.values` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,9 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.keys": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.valuesin/LICENSE b/lodash.valuesin/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.valuesin/LICENSE +++ b/lodash.valuesin/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.valuesin/README.md b/lodash.valuesin/README.md index fc09d1ba5..d79cf40ff 100644 --- a/lodash.valuesin/README.md +++ b/lodash.valuesin/README.md @@ -1,4 +1,4 @@ -# lodash.valuesin v4.1.0 +# lodash.valuesin v4.2.0 The [lodash](https://lodash.com/) method `_.valuesIn` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var valuesIn = require('lodash.valuesin'); ``` -See the [documentation](https://lodash.com/docs#valuesIn) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.valuesin) for more details. +See the [documentation](https://lodash.com/docs#valuesIn) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.valuesin) for more details. diff --git a/lodash.valuesin/index.js b/lodash.valuesin/index.js index 2fd80a52d..9039cabe3 100644 --- a/lodash.valuesin/index.js +++ b/lodash.valuesin/index.js @@ -1,25 +1,45 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var keysIn = require('lodash.keysin'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + stringTag = '[object String]'; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array.length, + length = array ? array.length : 0, result = Array(length); while (++index < length) { @@ -28,6 +48,38 @@ function arrayMap(array, iteratee) { return result; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names @@ -44,6 +96,412 @@ function baseValues(object, props) { }); } +/** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ +function iteratorToArray(iterator) { + var data, + result = []; + + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Reflect = root.Reflect, + enumerate = Reflect ? Reflect.enumerate : undefined, + propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * The base implementation of `_.keysIn` which doesn't skip the constructor + * property of prototypes or treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeysIn(object) { + object = object == null ? object : Object(object); + + var result = []; + for (var key in object) { + result.push(key); + } + return result; +} + +// Fallback for IE < 9 with es6-shim. +if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { + baseKeysIn = function(object) { + return iteratorToArray(enumerate(object)); + }; +} + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Creates an array of index keys for `object` values of arrays, + * `arguments` objects, and strings, otherwise `null` is returned. + * + * @private + * @param {Object} object The object to query. + * @returns {Array|null} Returns index keys, else `null`. + */ +function indexKeys(object) { + var length = object ? object.length : undefined; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); + } + return null; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); +} + +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + var index = -1, + isProto = isPrototype(object), + props = baseKeysIn(object), + propsLength = props.length, + indexes = indexKeys(object), + skipIndexes = !!indexes, + result = indexes || [], + length = result.length; + + while (++index < propsLength) { + var key = props[index]; + if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; +} + /** * Creates an array of the own and inherited enumerable string keyed property * values of `object`. diff --git a/lodash.valuesin/package.json b/lodash.valuesin/package.json index 5916f84f9..a3b40d012 100644 --- a/lodash.valuesin/package.json +++ b/lodash.valuesin/package.json @@ -1,6 +1,6 @@ { "name": "lodash.valuesin", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.valuesIn` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,12 +9,9 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash.keysin": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.without/LICENSE b/lodash.without/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.without/LICENSE +++ b/lodash.without/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.without/README.md b/lodash.without/README.md index 3299e4c53..dd02c51c7 100644 --- a/lodash.without/README.md +++ b/lodash.without/README.md @@ -1,4 +1,4 @@ -# lodash.without v4.1.2 +# lodash.without v4.2.0 The [lodash](https://lodash.com/) method `_.without` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var without = require('lodash.without'); ``` -See the [documentation](https://lodash.com/docs#without) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.without) for more details. +See the [documentation](https://lodash.com/docs#without) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.without) for more details. diff --git a/lodash.without/index.js b/lodash.without/index.js index 666d01781..7c6954106 100644 --- a/lodash.without/index.js +++ b/lodash.without/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseDifference = require('lodash._basedifference'), rest = require('lodash.rest'); @@ -31,7 +31,7 @@ var objectToString = objectProto.toString; * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { @@ -61,9 +61,10 @@ var getLength = baseProperty('length'); * @memberOf _ * @since 0.1.0 * @category Array - * @param {Array} array The array to filter. + * @param {Array} array The array to inspect. * @param {...*} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.xor * @example * * _.without([1, 2, 1, 3], 1, 2); diff --git a/lodash.without/package.json b/lodash.without/package.json index a5a8d9efe..2a0629819 100644 --- a/lodash.without/package.json +++ b/lodash.without/package.json @@ -1,6 +1,6 @@ { "name": "lodash.without", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.without` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._basedifference": "~4.4.0", + "lodash._basedifference": "~4.5.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.words/README.md b/lodash.words/README.md index ae990aa1b..ebc230154 100644 --- a/lodash.words/README.md +++ b/lodash.words/README.md @@ -1,4 +1,4 @@ -# lodash.words v4.1.2 +# lodash.words v4.2.0 The [lodash](https://lodash.com/) method `_.words` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var words = require('lodash.words'); ``` -See the [documentation](https://lodash.com/docs#words) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.words) for more details. +See the [documentation](https://lodash.com/docs#words) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.words) for more details. diff --git a/lodash.words/index.js b/lodash.words/index.js index 546ccc568..93a976a76 100644 --- a/lodash.words/index.js +++ b/lodash.words/index.js @@ -13,8 +13,8 @@ var INFINITY = 1 / 0; /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; -/** Used to match non-compound words composed of alphanumeric characters. */ -var reBasicWord = /[a-zA-Z0-9]+/g; +/** Used to match words composed of alphanumeric characters. */ +var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', @@ -58,7 +58,7 @@ var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq; /** Used to match complex or compound words. */ -var reComplexWord = RegExp([ +var reUnicodeWord = RegExp([ rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, @@ -68,7 +68,7 @@ var reComplexWord = RegExp([ ].join('|'), 'g'); /** Used to detect strings that need a more robust regexp to match words. */ -var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; +var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; @@ -79,12 +79,45 @@ var freeSelf = typeof self == 'object' && self && self.Object === Object && self /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); +/** + * Splits an ASCII `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ +function asciiWords(string) { + return string.match(reAsciiWord) || []; +} + +/** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ +function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); +} + +/** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ +function unicodeWords(string) { + return string.match(reUnicodeWord) || []; +} + /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -215,7 +248,7 @@ function words(string, pattern, guard) { pattern = guard ? undefined : pattern; if (pattern === undefined) { - pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord; + return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); } return string.match(pattern) || []; } diff --git a/lodash.words/package.json b/lodash.words/package.json index 64bf59d57..321062d1a 100644 --- a/lodash.words/package.json +++ b/lodash.words/package.json @@ -1,6 +1,6 @@ { "name": "lodash.words", - "version": "4.1.2", + "version": "4.2.0", "description": "The lodash method `_.words` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.xor/LICENSE b/lodash.xor/LICENSE index b054ca5a3..bcbe13d67 100644 --- a/lodash.xor/LICENSE +++ b/lodash.xor/LICENSE @@ -1,22 +1,23 @@ +The MIT License (MIT) + Copyright 2012-2016 The Dojo Foundation Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lodash.xor/README.md b/lodash.xor/README.md index 301d0d42d..dba978c7f 100644 --- a/lodash.xor/README.md +++ b/lodash.xor/README.md @@ -1,4 +1,4 @@ -# lodash.xor v4.1.0 +# lodash.xor v4.2.0 The [lodash](https://lodash.com/) method `_.xor` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var xor = require('lodash.xor'); ``` -See the [documentation](https://lodash.com/docs#xor) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.xor) for more details. +See the [documentation](https://lodash.com/docs#xor) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.xor) for more details. diff --git a/lodash.xor/index.js b/lodash.xor/index.js index a70a7885c..f55128f37 100644 --- a/lodash.xor/index.js +++ b/lodash.xor/index.js @@ -1,22 +1,13 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayFilter = require('lodash._arrayfilter'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - arrayMap = require('lodash._arraymap'), - cacheHas = require('lodash._cachehas'), - rest = require('lodash.rest'), - root = require('lodash._root'); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; +var baseXor = require('lodash._basexor'), + rest = require('lodash.rest'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -25,159 +16,39 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - /** - * Appends the elements of `values` to `array`. + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. * * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. */ -function arrayPush(array, values) { +function arrayFilter(array, predicate) { var index = -1, - length = values.length, - offset = array.length; + length = array.length, + resIndex = -1, + result = []; while (++index < length) { - array[offset + index] = values[index]; + var value = array[index]; + if (predicate(value, index, array)) { + result[++resIndex] = value; + } } - return array; -} - -/** - * The base implementation of `_.unary` without support for storing wrapper metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new function. - */ -function baseUnary(func) { - return function(value) { - return func(value); - }; -} - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); return result; } /** Used for built-in method references. */ var objectProto = Object.prototype; -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - -/** - * The base implementation of methods like `_.difference` without support for - * excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ -function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; -} - /** * The base implementation of `_.property` without support for deep paths. * @@ -191,102 +62,6 @@ function baseProperty(key) { }; } -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ -function baseXor(arrays, iteratee, comparator) { - var index = -1, - length = arrays.length; - - while (++index < length) { - var result = result - ? arrayPush( - baseDifference(result, arrays[index], iteratee, comparator), - baseDifference(arrays[index], result, iteratee, comparator) - ) - : arrays[index]; - } - return (result && result.length) ? baseUniq(result, iteratee, comparator) : []; -} - -/** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); -}; - /** * Gets the "length" property value of `object`. * @@ -299,19 +74,6 @@ var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { */ var getLength = baseProperty('length'); -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - /** * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * of the given arrays. @@ -337,7 +99,6 @@ var xor = rest(function(arrays) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -366,7 +127,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -437,7 +197,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -495,49 +256,4 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -/** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. - * - * @static - * @memberOf _ - * @category Util - * @example - * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true - */ -function noop() { - // No operation performed. -} - module.exports = xor; diff --git a/lodash.xor/package.json b/lodash.xor/package.json index c948f3947..0669fb988 100644 --- a/lodash.xor/package.json +++ b/lodash.xor/package.json @@ -1,6 +1,6 @@ { "name": "lodash.xor", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.xor` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,13 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayfilter": "^3.0.0", - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", - "lodash._arraymap": "^3.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._root": "^3.0.0", - "lodash._setcache": "^4.0.0", + "lodash._basexor": "^4.0.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.xorby/README.md b/lodash.xorby/README.md index 2c2dfbe79..e73fda758 100644 --- a/lodash.xorby/README.md +++ b/lodash.xorby/README.md @@ -1,4 +1,4 @@ -# lodash.xorby v4.1.1 +# lodash.xorby v4.2.0 The [lodash](https://lodash.com/) method `_.xorBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var xorBy = require('lodash.xorby'); ``` -See the [documentation](https://lodash.com/docs#xorBy) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.xorby) for more details. +See the [documentation](https://lodash.com/docs#xorBy) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.xorby) for more details. diff --git a/lodash.xorby/index.js b/lodash.xorby/index.js index af6a92866..b0b98868e 100644 --- a/lodash.xorby/index.js +++ b/lodash.xorby/index.js @@ -1,32 +1,14 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayFilter = require('lodash._arrayfilter'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - arrayMap = require('lodash._arraymap'), - baseIsEqual = require('lodash._baseisequal'), - baseIsMatch = require('lodash._baseismatch'), - cacheHas = require('lodash._cachehas'), - get = require('lodash.get'), - hasIn = require('lodash.hasin'), - rest = require('lodash.rest'), - root = require('lodash._root'), - toPairs = require('lodash.topairs'), - toString = require('lodash.tostring'); - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; +var baseIteratee = require('lodash._baseiteratee'), + baseXor = require('lodash._basexor'), + rest = require('lodash.rest'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -35,253 +17,39 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; - -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - /** - * Appends the elements of `values` to `array`. + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. * * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. */ -function arrayPush(array, values) { +function arrayFilter(array, predicate) { var index = -1, - length = values.length, - offset = array.length; + length = array.length, + resIndex = -1, + result = []; while (++index < length) { - array[offset + index] = values[index]; + var value = array[index]; + if (predicate(value, index, array)) { + result[++resIndex] = value; + } } - return array; -} - -/** - * The base implementation of `_.unary` without support for storing wrapper metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new function. - */ -function baseUnary(func) { - return function(value) { - return func(value); - }; -} - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); return result; } /** Used for built-in method references. */ var objectProto = Object.prototype; -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - -/** - * The base implementation of methods like `_.difference` without support for - * excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ -function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; -} - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path + ''] : baseToPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[path[index++]]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ -function baseIteratee(value) { - var type = typeof value; - if (type == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (type == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} - -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - var key = matchData[0][0], - value = matchData[0][1]; - - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && - (value !== undefined || (key in Object(object))); - }; - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} - -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new function. - */ -function baseMatchesProperty(path, srcValue) { - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} - /** * The base implementation of `_.property` without support for deep paths. * @@ -295,127 +63,6 @@ function baseProperty(key) { }; } -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} - -/** - * The base implementation of `_.toPath` which only converts `value` to a - * path if it's not one. - * - * @private - * @param {*} value The value to process. - * @returns {Array} Returns the property path array. - */ -function baseToPath(value) { - return isArray(value) ? value : stringToPath(value); -} - -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ -function baseXor(arrays, iteratee, comparator) { - var index = -1, - length = arrays.length; - - while (++index < length) { - var result = result - ? arrayPush( - baseDifference(result, arrays[index], iteratee, comparator), - baseDifference(arrays[index], result, iteratee, comparator) - ) - : arrays[index]; - } - return (result && result.length) ? baseUniq(result, iteratee, comparator) : []; -} - -/** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); -}; - /** * Gets the "length" property value of `object`. * @@ -428,80 +75,6 @@ var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { */ var getLength = baseProperty('length'); -/** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ -function getMatchData(object) { - var result = toPairs(object), - length = result.length; - - while (length--) { - result[length][2] = isStrictComparable(result[length][1]); - } - return result; -} - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ -function isKey(value, object) { - if (typeof value == 'number') { - return true; - } - return !isArray(value) && - (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); -} - -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); -} - -/** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ -function stringToPath(string) { - var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; -} - /** * Gets the last element of `array`. * @@ -548,31 +121,6 @@ var xorBy = rest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee)); }); -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @type Function - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or @@ -580,7 +128,6 @@ var isArray = Array.isArray; * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -609,7 +156,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -680,7 +226,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -738,93 +285,4 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -/** - * This method returns the first argument given to it. - * - * @static - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'user': 'fred' }; - * - * _.identity(object) === object; - * // => true - */ -function identity(value) { - return value; -} - -/** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. - * - * @static - * @memberOf _ - * @category Util - * @example - * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true - */ -function noop() { - // No operation performed. -} - -/** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new function. - * @example - * - * var objects = [ - * { 'a': { 'b': { 'c': 2 } } }, - * { 'a': { 'b': { 'c': 1 } } } - * ]; - * - * _.map(objects, _.property('a.b.c')); - * // => [2, 1] - * - * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); - * // => [1, 2] - */ -function property(path) { - return isKey(path) ? baseProperty(path) : basePropertyDeep(path); -} - module.exports = xorBy; diff --git a/lodash.xorby/package.json b/lodash.xorby/package.json index 76ce67232..5bc5aa3b7 100644 --- a/lodash.xorby/package.json +++ b/lodash.xorby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.xorby", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.xorBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,19 +15,8 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayfilter": "^3.0.0", - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", - "lodash._arraymap": "^3.0.0", - "lodash._baseisequal": "^4.0.0", - "lodash._baseismatch": "^4.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._root": "^3.0.0", - "lodash._setcache": "^4.0.0", - "lodash.get": "^4.0.0", - "lodash.hasin": "^4.0.0", - "lodash.rest": "^4.0.0", - "lodash.topairs": "^4.0.0", - "lodash.tostring": "^4.0.0" + "lodash._baseiteratee": "^4.0.0", + "lodash._basexor": "^4.0.0", + "lodash.rest": "^4.0.0" } } diff --git a/lodash.xorwith/LICENSE b/lodash.xorwith/LICENSE index b054ca5a3..bcbe13d67 100644 --- a/lodash.xorwith/LICENSE +++ b/lodash.xorwith/LICENSE @@ -1,22 +1,23 @@ +The MIT License (MIT) + Copyright 2012-2016 The Dojo Foundation Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lodash.xorwith/README.md b/lodash.xorwith/README.md index 5c78438d8..181ac078f 100644 --- a/lodash.xorwith/README.md +++ b/lodash.xorwith/README.md @@ -1,4 +1,4 @@ -# lodash.xorwith v4.1.0 +# lodash.xorwith v4.2.0 The [lodash](https://lodash.com/) method `_.xorWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var xorWith = require('lodash.xorwith'); ``` -See the [documentation](https://lodash.com/docs#xorWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.xorwith) for more details. +See the [documentation](https://lodash.com/docs#xorWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.xorwith) for more details. diff --git a/lodash.xorwith/index.js b/lodash.xorwith/index.js index 7310ac068..a894378aa 100644 --- a/lodash.xorwith/index.js +++ b/lodash.xorwith/index.js @@ -1,22 +1,13 @@ /** - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var SetCache = require('lodash._setcache'), - arrayFilter = require('lodash._arrayfilter'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - arrayMap = require('lodash._arraymap'), - cacheHas = require('lodash._cachehas'), - rest = require('lodash.rest'), - root = require('lodash._root'); - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; +var baseXor = require('lodash._basexor'), + rest = require('lodash.rest'); /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -25,159 +16,39 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - /** - * Appends the elements of `values` to `array`. + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. * * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. + * @param {Array} array The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. */ -function arrayPush(array, values) { +function arrayFilter(array, predicate) { var index = -1, - length = values.length, - offset = array.length; + length = array.length, + resIndex = -1, + result = []; while (++index < length) { - array[offset + index] = values[index]; + var value = array[index]; + if (predicate(value, index, array)) { + result[++resIndex] = value; + } } - return array; -} - -/** - * The base implementation of `_.unary` without support for storing wrapper metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new function. - */ -function baseUnary(func) { - return function(value) { - return func(value); - }; -} - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `set` to an array. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); return result; } /** Used for built-in method references. */ var objectProto = Object.prototype; -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/* Built-in method references that are verified to be native. */ -var Set = getNative(root, 'Set'); - -/** - * The base implementation of methods like `_.difference` without support for - * excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ -function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; -} - /** * The base implementation of `_.property` without support for deep paths. * @@ -191,102 +62,6 @@ function baseProperty(key) { }; } -/** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ -function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; -} - -/** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ -function baseXor(arrays, iteratee, comparator) { - var index = -1, - length = arrays.length; - - while (++index < length) { - var result = result - ? arrayPush( - baseDifference(result, arrays[index], iteratee, comparator), - baseDifference(arrays[index], result, iteratee, comparator) - ) - : arrays[index]; - } - return (result && result.length) ? baseUniq(result, iteratee, comparator) : []; -} - -/** - * Creates a set of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { - return new Set(values); -}; - /** * Gets the "length" property value of `object`. * @@ -299,19 +74,6 @@ var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { */ var getLength = baseProperty('length'); -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object == null ? undefined : object[key]; - return isNative(value) ? value : undefined; -} - /** * Gets the last element of `array`. * @@ -364,7 +126,6 @@ var xorWith = rest(function(arrays) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -393,7 +154,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -464,7 +224,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -522,49 +283,4 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -/** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. - * - * @static - * @memberOf _ - * @category Util - * @example - * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true - */ -function noop() { - // No operation performed. -} - module.exports = xorWith; diff --git a/lodash.xorwith/package.json b/lodash.xorwith/package.json index 8f0c7bf22..fdf574363 100644 --- a/lodash.xorwith/package.json +++ b/lodash.xorwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.xorwith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.xorWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,13 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arrayfilter": "^3.0.0", - "lodash._arrayincludes": "^4.0.0", - "lodash._arrayincludeswith": "^4.0.0", - "lodash._arraymap": "^3.0.0", - "lodash._cachehas": "^4.0.0", - "lodash._root": "^3.0.0", - "lodash._setcache": "^4.0.0", + "lodash._basexor": "^4.0.0", "lodash.rest": "^4.0.0" } } diff --git a/lodash.zip/README.md b/lodash.zip/README.md index 1066033cb..ac60cde9e 100644 --- a/lodash.zip/README.md +++ b/lodash.zip/README.md @@ -1,4 +1,4 @@ -# lodash.zip v4.1.0 +# lodash.zip v4.2.0 The [lodash](https://lodash.com/) method `_.zip` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var zip = require('lodash.zip'); ``` -See the [documentation](https://lodash.com/docs#zip) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.zip) for more details. +See the [documentation](https://lodash.com/docs#zip) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.zip) for more details. diff --git a/lodash.zip/index.js b/lodash.zip/index.js index a801ad027..4d058d5e5 100644 --- a/lodash.zip/index.js +++ b/lodash.zip/index.js @@ -115,7 +115,7 @@ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -152,19 +152,6 @@ function baseRest(func, start) { }; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * This method is like `_.zip` except that it accepts an array of grouped * elements and creates an array regrouping the elements to their pre-zip @@ -244,7 +231,7 @@ var zip = baseRest(unzip); * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -295,8 +282,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -304,16 +290,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -335,7 +320,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static diff --git a/lodash.zip/package.json b/lodash.zip/package.json index c7d4905f3..0b3b5c94f 100644 --- a/lodash.zip/package.json +++ b/lodash.zip/package.json @@ -1,6 +1,6 @@ { "name": "lodash.zip", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.zip` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.zipobjectdeep/LICENSE b/lodash.zipobjectdeep/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.zipobjectdeep/LICENSE +++ b/lodash.zipobjectdeep/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.zipobjectdeep/README.md b/lodash.zipobjectdeep/README.md index 428949cb4..1ae4bb19d 100644 --- a/lodash.zipobjectdeep/README.md +++ b/lodash.zipobjectdeep/README.md @@ -1,4 +1,4 @@ -# lodash.zipobjectdeep v4.1.1 +# lodash.zipobjectdeep v4.2.0 The [lodash](https://lodash.com/) method `_.zipObjectDeep` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var zipObjectDeep = require('lodash.zipobjectdeep'); ``` -See the [documentation](https://lodash.com/docs#zipObjectDeep) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.zipobjectdeep) for more details. +See the [documentation](https://lodash.com/docs#zipObjectDeep) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.zipobjectdeep) for more details. diff --git a/lodash.zipobjectdeep/index.js b/lodash.zipobjectdeep/index.js index 2419f8d81..5e4afcd10 100644 --- a/lodash.zipobjectdeep/index.js +++ b/lodash.zipobjectdeep/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.1 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseSet = require('lodash._baseset'); @@ -12,7 +12,7 @@ var baseSet = require('lodash._baseset'); * This base implementation of `_.zipObject` which assigns values using `assignFunc`. * * @private - * @param {Array} props The property names. + * @param {Array} props The property identifiers. * @param {Array} values The property values. * @param {Function} assignFunc The function to assign values. * @returns {Object} Returns the new object. @@ -24,7 +24,8 @@ function baseZipObject(props, values, assignFunc) { result = {}; while (++index < length) { - assignFunc(result, props[index], index < valsLength ? values[index] : undefined); + var value = index < valsLength ? values[index] : undefined; + assignFunc(result, props[index], value); } return result; } @@ -34,8 +35,9 @@ function baseZipObject(props, values, assignFunc) { * * @static * @memberOf _ + * @since 4.1.0 * @category Array - * @param {Array} [props=[]] The property names. + * @param {Array} [props=[]] The property identifiers. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example diff --git a/lodash.zipobjectdeep/package.json b/lodash.zipobjectdeep/package.json index 81bbb762f..cf927995b 100644 --- a/lodash.zipobjectdeep/package.json +++ b/lodash.zipobjectdeep/package.json @@ -1,6 +1,6 @@ { "name": "lodash.zipobjectdeep", - "version": "4.1.1", + "version": "4.2.0", "description": "The lodash method `_.zipObjectDeep` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseset": "~4.1.0" + "lodash._baseset": "~4.2.0" } } diff --git a/lodash.zipwith/README.md b/lodash.zipwith/README.md index 24d003ca5..81309dc9b 100644 --- a/lodash.zipwith/README.md +++ b/lodash.zipwith/README.md @@ -1,4 +1,4 @@ -# lodash.zipwith v4.1.0 +# lodash.zipwith v4.2.0 The [lodash](https://lodash.com/) method `_.zipWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var zipWith = require('lodash.zipwith'); ``` -See the [documentation](https://lodash.com/docs#zipWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.zipwith) for more details. +See the [documentation](https://lodash.com/docs#zipWith) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.zipwith) for more details. diff --git a/lodash.zipwith/index.js b/lodash.zipwith/index.js index 8b6fa80b7..e2aa16cf9 100644 --- a/lodash.zipwith/index.js +++ b/lodash.zipwith/index.js @@ -115,7 +115,7 @@ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -152,19 +152,6 @@ function baseRest(func, start) { }; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * This method is like `_.zip` except that it accepts an array of grouped * elements and creates an array regrouping the elements to their pre-zip @@ -287,7 +274,7 @@ var zipWith = baseRest(function(arrays) { * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -338,8 +325,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -347,16 +333,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -378,7 +363,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static diff --git a/lodash.zipwith/package.json b/lodash.zipwith/package.json index 7c977d680..53ec4b97f 100644 --- a/lodash.zipwith/package.json +++ b/lodash.zipwith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.zipwith", - "version": "4.1.0", + "version": "4.2.0", "description": "The lodash method `_.zipWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg",