This file contains hidden or 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
| function defaultCompare(a, b) { | |
| return ((a < b) && -1) || ((a > b) && 1) || 0; | |
| } | |
| // function localeCompare(a, b) { | |
| // return a.localeCompare | |
| // ? a.localeCompare(b) | |
| // : defaultCompare(a, b); | |
| // } | |
| // - supports additional `…[, locales[, options]` argument binding |
This file contains hidden or 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
| /** | |
| * `Boolean.isTrue` / `Boolean.isFalse` is a fun implementation of Smalltalk's [https://en.wikipedia.org/wiki/Smalltalk] | |
| * `ifTrue` / `ifFalse` control structures [https://en.wikipedia.org/wiki/Smalltalk#Control_structures]. | |
| * | |
| * It is nothing one would really desire in JavaScript unless one is looking for an alternative to its native `if...else` | |
| * statement and has deeply fallen in love with using function expressions all along. | |
| * | |
| * EN: [https://en.wikipedia.org/wiki/Smalltalk#Control_structures] | |
| * DE: [https://de.wikipedia.org/wiki/Smalltalk_(Programmiersprache)#IF-Anweisung] | |
| */ |
This file contains hidden or 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
| // see: "Compose in JavaScript, not applying functions correctly?" asked by Dan Mantyla - Nov 10, 2014 | |
| // answer: [https://stackoverflow.com/questions/26835095/compose-in-javascript-not-applying-functions-correctly/28880612#28880612] | |
| (function (Function, Object) { | |
| const fctPrototype = Function.prototype; | |
| const FUNCTION_TYPE = (typeof Function); | |
| function isFunction(type) { | |
| return ( |
This file contains hidden or 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
| // see [https://gist.github.com/petsel/9ddf5ce515f1344c84bd#file-function-afterthrowing-js] | |
| (function (Function) { | |
| const fctPrototype = Function.prototype; | |
| const FUNCTION_TYPE = (typeof Function); | |
| function isFunction(type) { | |
| return ( | |
| (typeof type == FUNCTION_TYPE) |
This file contains hidden or 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
| // see [https://gist.github.com/petsel/3b31cd5e63d43b9e7c4e#file-function-afterfinally-js] | |
| (function (Function) { | |
| const fctPrototype = Function.prototype; | |
| const FUNCTION_TYPE = (typeof Function); | |
| function isFunction(type) { | |
| return ( | |
| (typeof type == FUNCTION_TYPE) |
This file contains hidden or 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
| function isBooleanValue(type) { | |
| return (typeof type === 'boolean'); | |
| } | |
| function isNumberValue(type) { | |
| return (typeof type === 'number'); | |
| } | |
| function isStringValue(type) { | |
| return (typeof type === 'string'); | |
| } |
This file contains hidden or 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
| // file "Object.getMaxDepth.js" | |
| const Object = global.Object; | |
| const object_prototype_toString = Object.prototype.toString; | |
| const object_keys = Object.keys; | |
| const math_max = global.Math.max; | |
| const isArray = global.Array.isArray; |
This file contains hidden or 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
| (function (global) { | |
| 'use strict'; | |
| var | |
| Array = global.Array, | |
| Object = global.Object, | |
| RegExp = global.RegExp, | |
| Function = global.Function, |
This file contains hidden or 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
| /** | |
| * refactored version as part of an answer at Stackoverflow | |
| * | |
| * - [https://stackoverflow.com/questions/69204241/javascript-counter-with-timed-intervals/69204495#69204495] | |
| */ | |
| (function (global, Reflect, Math, Number, Array, Function) { | |
| 'use strict'; | |
| /** |