source: imaps-frontend/node_modules/es-abstract/2017/ToUint8.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: 626 bytes
Line 
1'use strict';
2
3var ToNumber = require('./ToNumber');
4
5var $isNaN = require('math-intrinsics/isNaN');
6var $isFinite = require('math-intrinsics/isFinite');
7var $sign = require('math-intrinsics/sign');
8var abs = require('math-intrinsics/abs');
9var floor = require('math-intrinsics/floor');
10var modulo = require('math-intrinsics/mod');
11
12// https://262.ecma-international.org/6.0/#sec-touint8
13
14module.exports = function ToUint8(argument) {
15 var number = ToNumber(argument);
16 if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
17 var posInt = $sign(number) * floor(abs(number));
18 return modulo(posInt, 0x100);
19};
Note: See TracBrowser for help on using the repository browser.