@visulima/bytes 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+
5
+ const copy = require('./copy-Bx6bRT8N.cjs');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ function repeat(source, count) {
10
+ if (count < 0 || !Number.isInteger(count)) {
11
+ throw new RangeError("Count must be a non-negative integer");
12
+ }
13
+ const repeated = new Uint8Array(source.length * count);
14
+ let offset = 0;
15
+ while (offset < repeated.length) {
16
+ offset += copy.copy(source, repeated, offset);
17
+ }
18
+ return repeated;
19
+ }
20
+ __name(repeat, "repeat");
21
+
22
+ exports.repeat = repeat;
@@ -0,0 +1,18 @@
1
+ import { copy } from './copy-DrPnASpi.mjs';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ function repeat(source, count) {
6
+ if (count < 0 || !Number.isInteger(count)) {
7
+ throw new RangeError("Count must be a non-negative integer");
8
+ }
9
+ const repeated = new Uint8Array(source.length * count);
10
+ let offset = 0;
11
+ while (offset < repeated.length) {
12
+ offset += copy(source, repeated, offset);
13
+ }
14
+ return repeated;
15
+ }
16
+ __name(repeat, "repeat");
17
+
18
+ export { repeat };
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ function startsWith(source, prefix) {
8
+ if (prefix.length > source.length) {
9
+ return false;
10
+ }
11
+ for (let i = 0; i < prefix.length; i++) {
12
+ if (source[i] !== prefix[i]) return false;
13
+ }
14
+ return true;
15
+ }
16
+ __name(startsWith, "startsWith");
17
+
18
+ exports.startsWith = startsWith;
@@ -0,0 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ function startsWith(source, prefix) {
4
+ if (prefix.length > source.length) {
5
+ return false;
6
+ }
7
+ for (let i = 0; i < prefix.length; i++) {
8
+ if (source[i] !== prefix[i]) return false;
9
+ }
10
+ return true;
11
+ }
12
+ __name(startsWith, "startsWith");
13
+
14
+ export { startsWith };
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@visulima/bytes",
3
+ "version": "1.0.0",
4
+ "description": "Utility functions to make dealing with Uint8Arrays easier",
5
+ "keywords": [
6
+ "visulima",
7
+ "bytes"
8
+ ],
9
+ "homepage": "https://visulima.com/packages/bytes",
10
+ "bugs": {
11
+ "url": "https://github.com/visulima/visulima/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/visulima/visulima.git",
16
+ "directory": "packages/bytes"
17
+ },
18
+ "funding": [
19
+ {
20
+ "type": "github",
21
+ "url": "https://github.com/sponsors/prisis"
22
+ },
23
+ {
24
+ "type": "consulting",
25
+ "url": "https://anolilab.com/support"
26
+ }
27
+ ],
28
+ "license": "MIT",
29
+ "author": {
30
+ "name": "Daniel Bannert",
31
+ "email": "d.bannert@anolilab.de"
32
+ },
33
+ "sideEffects": false,
34
+ "type": "module",
35
+ "exports": {
36
+ ".": {
37
+ "require": {
38
+ "types": "./dist/index.d.cts",
39
+ "default": "./dist/index.cjs"
40
+ },
41
+ "import": {
42
+ "types": "./dist/index.d.mts",
43
+ "default": "./dist/index.mjs"
44
+ }
45
+ },
46
+ "./package.json": "./package.json"
47
+ },
48
+ "main": "dist/index.cjs",
49
+ "module": "dist/index.mjs",
50
+ "browser": "./dist/index.mjs",
51
+ "types": "dist/index.d.ts",
52
+ "typesVersions": {
53
+ ">=5.0": {
54
+ ".": [
55
+ "./dist/index.d.ts"
56
+ ]
57
+ }
58
+ },
59
+ "files": [
60
+ "dist",
61
+ "README.md",
62
+ "CHANGELOG.md"
63
+ ],
64
+ "engines": {
65
+ "node": ">=20.18 <=24.x"
66
+ },
67
+ "publishConfig": {
68
+ "access": "public",
69
+ "provenance": true
70
+ }
71
+ }