Closed Bug 1022396 Opened 10 years ago Closed 10 years ago

remove Number.toInteger

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: Benjamin, Assigned: Benjamin)

Details

(Keywords: dev-doc-complete, Whiteboard: [DocArea=JS])

Attachments

(1 file)

When I implemented Number.toInteger in bug 761495, it was part of the ES6 draft spec. It has since been removed. No other engine implements it and according to DXR, its use in Gecko is limited to its own testsuite. Therefore, let's remove it.
Attached patch rm-nti.patchSplinter Review
Attachment #8436538 - Flags: review?(jorendorff)
Keywords: dev-doc-needed
Whiteboard: [DocArea=JS]
Comment on attachment 8436538 [details] [diff] [review]
rm-nti.patch

Review of attachment 8436538 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you!
Attachment #8436538 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/fc1936b69cbf
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Since it is being removed, what is the recommended alternative?
Why not just write it out by hand?

function ToInteger(v)
{
  var n = +v;
  if (!n)
    return n;
  return n < 0 ? Math.ceil(n) : Math.floor(n);
}
You need to log in before you can comment on or make changes to this bug.