lib0 0.2.107 → 0.2.108
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/coverage/tmp/coverage-24213-1747233250173-0.json +1 -0
- package/dist/aes-gcm.cjs +3 -3
- package/dist/{broadcastchannel-b12b5283.cjs → broadcastchannel-f721f1d5.cjs} +2 -2
- package/dist/{broadcastchannel-b12b5283.cjs.map → broadcastchannel-f721f1d5.cjs.map} +1 -1
- package/dist/broadcastchannel.cjs +6 -6
- package/dist/{buffer-c775e94f.cjs → buffer-5c744eee.cjs} +5 -5
- package/dist/{buffer-c775e94f.cjs.map → buffer-5c744eee.cjs.map} +1 -1
- package/dist/buffer.cjs +5 -5
- package/dist/component.cjs +1 -1
- package/dist/{decoding-a2e1942e.cjs → decoding-7b1393a8.cjs} +3 -3
- package/dist/{decoding-a2e1942e.cjs.map → decoding-7b1393a8.cjs.map} +1 -1
- package/dist/decoding.cjs +3 -3
- package/dist/{encoding-cbd8e85d.cjs → encoding-364fc682.cjs} +2 -2
- package/dist/{encoding-cbd8e85d.cjs.map → encoding-364fc682.cjs.map} +1 -1
- package/dist/encoding.cjs +2 -2
- package/dist/{environment-a22d11e0.cjs → environment-e8406042.cjs} +2 -2
- package/dist/{environment-a22d11e0.cjs.map → environment-e8406042.cjs.map} +1 -1
- package/dist/environment.cjs +2 -2
- package/dist/index.cjs +7 -7
- package/dist/jwt.cjs +5 -5
- package/dist/logging.cjs +2 -2
- package/dist/logging.common.cjs +2 -2
- package/dist/logging.node.cjs +2 -2
- package/dist/{prng-44216e7f.cjs → prng-706a5e42.cjs} +3 -3
- package/dist/{prng-44216e7f.cjs.map → prng-706a5e42.cjs.map} +1 -1
- package/dist/prng.cjs +6 -6
- package/dist/rabin-gf2-polynomial.cjs +5 -5
- package/dist/rabin-uncached.cjs +5 -5
- package/dist/rabin.cjs +5 -5
- package/dist/{string-3cd7a2db.cjs → string-42009272.cjs} +34 -2
- package/dist/string-42009272.cjs.map +1 -0
- package/dist/string.cjs +3 -1
- package/dist/string.cjs.map +1 -1
- package/dist/string.d.ts +2 -0
- package/dist/string.d.ts.map +1 -1
- package/dist/string.test.d.ts +5 -4
- package/dist/string.test.d.ts.map +1 -1
- package/dist/testing.cjs +6 -6
- package/package.json +1 -1
- package/string.d.ts +2 -0
- package/string.d.ts.map +1 -1
- package/string.js +28 -0
- package/string.test.d.ts +5 -4
- package/string.test.d.ts.map +1 -1
- package/coverage/tmp/coverage-18706-1746450396473-0.json +0 -1
- package/dist/string-3cd7a2db.cjs.map +0 -1
package/dist/rabin.cjs
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var buffer = require('./buffer-
|
|
5
|
+
var buffer = require('./buffer-5c744eee.cjs');
|
|
6
6
|
var map = require('./map-0dabcc55.cjs');
|
|
7
|
-
require('./string-
|
|
7
|
+
require('./string-42009272.cjs');
|
|
8
8
|
require('./array-f0f52786.cjs');
|
|
9
9
|
require('./set-a0a3ea69.cjs');
|
|
10
|
-
require('./environment-
|
|
10
|
+
require('./environment-e8406042.cjs');
|
|
11
11
|
require('./conditions-f5c0c102.cjs');
|
|
12
12
|
require('./storage.cjs');
|
|
13
13
|
require('./function-a29189eb.cjs');
|
|
14
14
|
require('./object-315a738b.cjs');
|
|
15
15
|
require('./traits.cjs');
|
|
16
16
|
require('./math-08e068f9.cjs');
|
|
17
|
-
require('./encoding-
|
|
17
|
+
require('./encoding-364fc682.cjs');
|
|
18
18
|
require('./number-466d8922.cjs');
|
|
19
19
|
require('./binary-ac8e39e2.cjs');
|
|
20
|
-
require('./decoding-
|
|
20
|
+
require('./decoding-7b1393a8.cjs');
|
|
21
21
|
require('./error-8582d695.cjs');
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -138,6 +138,34 @@ const splice = (str, index, remove, insert = '') => str.slice(0, index) + insert
|
|
|
138
138
|
*/
|
|
139
139
|
const repeat = (source, n) => array.unfold(n, () => source).join('');
|
|
140
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Escape HTML characters &,<,>,'," to their respective HTML entities &,<,>,',"
|
|
143
|
+
*
|
|
144
|
+
* @param {string} str
|
|
145
|
+
*/
|
|
146
|
+
const escapeHTML = str =>
|
|
147
|
+
str.replace(/[&<>'"]/g, r => /** @type {string} */ ({
|
|
148
|
+
'&': '&',
|
|
149
|
+
'<': '<',
|
|
150
|
+
'>': '>',
|
|
151
|
+
"'": ''',
|
|
152
|
+
'"': '"'
|
|
153
|
+
}[r]));
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Reverse of `escapeHTML`
|
|
157
|
+
*
|
|
158
|
+
* @param {string} str
|
|
159
|
+
*/
|
|
160
|
+
const unescapeHTML = str =>
|
|
161
|
+
str.replace(/&|<|>|'|"/g, r => /** @type {string} */ ({
|
|
162
|
+
'&': '&',
|
|
163
|
+
'<': '<',
|
|
164
|
+
'>': '>',
|
|
165
|
+
''': "'",
|
|
166
|
+
'"': '"'
|
|
167
|
+
}[r]));
|
|
168
|
+
|
|
141
169
|
var string = /*#__PURE__*/Object.freeze({
|
|
142
170
|
__proto__: null,
|
|
143
171
|
fromCharCode: fromCharCode,
|
|
@@ -155,7 +183,9 @@ var string = /*#__PURE__*/Object.freeze({
|
|
|
155
183
|
_decodeUtf8Native: _decodeUtf8Native,
|
|
156
184
|
decodeUtf8: decodeUtf8,
|
|
157
185
|
splice: splice,
|
|
158
|
-
repeat: repeat
|
|
186
|
+
repeat: repeat,
|
|
187
|
+
escapeHTML: escapeHTML,
|
|
188
|
+
unescapeHTML: unescapeHTML
|
|
159
189
|
});
|
|
160
190
|
|
|
161
191
|
exports.MAX_UTF16_CHARACTER = MAX_UTF16_CHARACTER;
|
|
@@ -165,6 +195,7 @@ exports._encodeUtf8Native = _encodeUtf8Native;
|
|
|
165
195
|
exports._encodeUtf8Polyfill = _encodeUtf8Polyfill;
|
|
166
196
|
exports.decodeUtf8 = decodeUtf8;
|
|
167
197
|
exports.encodeUtf8 = encodeUtf8;
|
|
198
|
+
exports.escapeHTML = escapeHTML;
|
|
168
199
|
exports.fromCamelCase = fromCamelCase;
|
|
169
200
|
exports.fromCharCode = fromCharCode;
|
|
170
201
|
exports.fromCodePoint = fromCodePoint;
|
|
@@ -172,6 +203,7 @@ exports.repeat = repeat;
|
|
|
172
203
|
exports.splice = splice;
|
|
173
204
|
exports.string = string;
|
|
174
205
|
exports.trimLeft = trimLeft;
|
|
206
|
+
exports.unescapeHTML = unescapeHTML;
|
|
175
207
|
exports.utf8ByteLength = utf8ByteLength;
|
|
176
208
|
exports.utf8TextEncoder = utf8TextEncoder;
|
|
177
|
-
//# sourceMappingURL=string-
|
|
209
|
+
//# sourceMappingURL=string-42009272.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-42009272.cjs","sources":["../string.js"],"sourcesContent":["import * as array from './array.js'\n\n/**\n * Utility module to work with strings.\n *\n * @module string\n */\n\nexport const fromCharCode = String.fromCharCode\nexport const fromCodePoint = String.fromCodePoint\n\n/**\n * The largest utf16 character.\n * Corresponds to Uint8Array([255, 255]) or charcodeof(2x2^8)\n */\nexport const MAX_UTF16_CHARACTER = fromCharCode(65535)\n\n/**\n * @param {string} s\n * @return {string}\n */\nconst toLowerCase = s => s.toLowerCase()\n\nconst trimLeftRegex = /^\\s*/g\n\n/**\n * @param {string} s\n * @return {string}\n */\nexport const trimLeft = s => s.replace(trimLeftRegex, '')\n\nconst fromCamelCaseRegex = /([A-Z])/g\n\n/**\n * @param {string} s\n * @param {string} separator\n * @return {string}\n */\nexport const fromCamelCase = (s, separator) => trimLeft(s.replace(fromCamelCaseRegex, match => `${separator}${toLowerCase(match)}`))\n\n/**\n * Compute the utf8ByteLength\n * @param {string} str\n * @return {number}\n */\nexport const utf8ByteLength = str => unescape(encodeURIComponent(str)).length\n\n/**\n * @param {string} str\n * @return {Uint8Array}\n */\nexport const _encodeUtf8Polyfill = str => {\n const encodedString = unescape(encodeURIComponent(str))\n const len = encodedString.length\n const buf = new Uint8Array(len)\n for (let i = 0; i < len; i++) {\n buf[i] = /** @type {number} */ (encodedString.codePointAt(i))\n }\n return buf\n}\n\n/* c8 ignore next */\nexport const utf8TextEncoder = /** @type {TextEncoder} */ (typeof TextEncoder !== 'undefined' ? new TextEncoder() : null)\n\n/**\n * @param {string} str\n * @return {Uint8Array}\n */\nexport const _encodeUtf8Native = str => utf8TextEncoder.encode(str)\n\n/**\n * @param {string} str\n * @return {Uint8Array}\n */\n/* c8 ignore next */\nexport const encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill\n\n/**\n * @param {Uint8Array} buf\n * @return {string}\n */\nexport const _decodeUtf8Polyfill = buf => {\n let remainingLen = buf.length\n let encodedString = ''\n let bufPos = 0\n while (remainingLen > 0) {\n const nextLen = remainingLen < 10000 ? remainingLen : 10000\n const bytes = buf.subarray(bufPos, bufPos + nextLen)\n bufPos += nextLen\n // Starting with ES5.1 we can supply a generic array-like object as arguments\n encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes))\n remainingLen -= nextLen\n }\n return decodeURIComponent(escape(encodedString))\n}\n\n/* c8 ignore next */\nexport let utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8', { fatal: true, ignoreBOM: true })\n\n/* c8 ignore start */\nif (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) {\n // Safari doesn't handle BOM correctly.\n // This fixes a bug in Safari 13.0.5 where it produces a BOM the first time it is called.\n // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the first call and\n // utf8TextDecoder.decode(new Uint8Array()).length === 1 on the second call\n // Another issue is that from then on no BOM chars are recognized anymore\n /* c8 ignore next */\n utf8TextDecoder = null\n}\n/* c8 ignore stop */\n\n/**\n * @param {Uint8Array} buf\n * @return {string}\n */\nexport const _decodeUtf8Native = buf => /** @type {TextDecoder} */ (utf8TextDecoder).decode(buf)\n\n/**\n * @param {Uint8Array} buf\n * @return {string}\n */\n/* c8 ignore next */\nexport const decodeUtf8 = utf8TextDecoder ? _decodeUtf8Native : _decodeUtf8Polyfill\n\n/**\n * @param {string} str The initial string\n * @param {number} index Starting position\n * @param {number} remove Number of characters to remove\n * @param {string} insert New content to insert\n */\nexport const splice = (str, index, remove, insert = '') => str.slice(0, index) + insert + str.slice(index + remove)\n\n/**\n * @param {string} source\n * @param {number} n\n */\nexport const repeat = (source, n) => array.unfold(n, () => source).join('')\n\n/**\n * Escape HTML characters &,<,>,',\" to their respective HTML entities &,<,>,',"\n *\n * @param {string} str\n */\nexport const escapeHTML = str =>\n str.replace(/[&<>'\"]/g, r => /** @type {string} */ ({\n '&': '&',\n '<': '<',\n '>': '>',\n \"'\": ''',\n '\"': '"'\n }[r]))\n\n/**\n * Reverse of `escapeHTML`\n *\n * @param {string} str\n */\nexport const unescapeHTML = str =>\n str.replace(/&|<|>|'|"/g, r => /** @type {string} */ ({\n '&': '&',\n '<': '<',\n '>': '>',\n ''': \"'\",\n '"': '\"'\n }[r]))\n"],"names":["utf8TextDecoder","array.unfold"],"mappings":";;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,MAAM,CAAC,aAAY;AACnC,MAAC,aAAa,GAAG,MAAM,CAAC,cAAa;AACjD;AACA;AACA;AACA;AACA;AACY,MAAC,mBAAmB,GAAG,YAAY,CAAC,KAAK,EAAC;AACtD;AACA;AACA;AACA;AACA;AACA,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,GAAE;AACxC;AACA,MAAM,aAAa,GAAG,QAAO;AAC7B;AACA;AACA;AACA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,EAAC;AACzD;AACA,MAAM,kBAAkB,GAAG,WAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,CAAC,CAA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EAAC;AACnH;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,KAAKC,YAAY,CAAC,CAAC,EAAE,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,EAAC;AAC3E;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,UAAU,GAAG,GAAG;AAC7B,EAAE,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,2BAA2B;AACtD,IAAI,GAAG,EAAE,OAAO;AAChB,IAAI,GAAG,EAAE,MAAM;AACf,IAAI,GAAG,EAAE,MAAM;AACf,IAAI,GAAG,EAAE,OAAO;AAChB,IAAI,GAAG,EAAE,QAAQ;AACjB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAC;AACR;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,GAAG;AAC/B,EAAE,GAAG,CAAC,OAAO,CAAC,+BAA+B,EAAE,CAAC,2BAA2B;AAC3E,IAAI,OAAO,EAAE,GAAG;AAChB,IAAI,MAAM,EAAE,GAAG;AACf,IAAI,MAAM,EAAE,GAAG;AACf,IAAI,OAAO,EAAE,GAAG;AAChB,IAAI,QAAQ,EAAE,GAAG;AACjB,GAAG,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/string.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('./array-f0f52786.cjs');
|
|
6
|
-
var string = require('./string-
|
|
6
|
+
var string = require('./string-42009272.cjs');
|
|
7
7
|
require('./set-a0a3ea69.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
@@ -15,12 +15,14 @@ exports._encodeUtf8Native = string._encodeUtf8Native;
|
|
|
15
15
|
exports._encodeUtf8Polyfill = string._encodeUtf8Polyfill;
|
|
16
16
|
exports.decodeUtf8 = string.decodeUtf8;
|
|
17
17
|
exports.encodeUtf8 = string.encodeUtf8;
|
|
18
|
+
exports.escapeHTML = string.escapeHTML;
|
|
18
19
|
exports.fromCamelCase = string.fromCamelCase;
|
|
19
20
|
exports.fromCharCode = string.fromCharCode;
|
|
20
21
|
exports.fromCodePoint = string.fromCodePoint;
|
|
21
22
|
exports.repeat = string.repeat;
|
|
22
23
|
exports.splice = string.splice;
|
|
23
24
|
exports.trimLeft = string.trimLeft;
|
|
25
|
+
exports.unescapeHTML = string.unescapeHTML;
|
|
24
26
|
exports.utf8ByteLength = string.utf8ByteLength;
|
|
25
27
|
Object.defineProperty(exports, 'utf8TextDecoder', {
|
|
26
28
|
enumerable: true,
|
package/dist/string.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/string.d.ts
CHANGED
|
@@ -23,4 +23,6 @@ export function _decodeUtf8Native(buf: Uint8Array): string;
|
|
|
23
23
|
export function decodeUtf8(buf: Uint8Array): string;
|
|
24
24
|
export function splice(str: string, index: number, remove: number, insert?: string): string;
|
|
25
25
|
export function repeat(source: string, n: number): string;
|
|
26
|
+
export function escapeHTML(str: string): string;
|
|
27
|
+
export function unescapeHTML(str: string): string;
|
|
26
28
|
//# sourceMappingURL=string.d.ts.map
|
package/dist/string.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../string.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,0DAA+C;AAC/C,gEAAiD;AAEjD;;;GAGG;AACH,yCAAsD;AAc/C,4BAHI,MAAM,GACL,MAAM,CAEuC;AASlD,iCAJI,MAAM,aACN,MAAM,GACL,MAAM,CAEkH;AAO7H,oCAHI,MAAM,GACL,MAAM,CAE2D;AAMtE,yCAHI,MAAM,GACL,UAAU,CAUrB;AAGD,0CAAyH;AAMlH,uCAHI,MAAM,GACL,UAAU,CAE6C;AAjB5D,gCAHI,MAAM,GACL,UAAU,CAUrB;AAsBM,yCAHI,UAAU,GACT,MAAM,CAejB;AAGD,+CAAmI;AAkB5H,uCAHI,UAAU,GACT,MAAM,CAE8E;AAlCzF,gCAHI,UAAU,GACT,MAAM,CAejB;AAoCM,4BALI,MAAM,SACN,MAAM,UACN,MAAM,WACN,MAAM,UAEkG;AAM5G,+BAHI,MAAM,KACN,MAAM,UAE0D"}
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../string.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,0DAA+C;AAC/C,gEAAiD;AAEjD;;;GAGG;AACH,yCAAsD;AAc/C,4BAHI,MAAM,GACL,MAAM,CAEuC;AASlD,iCAJI,MAAM,aACN,MAAM,GACL,MAAM,CAEkH;AAO7H,oCAHI,MAAM,GACL,MAAM,CAE2D;AAMtE,yCAHI,MAAM,GACL,UAAU,CAUrB;AAGD,0CAAyH;AAMlH,uCAHI,MAAM,GACL,UAAU,CAE6C;AAjB5D,gCAHI,MAAM,GACL,UAAU,CAUrB;AAsBM,yCAHI,UAAU,GACT,MAAM,CAejB;AAGD,+CAAmI;AAkB5H,uCAHI,UAAU,GACT,MAAM,CAE8E;AAlCzF,gCAHI,UAAU,GACT,MAAM,CAejB;AAoCM,4BALI,MAAM,SACN,MAAM,UACN,MAAM,WACN,MAAM,UAEkG;AAM5G,+BAHI,MAAM,KACN,MAAM,UAE0D;AAOpE,gCAFI,MAAM,UAST;AAOD,kCAFI,MAAM,UAST"}
|
package/dist/string.test.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export function testUtilities(
|
|
2
|
-
export function testLowercaseTransformation(
|
|
1
|
+
export function testUtilities(_tc: t.TestCase): void;
|
|
2
|
+
export function testLowercaseTransformation(_tc: t.TestCase): void;
|
|
3
3
|
export function testRepeatStringUtf8Encoding(tc: t.TestCase): void;
|
|
4
4
|
export function testRepeatStringUtf8Decoding(tc: t.TestCase): void;
|
|
5
|
-
export function testBomEncodingDecoding(
|
|
6
|
-
export function testSplice(
|
|
5
|
+
export function testBomEncodingDecoding(_tc: t.TestCase): void;
|
|
6
|
+
export function testSplice(_tc: t.TestCase): void;
|
|
7
|
+
export function testHtmlEscape(_tc: t.TestCase): void;
|
|
7
8
|
import * as t from './testing.js';
|
|
8
9
|
//# sourceMappingURL=string.test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["../string.test.js"],"names":[],"mappings":"AAOO,
|
|
1
|
+
{"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["../string.test.js"],"names":[],"mappings":"AAOO,mCAFI,EAAE,QAAQ,QAMpB;AAKM,iDAFI,EAAE,QAAQ,QAOpB;AAKM,iDAFI,EAAE,QAAQ,QAapB;AAKM,iDAFI,EAAE,QAAQ,QAapB;AAKM,6CAFI,EAAE,QAAQ,QAYpB;AAKM,gCAFI,EAAE,QAAQ,QAMpB;AAKM,oCAFI,EAAE,QAAQ,QAYpB;mBA1FkB,cAAc"}
|
package/dist/testing.cjs
CHANGED
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var log = require('lib0/logging');
|
|
6
6
|
var diff = require('./diff-6c8c103c.cjs');
|
|
7
7
|
var object = require('./object-315a738b.cjs');
|
|
8
|
-
var string = require('./string-
|
|
8
|
+
var string = require('./string-42009272.cjs');
|
|
9
9
|
var math = require('./math-08e068f9.cjs');
|
|
10
10
|
var random = require('./random.cjs');
|
|
11
|
-
var prng = require('./prng-
|
|
11
|
+
var prng = require('./prng-706a5e42.cjs');
|
|
12
12
|
var statistics = require('./statistics-c2316dca.cjs');
|
|
13
13
|
var array = require('./array-f0f52786.cjs');
|
|
14
|
-
var environment = require('./environment-
|
|
14
|
+
var environment = require('./environment-e8406042.cjs');
|
|
15
15
|
var json = require('./json-092190a1.cjs');
|
|
16
16
|
var time = require('./time-bc2081b9.cjs');
|
|
17
17
|
var promise = require('./promise-7d13a97c.cjs');
|
|
@@ -20,10 +20,10 @@ var traits = require('./traits.cjs');
|
|
|
20
20
|
require('./function-a29189eb.cjs');
|
|
21
21
|
require('./binary-ac8e39e2.cjs');
|
|
22
22
|
require('lib0/webcrypto');
|
|
23
|
-
require('./buffer-
|
|
24
|
-
require('./encoding-
|
|
23
|
+
require('./buffer-5c744eee.cjs');
|
|
24
|
+
require('./encoding-364fc682.cjs');
|
|
25
25
|
require('./number-466d8922.cjs');
|
|
26
|
-
require('./decoding-
|
|
26
|
+
require('./decoding-7b1393a8.cjs');
|
|
27
27
|
require('./error-8582d695.cjs');
|
|
28
28
|
require('./set-a0a3ea69.cjs');
|
|
29
29
|
require('./map-0dabcc55.cjs');
|
package/package.json
CHANGED
package/string.d.ts
CHANGED
|
@@ -23,4 +23,6 @@ export function _decodeUtf8Native(buf: Uint8Array): string;
|
|
|
23
23
|
export function decodeUtf8(buf: Uint8Array): string;
|
|
24
24
|
export function splice(str: string, index: number, remove: number, insert?: string): string;
|
|
25
25
|
export function repeat(source: string, n: number): string;
|
|
26
|
+
export function escapeHTML(str: string): string;
|
|
27
|
+
export function unescapeHTML(str: string): string;
|
|
26
28
|
//# sourceMappingURL=string.d.ts.map
|
package/string.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["string.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,0DAA+C;AAC/C,gEAAiD;AAEjD;;;GAGG;AACH,yCAAsD;AAc/C,4BAHI,MAAM,GACL,MAAM,CAEuC;AASlD,iCAJI,MAAM,aACN,MAAM,GACL,MAAM,CAEkH;AAO7H,oCAHI,MAAM,GACL,MAAM,CAE2D;AAMtE,yCAHI,MAAM,GACL,UAAU,CAUrB;AAGD,0CAAyH;AAMlH,uCAHI,MAAM,GACL,UAAU,CAE6C;AAjB5D,gCAHI,MAAM,GACL,UAAU,CAUrB;AAsBM,yCAHI,UAAU,GACT,MAAM,CAejB;AAGD,+CAAmI;AAkB5H,uCAHI,UAAU,GACT,MAAM,CAE8E;AAlCzF,gCAHI,UAAU,GACT,MAAM,CAejB;AAoCM,4BALI,MAAM,SACN,MAAM,UACN,MAAM,WACN,MAAM,UAEkG;AAM5G,+BAHI,MAAM,KACN,MAAM,UAE0D"}
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["string.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,0DAA+C;AAC/C,gEAAiD;AAEjD;;;GAGG;AACH,yCAAsD;AAc/C,4BAHI,MAAM,GACL,MAAM,CAEuC;AASlD,iCAJI,MAAM,aACN,MAAM,GACL,MAAM,CAEkH;AAO7H,oCAHI,MAAM,GACL,MAAM,CAE2D;AAMtE,yCAHI,MAAM,GACL,UAAU,CAUrB;AAGD,0CAAyH;AAMlH,uCAHI,MAAM,GACL,UAAU,CAE6C;AAjB5D,gCAHI,MAAM,GACL,UAAU,CAUrB;AAsBM,yCAHI,UAAU,GACT,MAAM,CAejB;AAGD,+CAAmI;AAkB5H,uCAHI,UAAU,GACT,MAAM,CAE8E;AAlCzF,gCAHI,UAAU,GACT,MAAM,CAejB;AAoCM,4BALI,MAAM,SACN,MAAM,UACN,MAAM,WACN,MAAM,UAEkG;AAM5G,+BAHI,MAAM,KACN,MAAM,UAE0D;AAOpE,gCAFI,MAAM,UAST;AAOD,kCAFI,MAAM,UAST"}
|
package/string.js
CHANGED
|
@@ -135,3 +135,31 @@ export const splice = (str, index, remove, insert = '') => str.slice(0, index) +
|
|
|
135
135
|
* @param {number} n
|
|
136
136
|
*/
|
|
137
137
|
export const repeat = (source, n) => array.unfold(n, () => source).join('')
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Escape HTML characters &,<,>,'," to their respective HTML entities &,<,>,',"
|
|
141
|
+
*
|
|
142
|
+
* @param {string} str
|
|
143
|
+
*/
|
|
144
|
+
export const escapeHTML = str =>
|
|
145
|
+
str.replace(/[&<>'"]/g, r => /** @type {string} */ ({
|
|
146
|
+
'&': '&',
|
|
147
|
+
'<': '<',
|
|
148
|
+
'>': '>',
|
|
149
|
+
"'": ''',
|
|
150
|
+
'"': '"'
|
|
151
|
+
}[r]))
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Reverse of `escapeHTML`
|
|
155
|
+
*
|
|
156
|
+
* @param {string} str
|
|
157
|
+
*/
|
|
158
|
+
export const unescapeHTML = str =>
|
|
159
|
+
str.replace(/&|<|>|'|"/g, r => /** @type {string} */ ({
|
|
160
|
+
'&': '&',
|
|
161
|
+
'<': '<',
|
|
162
|
+
'>': '>',
|
|
163
|
+
''': "'",
|
|
164
|
+
'"': '"'
|
|
165
|
+
}[r]))
|
package/string.test.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export function testUtilities(
|
|
2
|
-
export function testLowercaseTransformation(
|
|
1
|
+
export function testUtilities(_tc: t.TestCase): void;
|
|
2
|
+
export function testLowercaseTransformation(_tc: t.TestCase): void;
|
|
3
3
|
export function testRepeatStringUtf8Encoding(tc: t.TestCase): void;
|
|
4
4
|
export function testRepeatStringUtf8Decoding(tc: t.TestCase): void;
|
|
5
|
-
export function testBomEncodingDecoding(
|
|
6
|
-
export function testSplice(
|
|
5
|
+
export function testBomEncodingDecoding(_tc: t.TestCase): void;
|
|
6
|
+
export function testSplice(_tc: t.TestCase): void;
|
|
7
|
+
export function testHtmlEscape(_tc: t.TestCase): void;
|
|
7
8
|
import * as t from './testing.js';
|
|
8
9
|
//# sourceMappingURL=string.test.d.ts.map
|
package/string.test.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["string.test.js"],"names":[],"mappings":"AAOO,
|
|
1
|
+
{"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["string.test.js"],"names":[],"mappings":"AAOO,mCAFI,EAAE,QAAQ,QAMpB;AAKM,iDAFI,EAAE,QAAQ,QAOpB;AAKM,iDAFI,EAAE,QAAQ,QAapB;AAKM,iDAFI,EAAE,QAAQ,QAapB;AAKM,6CAFI,EAAE,QAAQ,QAYpB;AAKM,gCAFI,EAAE,QAAQ,QAMpB;AAKM,oCAFI,EAAE,QAAQ,QAYpB;mBA1FkB,cAAc"}
|