diff options
author | Rich Trott <rtrott@gmail.com> | 2016-11-26 09:53:38 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-11-26 11:40:24 -0800 |
commit | 6b2aa1a2b9ba2cc51eafd31099a5658c52902e3d (patch) | |
tree | 67f591f163846f42747eaa1bfee6fbb6b771ef03 /lib/internal/util.js | |
parent | 951ba0d0a91e87813ea18181c1cbdb5e6ad5ac3b (diff) | |
download | android-node-v8-6b2aa1a2b9ba2cc51eafd31099a5658c52902e3d.tar.gz android-node-v8-6b2aa1a2b9ba2cc51eafd31099a5658c52902e3d.tar.bz2 android-node-v8-6b2aa1a2b9ba2cc51eafd31099a5658c52902e3d.zip |
Revert "buffer: convert offset & length to int properly"
This reverts commit ca37fa527f174b547893817fe8c67a3befa02317.
A test provided by the commit fails on most (but not all) platforms on
CI.
PR-URL: https://github.com/nodejs/node/pull/9814
Ref: https://github.com/nodejs/node/pull/9492
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Diffstat (limited to 'lib/internal/util.js')
-rw-r--r-- | lib/internal/util.js | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/lib/internal/util.js b/lib/internal/util.js index ae8b1e0b64..4ada8dd0cc 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -161,21 +161,3 @@ exports.cachedResult = function cachedResult(fn) { return result; }; }; - -/* - * Implementation of ToInteger as per ECMAScript Specification - * Refer: http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger - */ -const toInteger = exports.toInteger = function toInteger(argument) { - const number = +argument; - return Number.isNaN(number) ? 0 : Math.trunc(number); -}; - -/* - * Implementation of ToLength as per ECMAScript Specification - * Refer: http://www.ecma-international.org/ecma-262/6.0/#sec-tolength - */ -exports.toLength = function toLength(argument) { - const len = toInteger(argument); - return len <= 0 ? 0 : Math.min(len, Number.MAX_SAFE_INTEGER); -}; |