@vercel/stega 0.0.2 → 0.0.3

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.
@@ -6,7 +6,7 @@ const REVERSE_HEX_DIGIT_MAP = Object.fromEntries(Object.entries(map_1.HEX_DIGIT_
6
6
  const HEX_CHARS = `${Object.values(map_1.HEX_DIGIT_MAP)
7
7
  .map((x) => `\\u{${x.toString(16)}}`)
8
8
  .join('')}`;
9
- exports.VERCEL_STEGA_REGEX = new RegExp(`(?:[${HEX_CHARS}]{2})+`, 'u');
9
+ exports.VERCEL_STEGA_REGEX = new RegExp(`(?:[${HEX_CHARS}]{2})+`, 'gu');
10
10
  /**
11
11
  * Decodes a hidden string back into its original value
12
12
  * @param encoded - The encoded (hidden) string
package/dist/cjs/index.js CHANGED
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./encode"), exports);
18
18
  __exportStar(require("./decode"), exports);
19
+ __exportStar(require("./util"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.vercelStegaSplit = void 0;
4
+ const decode_1 = require("./decode");
5
+ /**
6
+ * Splits out encoded data from a string, if any is found
7
+ * @param original - The original string
8
+ * @returns The cleaned string and encoded data, separately
9
+ */
10
+ function vercelStegaSplit(original) {
11
+ var _a;
12
+ return {
13
+ cleaned: original.replace(decode_1.VERCEL_STEGA_REGEX, ''),
14
+ encoded: ((_a = original.match(decode_1.VERCEL_STEGA_REGEX)) === null || _a === void 0 ? void 0 : _a[0]) || '',
15
+ };
16
+ }
17
+ exports.vercelStegaSplit = vercelStegaSplit;
@@ -3,7 +3,7 @@ const REVERSE_HEX_DIGIT_MAP = Object.fromEntries(Object.entries(HEX_DIGIT_MAP).m
3
3
  const HEX_CHARS = `${Object.values(HEX_DIGIT_MAP)
4
4
  .map((x) => `\\u{${x.toString(16)}}`)
5
5
  .join('')}`;
6
- export const VERCEL_STEGA_REGEX = new RegExp(`(?:[${HEX_CHARS}]{2})+`, 'u');
6
+ export const VERCEL_STEGA_REGEX = new RegExp(`(?:[${HEX_CHARS}]{2})+`, 'gu');
7
7
  /**
8
8
  * Decodes a hidden string back into its original value
9
9
  * @param encoded - The encoded (hidden) string
package/dist/esm/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './encode';
2
2
  export * from './decode';
3
+ export * from './util';
@@ -0,0 +1,13 @@
1
+ import { VERCEL_STEGA_REGEX } from './decode';
2
+ /**
3
+ * Splits out encoded data from a string, if any is found
4
+ * @param original - The original string
5
+ * @returns The cleaned string and encoded data, separately
6
+ */
7
+ export function vercelStegaSplit(original) {
8
+ var _a;
9
+ return {
10
+ cleaned: original.replace(VERCEL_STEGA_REGEX, ''),
11
+ encoded: ((_a = original.match(VERCEL_STEGA_REGEX)) === null || _a === void 0 ? void 0 : _a[0]) || '',
12
+ };
13
+ }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './encode';
2
2
  export * from './decode';
3
+ export * from './util';
package/dist/util.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Separated clean string and encoded string
3
+ */
4
+ interface SplitResult {
5
+ /** The original string with encoded substring removed */
6
+ cleaned: string;
7
+ /** The encoded substring from the original string */
8
+ encoded: string;
9
+ }
10
+ /**
11
+ * Splits out encoded data from a string, if any is found
12
+ * @param original - The original string
13
+ * @returns The cleaned string and encoded data, separately
14
+ */
15
+ export declare function vercelStegaSplit(original: string): SplitResult;
16
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/stega",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Utilities for steganography",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -10,18 +10,22 @@
10
10
  "dist"
11
11
  ],
12
12
  "license": "MPL-2.0",
13
- "scripts": {
14
- "dev": "npm run build",
15
- "build": "npm run build:types && npm run build:esm && npm run build:cjs",
16
- "build:esm": "tsc --module es2020 --outDir dist/esm",
17
- "build:cjs": "tsc --module commonjs --outDir dist/cjs",
18
- "build:types": "tsc --declaration --emitDeclarationOnly",
19
- "test": "jest"
20
- },
21
13
  "devDependencies": {
22
14
  "@jest/globals": "^28.1.3",
23
15
  "jest": "^28.1.3",
24
16
  "ts-jest": "^28.0.3",
25
17
  "typescript": "^4.6.3"
18
+ },
19
+ "access": "public",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "dev": "pnpm build",
25
+ "build": "pnpm build:types && pnpm build:esm && pnpm build:cjs",
26
+ "build:esm": "tsc --module es2020 --outDir dist/esm",
27
+ "build:cjs": "tsc --module commonjs --outDir dist/cjs",
28
+ "build:types": "tsc --declaration --emitDeclarationOnly",
29
+ "test": "jest"
26
30
  }
27
- }
31
+ }