Projekt

Obecné

Profil

Stáhnout (594 Bajtů) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
'use strict';
2
3
var GetIntrinsic = require('../GetIntrinsic');
4
5
var $Math = GetIntrinsic('%Math%');
6
7
var ToNumber = require('./ToNumber');
8
9
var $isNaN = require('../helpers/isNaN');
10
var $isFinite = require('../helpers/isFinite');
11
var $sign = require('../helpers/sign');
12
var $mod = require('../helpers/mod');
13
14
var $floor = $Math.floor;
15
var $abs = $Math.abs;
16
17
module.exports = function ToUint8(argument) {
18
	var number = ToNumber(argument);
19
	if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
20
	var posInt = $sign(number) * $floor($abs(number));
21
	return $mod(posInt, 0x100);
22
};