@sectui/operations 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/args.d.ts +8 -0
- package/dist/args.js +47 -0
- package/dist/args.js.map +1 -0
- package/dist/cli-flags.d.ts +7 -0
- package/dist/cli-flags.js +28 -0
- package/dist/cli-flags.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +185 -0
- package/dist/cli.js.map +1 -0
- package/dist/completions.d.ts +3 -0
- package/dist/completions.js +113 -0
- package/dist/completions.js.map +1 -0
- package/dist/display.d.ts +4 -0
- package/dist/display.js +29 -0
- package/dist/display.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +7 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/operation.d.ts +64 -0
- package/dist/operation.js +5 -0
- package/dist/operation.js.map +1 -0
- package/dist/operations/base/alphabets.d.ts +28 -0
- package/dist/operations/base/alphabets.js +27 -0
- package/dist/operations/base/alphabets.js.map +1 -0
- package/dist/operations/base/base32.d.ts +33 -0
- package/dist/operations/base/base32.js +85 -0
- package/dist/operations/base/base32.js.map +1 -0
- package/dist/operations/base/base58.d.ts +34 -0
- package/dist/operations/base/base58.js +43 -0
- package/dist/operations/base/base58.js.map +1 -0
- package/dist/operations/base/base62.d.ts +28 -0
- package/dist/operations/base/base62.js +43 -0
- package/dist/operations/base/base62.js.map +1 -0
- package/dist/operations/base/base64.d.ts +19 -0
- package/dist/operations/base/base64.js +72 -0
- package/dist/operations/base/base64.js.map +1 -0
- package/dist/operations/base/base64url.d.ts +15 -0
- package/dist/operations/base/base64url.js +44 -0
- package/dist/operations/base/base64url.js.map +1 -0
- package/dist/operations/base/big-number.d.ts +6 -0
- package/dist/operations/base/big-number.js +54 -0
- package/dist/operations/base/big-number.js.map +1 -0
- package/dist/operations/color/hex-to-rgb.d.ts +14 -0
- package/dist/operations/color/hex-to-rgb.js +41 -0
- package/dist/operations/color/hex-to-rgb.js.map +1 -0
- package/dist/operations/data/json-format.d.ts +20 -0
- package/dist/operations/data/json-format.js +33 -0
- package/dist/operations/data/json-format.js.map +1 -0
- package/dist/operations/data/json.d.ts +20 -0
- package/dist/operations/data/json.js +59 -0
- package/dist/operations/data/json.js.map +1 -0
- package/dist/operations/data/yaml.d.ts +21 -0
- package/dist/operations/data/yaml.js +54 -0
- package/dist/operations/data/yaml.js.map +1 -0
- package/dist/operations/extract/extract.d.ts +55 -0
- package/dist/operations/extract/extract.js +129 -0
- package/dist/operations/extract/extract.js.map +1 -0
- package/dist/operations/hash/bcrypt.d.ts +16 -0
- package/dist/operations/hash/bcrypt.js +45 -0
- package/dist/operations/hash/bcrypt.js.map +1 -0
- package/dist/operations/hash/hashes.d.ts +10 -0
- package/dist/operations/hash/hashes.js +29 -0
- package/dist/operations/hash/hashes.js.map +1 -0
- package/dist/operations/hex/from-hex.d.ts +1 -0
- package/dist/operations/hex/from-hex.js +31 -0
- package/dist/operations/hex/from-hex.js.map +1 -0
- package/dist/operations/hex/to-hex.d.ts +31 -0
- package/dist/operations/hex/to-hex.js +44 -0
- package/dist/operations/hex/to-hex.js.map +1 -0
- package/dist/operations/html/entities.d.ts +2 -0
- package/dist/operations/html/entities.js +69 -0
- package/dist/operations/html/entities.js.map +1 -0
- package/dist/operations/html/html-decode.d.ts +1 -0
- package/dist/operations/html/html-decode.js +36 -0
- package/dist/operations/html/html-decode.js.map +1 -0
- package/dist/operations/html/html-encode.d.ts +8 -0
- package/dist/operations/html/html-encode.js +30 -0
- package/dist/operations/html/html-encode.js.map +1 -0
- package/dist/operations/text/case.d.ts +14 -0
- package/dist/operations/text/case.js +85 -0
- package/dist/operations/text/case.js.map +1 -0
- package/dist/operations/text/count.d.ts +19 -0
- package/dist/operations/text/count.js +59 -0
- package/dist/operations/text/count.js.map +1 -0
- package/dist/operations/text/line-operations.d.ts +48 -0
- package/dist/operations/text/line-operations.js +134 -0
- package/dist/operations/text/line-operations.js.map +1 -0
- package/dist/operations/text/lines.d.ts +13 -0
- package/dist/operations/text/lines.js +22 -0
- package/dist/operations/text/lines.js.map +1 -0
- package/dist/operations/text/text-operations.d.ts +37 -0
- package/dist/operations/text/text-operations.js +79 -0
- package/dist/operations/text/text-operations.js.map +1 -0
- package/dist/operations/url/url-decode.d.ts +8 -0
- package/dist/operations/url/url-decode.js +56 -0
- package/dist/operations/url/url-decode.js.map +1 -0
- package/dist/operations/url/url-encode.d.ts +8 -0
- package/dist/operations/url/url-encode.js +37 -0
- package/dist/operations/url/url-encode.js.map +1 -0
- package/dist/registry.d.ts +395 -0
- package/dist/registry.js +131 -0
- package/dist/registry.js.map +1 -0
- package/dist/template.d.ts +23 -0
- package/dist/template.js +198 -0
- package/dist/template.js.map +1 -0
- package/package.json +67 -4
- package/src/args.ts +47 -0
- package/src/cli-flags.ts +29 -0
- package/src/cli.ts +189 -0
- package/src/completions.ts +129 -0
- package/src/display.ts +29 -0
- package/src/errors.ts +6 -0
- package/src/index.ts +4 -0
- package/src/operation.ts +62 -0
- package/src/operations/base/alphabets.ts +33 -0
- package/src/operations/base/base32.ts +84 -0
- package/src/operations/base/base58.ts +45 -0
- package/src/operations/base/base62.ts +44 -0
- package/src/operations/base/base64.ts +76 -0
- package/src/operations/base/base64url.ts +45 -0
- package/src/operations/base/big-number.ts +54 -0
- package/src/operations/color/hex-to-rgb.ts +42 -0
- package/src/operations/data/json-format.ts +33 -0
- package/src/operations/data/json.ts +53 -0
- package/src/operations/data/yaml.ts +56 -0
- package/src/operations/extract/extract.ts +135 -0
- package/src/operations/hash/bcrypt.ts +44 -0
- package/src/operations/hash/hashes.ts +64 -0
- package/src/operations/hex/from-hex.ts +31 -0
- package/src/operations/hex/to-hex.ts +46 -0
- package/src/operations/html/entities.ts +71 -0
- package/src/operations/html/html-decode.ts +36 -0
- package/src/operations/html/html-encode.ts +31 -0
- package/src/operations/text/case.ts +140 -0
- package/src/operations/text/count.ts +61 -0
- package/src/operations/text/line-operations.ts +144 -0
- package/src/operations/text/lines.ts +22 -0
- package/src/operations/text/text-operations.ts +85 -0
- package/src/operations/url/url-decode.ts +55 -0
- package/src/operations/url/url-encode.ts +38 -0
- package/src/registry.ts +152 -0
- package/src/template.ts +214 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { defineOperation } from "../../operation.js";
|
|
3
|
+
function defineHash(id, name, algorithm, infoUrl, hello) {
|
|
4
|
+
return defineOperation({
|
|
5
|
+
id,
|
|
6
|
+
name,
|
|
7
|
+
description: `Computes the ${name} digest of the input, as lowercase hex.`,
|
|
8
|
+
category: "Hashing",
|
|
9
|
+
output: "text",
|
|
10
|
+
aliases: [`${id}sum`, name],
|
|
11
|
+
infoUrl,
|
|
12
|
+
args: {},
|
|
13
|
+
examples: [{ input: "hello", output: hello }],
|
|
14
|
+
run: (input) => new TextEncoder().encode(createHash(algorithm).update(input).digest("hex")),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const SHA2 = "https://wikipedia.org/wiki/SHA-2";
|
|
18
|
+
const SHA3 = "https://wikipedia.org/wiki/SHA-3";
|
|
19
|
+
export const md5 = defineHash("md5", "MD5", "md5", "https://wikipedia.org/wiki/MD5", "5d41402abc4b2a76b9719d911017c592");
|
|
20
|
+
export const sha1 = defineHash("sha1", "SHA-1", "sha1", "https://wikipedia.org/wiki/SHA-1", "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d");
|
|
21
|
+
export const sha224 = defineHash("sha224", "SHA-224", "sha224", SHA2, "ea09ae9cc6768c50fcee903ed054556e5bfc8347907f12598aa24193");
|
|
22
|
+
export const sha256 = defineHash("sha256", "SHA-256", "sha256", SHA2, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824");
|
|
23
|
+
export const sha384 = defineHash("sha384", "SHA-384", "sha384", SHA2, "59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553bcdb9c666fa90125a3c79f90397bdf5f6a13de828684f");
|
|
24
|
+
export const sha512 = defineHash("sha512", "SHA-512", "sha512", SHA2, "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043");
|
|
25
|
+
export const sha3_224 = defineHash("sha3-224", "SHA3-224", "sha3-224", SHA3, "b87f88c72702fff1748e58b87e9141a42c0dbedc29a78cb0d4a5cd81");
|
|
26
|
+
export const sha3_256 = defineHash("sha3-256", "SHA3-256", "sha3-256", SHA3, "3338be694f50c5f338814986cdf0686453a888b84f424d792af4b9202398f392");
|
|
27
|
+
export const sha3_384 = defineHash("sha3-384", "SHA3-384", "sha3-384", SHA3, "720aea11019ef06440fbf05d87aa24680a2153df3907b23631e7177ce620fa1330ff07c0fddee54699a4c3ee0ee9d887");
|
|
28
|
+
export const sha3_512 = defineHash("sha3-512", "SHA3-512", "sha3-512", SHA3, "75d527c368f2efe848ecf6b073a36767800805e9eef2b1857d5f984f036eb6df891d75f72d9b154518c1cd58835286d1da9a38deba3de98b5a53e5ed78a84976");
|
|
29
|
+
//# sourceMappingURL=hashes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../../src/operations/hash/hashes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD,SAAS,UAAU,CAA0B,EAAM,EAAE,IAAY,EAAE,SAAoB,EAAE,OAAe,EAAE,KAAa;IACrH,OAAO,eAAe,CAAC;QACrB,EAAE;QACF,IAAI;QACJ,WAAW,EAAE,gBAAgB,IAAI,yCAAyC;QAC1E,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,MAAM;QACd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U,EAAE,UAAU,EAAE,IAAI,EAAE,0DAA0D,CAAC,CAAC;AACzI,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,UAAU,EACV,UAAU,EACV,UAAU,EACV,IAAI,EACJ,kEAAkE,CACnE,CAAC;AACF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,UAAU,EACV,UAAU,EACV,UAAU,EACV,IAAI,EACJ,kGAAkG,CACnG,CAAC;AACF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,UAAU,EACV,UAAU,EACV,UAAU,EACV,IAAI,EACJ,kIAAkI,CACnI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fromHex: import("../../operation.ts").Operation<"from-hex", {}, "to-hex">;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OperationError } from "../../errors.js";
|
|
2
|
+
import { defineOperation } from "../../operation.js";
|
|
3
|
+
// "0x" and "\x" prefixes, whitespace and common separators.
|
|
4
|
+
const IGNORED = /0x|\\x|[\s:,;.%-]/gi;
|
|
5
|
+
export const fromHex = defineOperation({
|
|
6
|
+
id: "from-hex",
|
|
7
|
+
name: "From Hex",
|
|
8
|
+
description: 'Decodes hexadecimal text into raw bytes, ignoring case, whitespace, separators (: , ; . % -) and 0x or \\x prefixes. e.g. "68656c6c6f" becomes "hello".',
|
|
9
|
+
category: "Encoding",
|
|
10
|
+
output: "binary",
|
|
11
|
+
aliases: ["hex decode", "base16", "unhex", "xxd -r"],
|
|
12
|
+
inverse: "to-hex",
|
|
13
|
+
infoUrl: "https://wikipedia.org/wiki/Hexadecimal",
|
|
14
|
+
args: {},
|
|
15
|
+
examples: [
|
|
16
|
+
{ input: "68656c6c6f", output: "hello" },
|
|
17
|
+
{ input: "68:65:6C:6C:6F", output: "hello" },
|
|
18
|
+
{ input: "0x68, 0x69", output: "hi" },
|
|
19
|
+
{ input: "\\x68\\x69", output: "hi" },
|
|
20
|
+
],
|
|
21
|
+
run(input) {
|
|
22
|
+
const hex = new TextDecoder().decode(input).replace(IGNORED, "");
|
|
23
|
+
const bad = /[^0-9a-f]/i.exec(hex);
|
|
24
|
+
if (bad)
|
|
25
|
+
throw new OperationError(`Invalid hex: unexpected character "${bad[0]}"`);
|
|
26
|
+
if (hex.length % 2)
|
|
27
|
+
throw new OperationError("Invalid hex: odd number of digits");
|
|
28
|
+
return Uint8Array.fromHex(hex);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=from-hex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"from-hex.js","sourceRoot":"","sources":["../../../src/operations/hex/from-hex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,4DAA4D;AAC5D,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAEtC,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;IACrC,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,yJAAyJ;IAC3J,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC;IACpD,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,wCAAwC;IACjD,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE;QACR,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE;QACxC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE;QAC5C,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE;QACrC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE;KACtC;IACD,GAAG,CAAC,KAAK;QACP,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACjE,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,GAAG;YAAE,MAAM,IAAI,cAAc,CAAC,sCAAsC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACnF,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,cAAc,CAAC,mCAAmC,CAAC,CAAC;QAClF,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const toHex: import("../../operation.ts").Operation<"to-hex", {
|
|
2
|
+
readonly delimiter: {
|
|
3
|
+
readonly type: "select";
|
|
4
|
+
readonly name: "Delimiter";
|
|
5
|
+
readonly options: readonly [{
|
|
6
|
+
readonly value: "none";
|
|
7
|
+
readonly label: "None: 68656c6c6f";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "space";
|
|
10
|
+
readonly label: "Space: 68 65 6c 6c 6f";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "colon";
|
|
13
|
+
readonly label: "Colon: 68:65:6c:6c:6f";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "comma";
|
|
16
|
+
readonly label: "Comma: 68,65,6c,6c,6f";
|
|
17
|
+
}, {
|
|
18
|
+
readonly value: "escape";
|
|
19
|
+
readonly label: "Escape sequences: \\x68\\x65\\x6c\\x6c\\x6f";
|
|
20
|
+
}, {
|
|
21
|
+
readonly value: "0x";
|
|
22
|
+
readonly label: "C array: 0x68, 0x65, 0x6c, 0x6c, 0x6f";
|
|
23
|
+
}];
|
|
24
|
+
readonly default: "none";
|
|
25
|
+
};
|
|
26
|
+
readonly uppercase: {
|
|
27
|
+
readonly type: "boolean";
|
|
28
|
+
readonly name: "Uppercase";
|
|
29
|
+
readonly default: false;
|
|
30
|
+
};
|
|
31
|
+
}, "from-hex">;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineOperation } from "../../operation.js";
|
|
2
|
+
const DELIMITERS = [
|
|
3
|
+
{ value: "none", label: "None: 68656c6c6f" },
|
|
4
|
+
{ value: "space", label: "Space: 68 65 6c 6c 6f" },
|
|
5
|
+
{ value: "colon", label: "Colon: 68:65:6c:6c:6f" },
|
|
6
|
+
{ value: "comma", label: "Comma: 68,65,6c,6c,6f" },
|
|
7
|
+
{ value: "escape", label: "Escape sequences: \\x68\\x65\\x6c\\x6c\\x6f" },
|
|
8
|
+
{ value: "0x", label: "C array: 0x68, 0x65, 0x6c, 0x6c, 0x6f" },
|
|
9
|
+
];
|
|
10
|
+
const FORMATS = {
|
|
11
|
+
none: { prefix: "", separator: "" },
|
|
12
|
+
space: { prefix: "", separator: " " },
|
|
13
|
+
colon: { prefix: "", separator: ":" },
|
|
14
|
+
comma: { prefix: "", separator: "," },
|
|
15
|
+
escape: { prefix: "\\x", separator: "" },
|
|
16
|
+
"0x": { prefix: "0x", separator: ", " },
|
|
17
|
+
};
|
|
18
|
+
export const toHex = defineOperation({
|
|
19
|
+
id: "to-hex",
|
|
20
|
+
name: "To Hex",
|
|
21
|
+
description: 'Encodes raw bytes as hexadecimal text. e.g. "hello" becomes "68656c6c6f".',
|
|
22
|
+
category: "Encoding",
|
|
23
|
+
output: "text",
|
|
24
|
+
aliases: ["hex encode", "base16", "xxd"],
|
|
25
|
+
inverse: "from-hex",
|
|
26
|
+
infoUrl: "https://wikipedia.org/wiki/Hexadecimal",
|
|
27
|
+
args: {
|
|
28
|
+
delimiter: { type: "select", name: "Delimiter", options: DELIMITERS, default: "none" },
|
|
29
|
+
uppercase: { type: "boolean", name: "Uppercase", default: false },
|
|
30
|
+
},
|
|
31
|
+
examples: [
|
|
32
|
+
{ input: "hello", output: "68656c6c6f" },
|
|
33
|
+
{ input: "hello", args: { delimiter: "colon", uppercase: true }, output: "68:65:6C:6C:6F" },
|
|
34
|
+
{ input: "hi", args: { delimiter: "escape" }, output: "\\x68\\x69" },
|
|
35
|
+
],
|
|
36
|
+
run(input, { delimiter, uppercase }) {
|
|
37
|
+
const { prefix, separator } = FORMATS[delimiter];
|
|
38
|
+
const hex = input.toHex();
|
|
39
|
+
const digits = uppercase ? hex.toUpperCase() : hex;
|
|
40
|
+
const bytes = digits.match(/../g) ?? [];
|
|
41
|
+
return new TextEncoder().encode(bytes.map((byte) => prefix + byte).join(separator));
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=to-hex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-hex.js","sourceRoot":"","sources":["../../../src/operations/hex/to-hex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,UAAU,GAAG;IACjB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,EAAE;IAC5C,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE;IAClD,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE;IAClD,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE;IAClD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,6CAA6C,EAAE;IACzE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,uCAAuC,EAAE;CACvD,CAAC;AAEX,MAAM,OAAO,GAAwF;IACnG,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACnC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE;IACrC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE;IACrC,KAAK,EA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AK,CAAC,KAAK,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QACnD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACxC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACtF,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// HTML 4 entities for U+00A0 to U+00FF, in code point order.
|
|
2
|
+
const LATIN1 = "nbsp iexcl cent pound curren yen brvbar sect uml copy ordf laquo not shy reg macr deg plusmn sup2 sup3 acute " +
|
|
3
|
+
"micro para middot cedil sup1 ordm raquo frac14 frac12 frac34 iquest Agrave Aacute Acirc Atilde Auml Aring AElig " +
|
|
4
|
+
"Ccedil Egrave Eacute Ecirc Euml Igrave Iacute Icirc Iuml ETH Ntilde Ograve Oacute Ocirc Otilde Ouml times Oslash " +
|
|
5
|
+
"Ugrave Uacute Ucirc Uuml Yacute THORN szlig agrave aacute acirc atilde auml aring aelig ccedil egrave eacute " +
|
|
6
|
+
"ecirc euml igrave iacute icirc iuml eth ntilde ograve oacute ocirc otilde ouml divide oslash ugrave uacute ucirc " +
|
|
7
|
+
"uuml yacute thorn yuml";
|
|
8
|
+
const OTHERS = {
|
|
9
|
+
quot: 0x22,
|
|
10
|
+
amp: 0x26,
|
|
11
|
+
apos: 0x27,
|
|
12
|
+
lt: 0x3c,
|
|
13
|
+
gt: 0x3e,
|
|
14
|
+
OElig: 0x152,
|
|
15
|
+
oelig: 0x153,
|
|
16
|
+
Scaron: 0x160,
|
|
17
|
+
scaron: 0x161,
|
|
18
|
+
Yuml: 0x178,
|
|
19
|
+
fnof: 0x192,
|
|
20
|
+
circ: 0x2c6,
|
|
21
|
+
tilde: 0x2dc,
|
|
22
|
+
ensp: 0x2002,
|
|
23
|
+
emsp: 0x2003,
|
|
24
|
+
thinsp: 0x2009,
|
|
25
|
+
zwnj: 0x200c,
|
|
26
|
+
zwj: 0x200d,
|
|
27
|
+
lrm: 0x200e,
|
|
28
|
+
rlm: 0x200f,
|
|
29
|
+
ndash: 0x2013,
|
|
30
|
+
mdash: 0x2014,
|
|
31
|
+
lsquo: 0x2018,
|
|
32
|
+
rsquo: 0x2019,
|
|
33
|
+
sbquo: 0x201a,
|
|
34
|
+
ldquo: 0x201c,
|
|
35
|
+
rdquo: 0x201d,
|
|
36
|
+
bdquo: 0x201e,
|
|
37
|
+
dagger: 0x2020,
|
|
38
|
+
Dagger: 0x2021,
|
|
39
|
+
bull: 0x2022,
|
|
40
|
+
hellip: 0x2026,
|
|
41
|
+
permil: 0x2030,
|
|
42
|
+
prime: 0x2032,
|
|
43
|
+
Prime: 0x2033,
|
|
44
|
+
lsaquo: 0x2039,
|
|
45
|
+
rsaquo: 0x203a,
|
|
46
|
+
oline: 0x203e,
|
|
47
|
+
euro: 0x20ac,
|
|
48
|
+
trade: 0x2122,
|
|
49
|
+
larr: 0x2190,
|
|
50
|
+
uarr: 0x2191,
|
|
51
|
+
rarr: 0x2192,
|
|
52
|
+
darr: 0x2193,
|
|
53
|
+
harr: 0x2194,
|
|
54
|
+
minus: 0x2212,
|
|
55
|
+
infin: 0x221e,
|
|
56
|
+
ne: 0x2260,
|
|
57
|
+
le: 0x2264,
|
|
58
|
+
ge: 0x2265,
|
|
59
|
+
spades: 0x2660,
|
|
60
|
+
clubs: 0x2663,
|
|
61
|
+
hearts: 0x2665,
|
|
62
|
+
diams: 0x2666,
|
|
63
|
+
};
|
|
64
|
+
/** Named character references supported by `html-decode`: HTML 4 entities and `'`. */
|
|
65
|
+
export const NAMED_ENTITIES = new Map([
|
|
66
|
+
...LATIN1.split(" ").map((name, i) => [name, 0xa0 + i]),
|
|
67
|
+
...Object.entries(OTHERS),
|
|
68
|
+
]);
|
|
69
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/operations/html/entities.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,GACV,+GAA+G;IAC/G,kHAAkH;IAClH,mHAAmH;IACnH,+GAA+G;IAC/G,mHAAmH;IACnH,wBAAwB,CAAC;AAE3B,MAAM,MAAM,GAA2B;IACrC,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,IAAI;IACV,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;CACd,CAAC;AAEF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAiB;IACpD,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAU,CAAC;IAChE,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;CAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const htmlDecode: import("../../operation.ts").Operation<"html-decode", {}, "html-encode">;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineOperation } from "../../operation.js";
|
|
2
|
+
import { NAMED_ENTITIES } from "./entities.js";
|
|
3
|
+
const ENTITY = /&(?:#(\d+)|#x([0-9a-f]+)|([a-z][a-z0-9]*));/gi;
|
|
4
|
+
function fromCodePoint(code) {
|
|
5
|
+
// NUL, surrogates and out of range values are replaced, as browsers do.
|
|
6
|
+
if (code === 0 || code > 0x10ffff || (code >= 0xd800 && code <= 0xdfff))
|
|
7
|
+
return "�";
|
|
8
|
+
return String.fromCodePoint(code);
|
|
9
|
+
}
|
|
10
|
+
export const htmlDecode = defineOperation({
|
|
11
|
+
id: "html-decode",
|
|
12
|
+
name: "HTML Decode",
|
|
13
|
+
description: 'Decodes HTML entities: numeric (é é) and named HTML 4 ones (é & ...). Unknown entities are left as is. e.g. "<b>" becomes "<b>".',
|
|
14
|
+
category: "Encoding",
|
|
15
|
+
output: "binary",
|
|
16
|
+
aliases: ["html unescape", "html entities"],
|
|
17
|
+
inverse: "html-encode",
|
|
18
|
+
infoUrl: "https://wikipedia.org/wiki/Character_encodings_in_HTML",
|
|
19
|
+
args: {},
|
|
20
|
+
examples: [
|
|
21
|
+
{ input: "<a href="x">Tom & Jerry</a>", output: '<a href="x">Tom & Jerry</a>' },
|
|
22
|
+
{ input: "café € ☺ &unknown;", output: "café € ☺ &unknown;" },
|
|
23
|
+
],
|
|
24
|
+
run(input) {
|
|
25
|
+
const text = new TextDecoder().decode(input).replace(ENTITY, (entity, dec, hex, name) => {
|
|
26
|
+
if (dec)
|
|
27
|
+
return fromCodePoint(Number(dec));
|
|
28
|
+
if (hex)
|
|
29
|
+
return fromCodePoint(parseInt(hex, 16));
|
|
30
|
+
const code = NAMED_ENTITIES.get(name);
|
|
31
|
+
return code === undefined ? entity : String.fromCodePoint(code);
|
|
32
|
+
});
|
|
33
|
+
return new TextEncoder().encode(text);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=html-decode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-decode.js","sourceRoot":"","sources":["../../../src/operations/html/html-decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,MAAM,GAAG,+CAA+C,CAAC;AAE/D,SAAS,aAAa,CAAC,IAAY;IACjC,wEAAwE;IACxE,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,GAAG,QAAQ,IAAI,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;QAAE,OAAO,GAAG,CAAC;IACpF,OAAO,MAAM,CAAC,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2
|
+
readonly encodeNonAscii: {
|
|
3
|
+
readonly type: "boolean";
|
|
4
|
+
readonly name: "Encode non-ASCII characters";
|
|
5
|
+
readonly description: "Also write characters outside ASCII as numeric entities, e.g. é as é.";
|
|
6
|
+
readonly default: false;
|
|
7
|
+
};
|
|
8
|
+
}, "html-decode">;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineOperation } from "../../operation.js";
|
|
2
|
+
const SPECIAL = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
3
|
+
export const htmlEncode = defineOperation({
|
|
4
|
+
id: "html-encode",
|
|
5
|
+
name: "HTML Encode",
|
|
6
|
+
description: 'Escapes & < > " and \' as HTML entities. e.g. "<b>" becomes "<b>".',
|
|
7
|
+
category: "Encoding",
|
|
8
|
+
output: "binary",
|
|
9
|
+
aliases: ["html escape", "html entities"],
|
|
10
|
+
inverse: "html-decode",
|
|
11
|
+
infoUrl: "https://wikipedia.org/wiki/Character_encodings_in_HTML",
|
|
12
|
+
args: {
|
|
13
|
+
encodeNonAscii: {
|
|
14
|
+
type: "boolean",
|
|
15
|
+
name: "Encode non-ASCII characters",
|
|
16
|
+
description: "Also write characters outside ASCII as numeric entities, e.g. é as é.",
|
|
17
|
+
default: false,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
examples: [
|
|
21
|
+
{ input: '<a href="x">Tom & Jerry</a>', output: "<a href="x">Tom & Jerry</a>" },
|
|
22
|
+
{ input: "café €", args: { encodeNonAscii: true }, output: "café €" },
|
|
23
|
+
],
|
|
24
|
+
run(input, { encodeNonAscii }) {
|
|
25
|
+
const pattern = encodeNonAscii ? /[&<>"']|[^\x00-\x7f]/gu : /[&<>"']/g;
|
|
26
|
+
const text = new TextDecoder().decode(input).replace(pattern, (ch) => SPECIAL[ch] ?? `&#${ch.codePointAt(0)};`);
|
|
27
|
+
return new TextEncoder().encode(text);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=html-encode.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AAI,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAChH,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const toCamelCase: import("../../operation.ts").Operation<"to-camel-case", {}, never>;
|
|
2
|
+
export declare const toPascalCase: import("../../operation.ts").Operation<"to-pascal-case", {}, never>;
|
|
3
|
+
export declare const toSnakeCase: import("../../operation.ts").Operation<"to-snake-case", {}, never>;
|
|
4
|
+
export declare const toKebabCase: import("../../operation.ts").Operation<"to-kebab-case", {}, never>;
|
|
5
|
+
export declare const toSlug: import("../../operation.ts").Operation<"to-slug", {
|
|
6
|
+
readonly separator: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly name: "Separator";
|
|
9
|
+
readonly default: "-";
|
|
10
|
+
};
|
|
11
|
+
}, never>;
|
|
12
|
+
export declare const toTitleCase: import("../../operation.ts").Operation<"to-title-case", {}, never>;
|
|
13
|
+
export declare const toUpperCase: import("../../operation.ts").Operation<"to-upper-case", {}, never>;
|
|
14
|
+
export declare const toLowerCase: import("../../operation.ts").Operation<"to-lower-case", {}, never>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { defineOperation } from "../../operation.js";
|
|
2
|
+
import { mapLines, mapText } from "./lines.js";
|
|
3
|
+
// Words of an identifier or a sentence: "XMLHttpRequest v2" -> XML, Http, Request, v, 2.
|
|
4
|
+
const WORD = /\p{Lu}+(?=\p{Lu}\p{Ll})|\p{Lu}?[\p{Ll}\p{Lo}\p{M}]+|\p{Lu}+\p{M}*|\p{Lt}[\p{Ll}\p{M}]*|\p{N}+/gu;
|
|
5
|
+
function words(line) {
|
|
6
|
+
return line.replace(/['’]/g, "").match(WORD) ?? [];
|
|
7
|
+
}
|
|
8
|
+
const capitalize = (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
9
|
+
/** Defines an operation that rebuilds each line from its words. */
|
|
10
|
+
function defineCaseOperation(id, name, description, aliases, join, example) {
|
|
11
|
+
return defineOperation({
|
|
12
|
+
id,
|
|
13
|
+
name,
|
|
14
|
+
description: `${description} Each line is converted separately.`,
|
|
15
|
+
category: "Text",
|
|
16
|
+
output: "binary",
|
|
17
|
+
aliases,
|
|
18
|
+
args: {},
|
|
19
|
+
examples: [example],
|
|
20
|
+
run: (input) => mapText(input, (text) => mapLines(text, (lines) => lines.map((line) => join(words(line))))),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export const toCamelCase = defineCaseOperation("to-camel-case", "To camelCase", 'Joins the words with the first one in lowercase and the others capitalized. e.g. "hello world" becomes "helloWorld".', ["camelcase", "lower camel case"], (words) => words.map((word, i) => (i ? capitalize(word) : word.toLowerCase())).join(""), { input: "Hello big_world\nXMLHttpRequest", output: "helloBigWorld\nxmlHttpRequest" });
|
|
24
|
+
export const toPascalCase = defineCaseOperation("to-pascal-case", "To PascalCase", 'Joins the capitalized words. e.g. "hello world" becomes "HelloWorld".', ["pascalcase", "upper camel case"], (words) => words.map(capitalize).join(""), { input: "hello big_world", output: "HelloBigWorld" });
|
|
25
|
+
export const toSnakeCase = defineCaseOperation("to-snake-case", "To snake_case", 'Joins the lowercase words with underscores. e.g. "helloWorld" becomes "hello_world".', ["snakecase", "underscore"], (words) => words.map((word) => word.toLowerCase()).join("_"), { input: "Hello bigWorld", output: "hello_big_world" });
|
|
26
|
+
export const toKebabCase = defineCaseOperation("to-kebab-case", "To kebab-case", 'Joins the lowercase words with hyphens. e.g. "helloWorld" becomes "hello-world".', ["kebabcase", "dash case", "hyphen"], (words) => words.map((word) => word.toLowerCase()).join("-"), { input: "Hello bigWorld", output: "hello-big-world" });
|
|
27
|
+
// Letters that Unicode decomposition does not reduce to ASCII.
|
|
28
|
+
const TRANSLITERATIONS = { ß: "ss", æ: "ae", œ: "oe", ø: "o", đ: "d", ł: "l", þ: "th", ð: "d" };
|
|
29
|
+
export const toSlug = defineOperation({
|
|
30
|
+
id: "to-slug",
|
|
31
|
+
name: "To slug",
|
|
32
|
+
description: 'Makes a URL-friendly slug: removes accents, lowercases, and replaces everything but letters and digits with a separator. e.g. "Héllo, World!" becomes "hello-world". Each line is converted separately.',
|
|
33
|
+
category: "Text",
|
|
34
|
+
output: "binary",
|
|
35
|
+
aliases: ["slugify", "permalink"],
|
|
36
|
+
args: {
|
|
37
|
+
separator: { type: "string", name: "Separator", default: "-" },
|
|
38
|
+
},
|
|
39
|
+
examples: [
|
|
40
|
+
{ input: "Héllo, World!", output: "hello-world" },
|
|
41
|
+
{ input: "Straße & Œuvre", args: { separator: "_" }, output: "strasse_oeuvre" },
|
|
42
|
+
],
|
|
43
|
+
run: (input, { separator }) => mapText(input, (text) => mapLines(text, (lines) => lines.map((line) => line
|
|
44
|
+
.toLowerCase()
|
|
45
|
+
.replace(/[ßæœøđłþð]/g, (ch) => TRANSLITERATIONS[ch])
|
|
46
|
+
.normalize("NFKD")
|
|
47
|
+
.replace(/\p{M}/gu, "")
|
|
48
|
+
.replace(/[^a-z0-9]+/g, " ")
|
|
49
|
+
.trim()
|
|
50
|
+
.replaceAll(" ", separator)))),
|
|
51
|
+
});
|
|
52
|
+
export const toTitleCase = defineOperation({
|
|
53
|
+
id: "to-title-case",
|
|
54
|
+
name: "To Title Case",
|
|
55
|
+
description: 'Capitalizes the first letter of every word and lowercases the others. e.g. "hello WORLD" becomes "Hello World".',
|
|
56
|
+
category: "Text",
|
|
57
|
+
output: "binary",
|
|
58
|
+
aliases: ["capitalize", "titlecase"],
|
|
59
|
+
args: {},
|
|
60
|
+
examples: [{ input: "hello WORLD, don't panic", output: "Hello World, Don't Panic" }],
|
|
61
|
+
run: (input) => mapText(input, (text) => text.replace(/[\p{L}\p{N}][\p{L}\p{N}\p{M}'’]*/gu, capitalize)),
|
|
62
|
+
});
|
|
63
|
+
export const toUpperCase = defineOperation({
|
|
64
|
+
id: "to-upper-case",
|
|
65
|
+
name: "To UPPER CASE",
|
|
66
|
+
description: 'Converts the text to uppercase. e.g. "héllo" becomes "HÉLLO".',
|
|
67
|
+
category: "Text",
|
|
68
|
+
output: "binary",
|
|
69
|
+
aliases: ["uppercase", "capitals"],
|
|
70
|
+
args: {},
|
|
71
|
+
examples: [{ input: "héllo world", output: "HÉLLO WORLD" }],
|
|
72
|
+
run: (input) => mapText(input, (text) => text.toUpperCase()),
|
|
73
|
+
});
|
|
74
|
+
export const toLowerCase = defineOperation({
|
|
75
|
+
id: "to-lower-case",
|
|
76
|
+
name: "To lower case",
|
|
77
|
+
description: 'Converts the text to lowercase. e.g. "HÉLLO" becomes "héllo".',
|
|
78
|
+
category: "Text",
|
|
79
|
+
output: "binary",
|
|
80
|
+
aliases: ["lowercase"],
|
|
81
|
+
args: {},
|
|
82
|
+
examples: [{ input: "HÉLLO World", output: "héllo world" }],
|
|
83
|
+
run: (input) => mapText(input, (text) => text.toLowerCase()),
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case.js","sourceRoot":"","sources":["../../../src/operations/text/case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE/C,yFAAyF;AACzF,MAAM,IAAI,GAAG,iGAAiG,CAAC;AAE/G,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAA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+
export declare const countChars: import("../../operation.ts").Operation<"count-chars", {
|
|
2
|
+
readonly unit: {
|
|
3
|
+
readonly type: "select";
|
|
4
|
+
readonly name: "Unit";
|
|
5
|
+
readonly options: readonly [{
|
|
6
|
+
readonly value: "graphemes";
|
|
7
|
+
readonly label: "Characters as displayed (é and 👍🏽 count as 1)";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "codepoints";
|
|
10
|
+
readonly label: "Unicode code points";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "bytes";
|
|
13
|
+
readonly label: "Bytes";
|
|
14
|
+
}];
|
|
15
|
+
readonly default: "graphemes";
|
|
16
|
+
};
|
|
17
|
+
}, never>;
|
|
18
|
+
export declare const countLines: import("../../operation.ts").Operation<"count-lines", {}, never>;
|
|
19
|
+
export declare const countWords: import("../../operation.ts").Operation<"count-words", {}, never>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { defineOperation } from "../../operation.js";
|
|
2
|
+
import { splitLines } from "./lines.js";
|
|
3
|
+
const encodeNumber = (n) => new TextEncoder().encode(String(n));
|
|
4
|
+
const UNITS = [
|
|
5
|
+
{ value: "graphemes", label: "Characters as displayed (é and 👍🏽 count as 1)" },
|
|
6
|
+
{ value: "codepoints", label: "Unicode code points" },
|
|
7
|
+
{ value: "bytes", label: "Bytes" },
|
|
8
|
+
];
|
|
9
|
+
export const countChars = defineOperation({
|
|
10
|
+
id: "count-chars",
|
|
11
|
+
name: "Count characters",
|
|
12
|
+
description: "Counts the characters of the input, line breaks included, like `wc -m`.",
|
|
13
|
+
category: "Text",
|
|
14
|
+
output: "text",
|
|
15
|
+
aliases: ["length", "wc -m", "char count"],
|
|
16
|
+
args: {
|
|
17
|
+
unit: { type: "select", name: "Unit", options: UNITS, default: "graphemes" },
|
|
18
|
+
},
|
|
19
|
+
examples: [
|
|
20
|
+
{ input: "héllo 👍🏽", output: "7" },
|
|
21
|
+
{ input: "héllo 👍🏽", args: { unit: "codepoints" }, output: "8" },
|
|
22
|
+
{ input: "héllo 👍🏽", args: { unit: "bytes" }, output: "15" },
|
|
23
|
+
],
|
|
24
|
+
run(input, { unit }) {
|
|
25
|
+
if (unit === "bytes")
|
|
26
|
+
return encodeNumber(input.length);
|
|
27
|
+
const text = new TextDecoder().decode(input);
|
|
28
|
+
if (unit === "codepoints")
|
|
29
|
+
return encodeNumber([...text].length);
|
|
30
|
+
return encodeNumber([...new Intl.Segmenter().segment(text)].length);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export const countLines = defineOperation({
|
|
34
|
+
id: "count-lines",
|
|
35
|
+
name: "Count lines",
|
|
36
|
+
description: "Counts the lines of the input. Unlike `wc -l`, a last line without a line break is counted.",
|
|
37
|
+
category: "Text",
|
|
38
|
+
output: "text",
|
|
39
|
+
aliases: ["wc -l", "line count"],
|
|
40
|
+
args: {},
|
|
41
|
+
examples: [
|
|
42
|
+
{ input: "a\nb\nc", output: "3" },
|
|
43
|
+
{ input: "a\nb\n", output: "2" },
|
|
44
|
+
{ input: "", output: "0" },
|
|
45
|
+
],
|
|
46
|
+
run: (input) => encodeNumber(splitLines(new TextDecoder().decode(input)).lines.length),
|
|
47
|
+
});
|
|
48
|
+
export const countWords = defineOperation({
|
|
49
|
+
id: "count-words",
|
|
50
|
+
name: "Count words",
|
|
51
|
+
description: "Counts the words of the input, separated by whitespace, like `wc -w`.",
|
|
52
|
+
category: "Text",
|
|
53
|
+
output: "text",
|
|
54
|
+
aliases: ["wc -w", "word count"],
|
|
55
|
+
args: {},
|
|
56
|
+
examples: [{ input: " hello big\n world ", output: "3" }],
|
|
57
|
+
run: (input) => encodeNumber(new TextDecoder().decode(input).split(/\s+/).filter(Boolean).length),
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=count.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"count.js","sourceRoot":"","sources":["../../../src/operations/text/count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,o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EAAE,sBAAsB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAC1D,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;CAClG,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const sortLines: import("../../operation.ts").Operation<"sort-lines", {
|
|
2
|
+
readonly reverse: {
|
|
3
|
+
readonly type: "boolean";
|
|
4
|
+
readonly name: "Reverse";
|
|
5
|
+
readonly description: "Sort in descending order.";
|
|
6
|
+
readonly default: false;
|
|
7
|
+
};
|
|
8
|
+
readonly ignoreCase: {
|
|
9
|
+
readonly type: "boolean";
|
|
10
|
+
readonly name: "Ignore case";
|
|
11
|
+
readonly default: false;
|
|
12
|
+
};
|
|
13
|
+
readonly natural: {
|
|
14
|
+
readonly type: "boolean";
|
|
15
|
+
readonly name: "Natural order";
|
|
16
|
+
readonly description: "Compare numbers by value (\"2\" before \"10\") and letters alphabetically (\"a\" before \"B\").";
|
|
17
|
+
readonly default: false;
|
|
18
|
+
};
|
|
19
|
+
}, never>;
|
|
20
|
+
export declare const shuffleLines: import("../../operation.ts").Operation<"shuffle-lines", {
|
|
21
|
+
readonly seed: {
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
readonly name: "Seed";
|
|
24
|
+
readonly description: "Gives the same order every time for the same seed and input. Leave empty for a random order.";
|
|
25
|
+
readonly default: "";
|
|
26
|
+
};
|
|
27
|
+
}, never>;
|
|
28
|
+
export declare const uniqueLines: import("../../operation.ts").Operation<"unique-lines", {
|
|
29
|
+
readonly ignoreCase: {
|
|
30
|
+
readonly type: "boolean";
|
|
31
|
+
readonly name: "Ignore case";
|
|
32
|
+
readonly default: false;
|
|
33
|
+
};
|
|
34
|
+
}, never>;
|
|
35
|
+
export declare const reverseLines: import("../../operation.ts").Operation<"reverse-lines", {}, never>;
|
|
36
|
+
export declare const addLineNumbers: import("../../operation.ts").Operation<"add-line-numbers", {
|
|
37
|
+
readonly start: {
|
|
38
|
+
readonly type: "number";
|
|
39
|
+
readonly name: "First number";
|
|
40
|
+
readonly default: 1;
|
|
41
|
+
};
|
|
42
|
+
readonly separator: {
|
|
43
|
+
readonly type: "string";
|
|
44
|
+
readonly name: "Separator";
|
|
45
|
+
readonly description: "Placed between the number and the line.";
|
|
46
|
+
readonly default: " ";
|
|
47
|
+
};
|
|
48
|
+
}, never>;
|