Son CV dans un terminal web en Javascript!
https://terminal-cv.gregandev.fr
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
913 B
33 lines
913 B
'use strict';
|
|
|
|
var GetIntrinsic = require('get-intrinsic');
|
|
|
|
var $TypeError = GetIntrinsic('%TypeError%');
|
|
|
|
var IsArray = require('./IsArray');
|
|
|
|
var isByteValue = require('../helpers/isByteValue');
|
|
|
|
// https://ecma-international.org/ecma-262/12.0/#sec-bytelistequal
|
|
|
|
module.exports = function ByteListEqual(xBytes, yBytes) {
|
|
if (!IsArray(xBytes) || !IsArray(yBytes)) {
|
|
throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be sequences of byte values (an integer 0-255, inclusive)');
|
|
}
|
|
|
|
if (xBytes.length !== yBytes.length) {
|
|
return false;
|
|
}
|
|
|
|
for (var i = 0; i < xBytes.length; i += 1) {
|
|
var xByte = xBytes[i];
|
|
var yByte = yBytes[i];
|
|
if (!isByteValue(xByte) || !isByteValue(yByte)) {
|
|
throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be sequences of byte values (an integer 0-255, inclusive)');
|
|
}
|
|
if (xByte !== yByte) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
|