-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
223 additions
and
9 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require('../../modules/es6.number.to-precision'); | ||
module.exports = require('../../modules/_core').Number.toPrecision; |
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,2 +1,5 @@ | ||
require('../../../modules/core.number.iterator'); | ||
module.exports = {iterator: require('../../../modules/_iterators').Number}; | ||
module.exports = { | ||
toPrecision: require('../../../modules/_entry-virtual')('Number').toPrecision, | ||
iterator: require('../../../modules/_iterators').Number | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require('../../../modules/es6.number.to-precision'); | ||
module.exports = require('../../../modules/_entry-virtual')('Number').toPrecision; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require('../../modules/es6.number.to-precision'); | ||
module.exports = require('../../modules/_core').Number.toPrecision; |
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,2 +1,5 @@ | ||
require('../../../modules/core.number.iterator'); | ||
module.exports = {iterator: require('../../../modules/_iterators').Number}; | ||
module.exports = { | ||
toPrecision: require('../../../modules/_entry-virtual')('Number').toPrecision, | ||
iterator: require('../../../modules/_iterators').Number | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require('../../../modules/es6.number.to-precision'); | ||
module.exports = require('../../../modules/_entry-virtual')('Number').toPrecision; |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
var $export = require('./_export') | ||
, $toPrecision = 1..toPrecision; | ||
|
||
$export($export.P + $export.F * require('./_fails')(function(){ | ||
return $toPrecision.call(1, undefined) !== '1'; | ||
}), 'Number', { | ||
toPrecision: function toPrecision(precision){ | ||
return precision === undefined ? $toPrecision.call(this) : $toPrecision.call(this, precision); | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
var $export = require('./_export') | ||
, $toPrecision = 1..toPrecision; | ||
|
||
$export($export.P + $export.F * require('./_fails')(function(){ | ||
return $toPrecision.call(1, undefined) !== '1'; | ||
}), 'Number', { | ||
toPrecision: function toPrecision(precision){ | ||
return precision === undefined ? $toPrecision.call(this) : $toPrecision.call(this, precision); | ||
} | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{module, test} = QUnit | ||
module \ES6 | ||
|
||
test 'Number#toPrecision' (assert)!-> | ||
{toPrecision} = core.Number | ||
assert.isFunction toPrecision | ||
assert.same toPrecision(0.00008 3), '0.0000800' | ||
assert.same toPrecision(1.255 2), '1.3' | ||
assert.same toPrecision(1843654265.0774949 13), '1843654265.077' | ||
assert.same toPrecision(NaN, 1), 'NaN' | ||
assert.same toPrecision(123.456), '123.456' | ||
assert.same toPrecision(123.456 void), '123.456' | ||
assert.throws (!-> toPrecision 0.9 0), RangeError | ||
assert.throws (!-> toPrecision 0.9 101), RangeError | ||
assert.throws (-> toPrecision {}, 1), TypeError | ||
assert.throws (-> toPrecision \123, 1), TypeError | ||
assert.throws (-> toPrecision no, 1), TypeError | ||
assert.throws (-> toPrecision null, 1), TypeError | ||
assert.throws (-> toPrecision void, 1), TypeError |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{module, test} = QUnit | ||
module \ES6 | ||
|
||
test 'Number#toPrecision' (assert)!-> | ||
{toPrecision} = Number:: | ||
assert.isFunction toPrecision | ||
assert.name toPrecision, \toPrecision | ||
assert.arity toPrecision, 1 | ||
assert.looksNative toPrecision | ||
assert.same 0.00008.toPrecision(3), '0.0000800' | ||
assert.same 1.255.toPrecision(2), '1.3' | ||
assert.same 1843654265.0774949.toPrecision(13), '1843654265.077' | ||
assert.same NaN.toPrecision(1), 'NaN' | ||
assert.same 123.456.toPrecision!, '123.456' | ||
assert.same 123.456.toPrecision(void), '123.456' | ||
assert.throws (!-> 0.9.toPrecision 0), RangeError | ||
assert.throws (!-> 0.9.toPrecision 101), RangeError | ||
assert.throws (-> toPrecision.call {}, 1), TypeError | ||
assert.throws (-> toPrecision.call \123, 1), TypeError | ||
assert.throws (-> toPrecision.call no, 1), TypeError | ||
assert.throws (-> toPrecision.call null, 1), TypeError | ||
assert.throws (-> toPrecision.call void, 1), TypeError |