-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
uncurryThis
internal helper to avoid some .call
that could be…
… used for breaking / observing the internal state
- Loading branch information
Showing
98 changed files
with
358 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require('../../modules/es.date.to-primitive'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
var toPrimitive = require('../../internals/date-to-primitive'); | ||
|
||
module.exports = function (it, hint) { | ||
return toPrimitive.call(it, hint); | ||
}; | ||
module.exports = uncurryThis(toPrimitive); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require('../../modules/es.date.to-string'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
var dateToString = Date.prototype.toString; | ||
|
||
module.exports = function toString(it) { | ||
return dateToString.call(it); | ||
}; | ||
module.exports = uncurryThis(dateToString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require('../../modules/es.regexp.flags'); | ||
var flags = require('../../internals/regexp-flags'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
var regExpFlags = require('../../internals/regexp-flags'); | ||
|
||
module.exports = function (it) { | ||
return flags.call(it); | ||
}; | ||
module.exports = uncurryThis(regExpFlags); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require('../../modules/es.regexp.exec'); | ||
require('../../modules/es.regexp.test'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
|
||
module.exports = function (re, string) { | ||
return RegExp.prototype.test.call(re, string); | ||
}; | ||
module.exports = uncurryThis(/./.test); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
require('../../modules/es.regexp.to-string'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
|
||
module.exports = function toString(it) { | ||
return RegExp.prototype.toString.call(it); | ||
}; | ||
module.exports = uncurryThis(/./.toString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
'use strict'; | ||
require('../../modules/es.map'); | ||
require('../../modules/esnext.map.group-by'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
var isCallable = require('../../internals/is-callable'); | ||
var path = require('../../internals/path'); | ||
|
||
var Map = path.Map; | ||
var mapGroupBy = Map.groupBy; | ||
var mapGroupBy = uncurryThis(Map.groupBy); | ||
|
||
module.exports = function groupBy(source, iterable, keyDerivative) { | ||
return mapGroupBy.call(isCallable(this) ? this : Map, source, iterable, keyDerivative); | ||
return mapGroupBy(isCallable(this) ? this : Map, source, iterable, keyDerivative); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
'use strict'; | ||
require('../../modules/es.map'); | ||
require('../../modules/esnext.map.key-by'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
var isCallable = require('../../internals/is-callable'); | ||
var path = require('../../internals/path'); | ||
|
||
var Map = path.Map; | ||
var mapKeyBy = Map.keyBy; | ||
var mapKeyBy = uncurryThis(Map.keyBy); | ||
|
||
module.exports = function keyBy(source, iterable, keyDerivative) { | ||
return mapKeyBy.call(isCallable(this) ? this : Map, source, iterable, keyDerivative); | ||
return mapKeyBy(isCallable(this) ? this : Map, source, iterable, keyDerivative); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
'use strict'; | ||
require('../../modules/es.promise'); | ||
require('../../modules/esnext.promise.try'); | ||
var uncurryThis = require('../../internals/function-uncurry-this'); | ||
var isCallable = require('../../internals/is-callable'); | ||
var path = require('../../internals/path'); | ||
|
||
var Promise = path.Promise; | ||
var promiseTry = Promise['try']; | ||
var promiseTry = uncurryThis(Promise['try']); | ||
|
||
module.exports = { 'try': function (callbackfn) { | ||
return promiseTry.call(isCallable(this) ? this : Promise, callbackfn); | ||
return promiseTry(isCallable(this) ? this : Promise, callbackfn); | ||
} }['try']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.