Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address nits
  • Loading branch information
jasnell committed Apr 20, 2017
commit 4b013e8d862395e1181788ed5b133ea5ee54b3a8
21 changes: 0 additions & 21 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,10 @@ const kArrowMessagePrivateSymbolIndex = binding['arrow_message_private_symbol'];
const kDecoratedPrivateSymbolIndex = binding['decorated_private_symbol'];
const noCrypto = !process.versions.openssl;

/*
* Implementation of ToInteger as per ECMAScript Specification
* Refer: http://www.ecma-international.org/ecma-262/6.0/#sec-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
*/
function toLength(argument) {
const len = toInteger(argument);
return len <= 0 ? 0 : Math.min(len, Number.MAX_SAFE_INTEGER);
}

function isError(e) {
return objectToString(e) === '[object Error]' || e instanceof Error;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes there is two lines beween definitions, sometimes one, should probably be consisten


function objectToString(o) {
return Object.prototype.toString.call(o);
}
Expand Down Expand Up @@ -210,8 +191,6 @@ module.exports = {
isError,
normalizeEncoding,
objectToString,
toInteger,
toLength,

// Symbol used to provide a custom inspect function for an object as an
// alternative to using 'inspect'
Expand Down