@a-2-c-2-anpm/sint-dolor-quisquam

[![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url]


Keywords
Array.prototype.flatMap, mapreduce, yup, Function.prototype.name, typeerror, getopt, names, Float32Array, isConcatSpreadable, String.prototype.trim, phone, trimEnd, link, accessibility, fast-deep-copy, zod, drop, match, location, wait, api, karma, tap, callbind, Object, weakset, quote, color, styled-components, getPrototypeOf, argument, util, inspect, concat, lint, valid, lru, rfc4122, hot, Object.entries, fastclone, sham, ponyfill, log, argv, node, make, validate, iterate, espree, gradients css, is, es2015, WebSockets, Array, queueMicrotask, redirect, Object.defineProperty, javascript, protobuf, extra, trimStart, call-bound, error, es2018, debugger, task, lesscss, ascii, values, react-hook-form, column, jsdom, Iterator, write, mkdir, $.extend, eslintconfig, serialization, l10n, flag, fetch, YAML, less, TypeBox, eslintplugin, .env, connect, module, storagegateway, file system, Array.prototype.flat, defineProperty, findup, toobject, Uint8Array, Array.prototype.findLastIndex, iteration, stable, i18n, ES2022, express, mkdirp, data, negative, es, logging, linewrap, elm, intrinsic, io-ts, getintrinsic, wget, classname, Object.assign, listeners, asserts, file, iam, [[Prototype]], async, qs, circular, tester, command, fastify, less mixins, command-line, tslib, config, structuredClone, npm, query, less css, ES2017, dynamodb, korean, simpledb, worker, route, class-validator, rgb, Array.prototype.includes, redux-toolkit, promises, spec, parse, internal slot, consume, symbols, matchAll, immutable, prototype, limit, view, superagent, styling, tape, es-shim API, polyfill, contains, in, xhr, includes, offset, random, accessor, invariant, BigInt64Array, promise, nodejs, browserlist, ECMAScript 3, Object.values, settings, curl, workflow, value, environment, output, parser, negative zero, starter, private data, installer, look, wrap, east-asian-width, Array.prototype.findLast, package manager, compiler, sns, toSorted, state, syntax, Array.prototype.contains, length, crypt, entries, variables in css, queue, browserslist, japanese, concurrency, readablestream, hash, chinese, figlet, batch, -0, parents, style, encryption, private, vest, minimal, cli, commander, watchFile, Array.prototype.flatten, find, prune, mimetypes, findLast, cloudsearch, trimLeft, every, mixins, rm -fr, parent, language, byte, pyyaml, syntaxerror, prefix, touch, dependency manager, equality, performant, auth, css-in-js, watching, find-up, jest, banner, sequence, obj, Object.getPrototypeOf, walking, performance, functional, type, terminal, setPrototypeOf, glob, eventEmitter, id, fps, RFC-6455, coercible, look-up, take, toArray, properties, es2016, rangeerror, typeof, eslint-plugin, ES2023, serialize, request, classes, redact, less.js, move, await, vpc, ArrayBuffer#slice, censor, functions, search, last, tdd, ECMAScript 2020, dom, colors, ECMAScript 7, eslint, shrinkwrap, directory, StyleSheet, scheme-validation, route53, jsonpath, core-js, callbound, matches, runtime, tostringtag, Int8Array, classnames, jQuery, spinner, autoscaling, core, emoji, has, ES5, ES7, url, has-own, remove, modules, less compiler, tty, gdpr, install, zero, full, forms, concatMap, argparse, check, mime, import, reduce, __proto__, Map, autoprefixer, immer, copy, ECMAScript 2021, graphql, events, generics, throttle, sqs, shared, lockfile, trim, ECMAScript 2016, internal, AsyncIterator, expression, stringifier, 0, superstruct, logger, Streams
License
MIT
Install
npm install @a-2-c-2-anpm/sint-dolor-quisquam@1.0.0

Documentation

@a-2-c-2-anpm/sint-dolor-quisquam Version Badge

github actions coverage License Downloads

npm badge

Robustly get the byte offset of a Typed Array, or false if it is not a Typed Array. Works cross-realm, in every engine, even if the byteOffset property is overridden.

Example

var typedArrayByteOffset = require('@a-2-c-2-anpm/sint-dolor-quisquam');
var assert = require('assert');

assert.equal(false, typedArrayByteOffset(undefined));
assert.equal(false, typedArrayByteOffset(null));
assert.equal(false, typedArrayByteOffset(false));
assert.equal(false, typedArrayByteOffset(true));
assert.equal(false, typedArrayByteOffset([]));
assert.equal(false, typedArrayByteOffset({}));
assert.equal(false, typedArrayByteOffset(/a/g));
assert.equal(false, typedArrayByteOffset(new RegExp('a', 'g')));
assert.equal(false, typedArrayByteOffset(new Date()));
assert.equal(false, typedArrayByteOffset(42));
assert.equal(false, typedArrayByteOffset(NaN));
assert.equal(false, typedArrayByteOffset(Infinity));
assert.equal(false, typedArrayByteOffset(new Number(42)));
assert.equal(false, typedArrayByteOffset('foo'));
assert.equal(false, typedArrayByteOffset(Object('foo')));
assert.equal(false, typedArrayByteOffset(function () {}));
assert.equal(false, typedArrayByteOffset(function* () {}));
assert.equal(false, typedArrayByteOffset(x => x * x));
assert.equal(false, typedArrayByteOffset([]));

const buffer = new ArrayBuffer(32);

assert.equal(8, typedArrayByteOffset(new Int8Array(buffer, 8)));
assert.equal(8, typedArrayByteOffset(new Uint8Array(buffer, 8)));
assert.equal(8, typedArrayByteOffset(new Uint8ClampedArray(buffer, 8)));
assert.equal(4, typedArrayByteOffset(new Int16Array(buffer, 4)));
assert.equal(4, typedArrayByteOffset(new Uint16Array(buffer, 4)));
assert.equal(8, typedArrayByteOffset(new Int32Array(buffer, 8)));
assert.equal(8, typedArrayByteOffset(new Uint32Array(buffer, 8)));
assert.equal(16, typedArrayByteOffset(new Float32Array(buffer, 16)));
assert.equal(16, typedArrayByteOffset(new Float64Array(buffer, 16)));
assert.equal(16, typedArrayByteOffset(new BigInt64Array(buffer, 16)));
assert.equal(16, typedArrayByteOffset(new BigUint64Array(buffer, 16)));

Tests

Simply clone the repo, npm install, and run npm test