source: imaps-frontend/node_modules/es-abstract/2016/ToUint16.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 607 bytes
Line 
1'use strict';
2
3var modulo = require('./modulo');
4var ToNumber = require('./ToNumber');
5
6var abs = require('math-intrinsics/abs');
7var floor = require('math-intrinsics/floor');
8var $isNaN = require('math-intrinsics/isNaN');
9var $isFinite = require('math-intrinsics/isFinite');
10var $sign = require('math-intrinsics/sign');
11
12// http://262.ecma-international.org/5.1/#sec-9.7
13
14module.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.