main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
564 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var abs = require('./abs');
|
---|
4 | var floor = require('./floor');
|
---|
5 | var modulo = require('./modulo');
|
---|
6 | var ToNumber = require('./ToNumber');
|
---|
7 |
|
---|
8 | var $isNaN = require('../helpers/isNaN');
|
---|
9 | var $isFinite = require('../helpers/isFinite');
|
---|
10 | var $sign = require('../helpers/sign');
|
---|
11 |
|
---|
12 | // http://262.ecma-international.org/5.1/#sec-9.7
|
---|
13 |
|
---|
14 | module.exports = function ToUint16(value) {
|
---|
15 | var number = ToNumber(value);
|
---|
16 | if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
|
---|
17 | var posInt = $sign(number) * floor(abs(number));
|
---|
18 | return modulo(posInt, 0x10000);
|
---|
19 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.