source: imaps-frontend/node_modules/es-abstract/2022/ToUint8.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 573 bytes
Line 
1'use strict';
2
3var ToNumber = require('./ToNumber');
4
5var $isNaN = require('../helpers/isNaN');
6var $isFinite = require('../helpers/isFinite');
7var $sign = require('../helpers/sign');
8
9var abs = require('./abs');
10var floor = require('./floor');
11var modulo = require('./modulo');
12
13// https://262.ecma-international.org/6.0/#sec-touint8
14
15module.exports = function ToUint8(argument) {
16 var number = ToNumber(argument);
17 if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
18 var posInt = $sign(number) * floor(abs(number));
19 return modulo(posInt, 0x100);
20};
Note: See TracBrowser for help on using the repository browser.