@stacksjs/strings 0.75.528 → 0.75.535

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/dist/html.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Decode HTML character references (named, decimal and hex) in one pass. */
2
+ export declare function decodeHtmlEntities(input: string): string;
package/dist/html.js ADDED
@@ -0,0 +1 @@
1
+ const NAMED={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",ndash:"–",mdash:"—",hellip:"…",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",laquo:"«",raquo:"»",trade:"™",reg:"®",copy:"©",deg:"°",times:"×",frac12:"½",euro:"€",pound:"£",yen:"¥",cent:"¢"};export function decodeHtmlEntities(input){return input.replace(/&(#x[0-9a-f]+|#\d+|[a-z][a-z0-9]*);/gi,(whole,ref)=>{if(ref[0]==="#"){const code=ref[1]==="x"||ref[1]==="X"?Number.parseInt(ref.slice(2),16):Number.parseInt(ref.slice(1),10);return Number.isInteger(code)&&code>0&&code<=1114111?String.fromCodePoint(code):whole}return NAMED[ref.toLowerCase()]??whole})}
package/dist/macro.d.ts CHANGED
@@ -1,40 +1,3 @@
1
- /**
2
- * @defaultValue
3
- * ```ts
4
- * {
5
- * slash: (str: string) => string,
6
- * ensurePrefix: (prefix: string, str: string) => string,
7
- * ensureSuffix: (suffix: string, str: string) => string,
8
- * template: (str: string, ...args: any[]) => string,
9
- * truncate: (str: string, length: number, end?: string) => string,
10
- * random: (length?: number, dict?: string) => string,
11
- * capitalize: (str: string) => string,
12
- * slug: (str: string) => string,
13
- * detectIndent: (str: string) => { amount: number; indent: string; type?: string | undefined },
14
- * detectNewline: (str: string) => string | undefined,
15
- * camelCase: (str: string) => string,
16
- * capitalCase: (str: string) => string,
17
- * constantCase: (str: string) => string,
18
- * dotCase: (str: string) => string,
19
- * noCase: (str: string) => string,
20
- * paramCase: (str: string) => string,
21
- * pascalCase: (str: string) => string,
22
- * pathCase: (str: string) => string,
23
- * sentenceCase: (str: string) => string,
24
- * snakeCase: (str: string) => string,
25
- * titleCase: (str: string) => string,
26
- * kebabCase: (str: string) => string,
27
- * plural: (str: string) => string,
28
- * singular: (str: string) => string,
29
- * isPlural: (str: string) => boolean,
30
- * isSingular: (str: string) => boolean,
31
- * addPluralRule: (rule: string | RegExp, repl: string) => void,
32
- * addSingularRule: (rule: string | RegExp, repl: string) => void,
33
- * addIrregularRule: (single: string, plural: string) => void,
34
- * addUncountableRule: (word: string | RegExp) => void
35
- * }
36
- * ```
37
- */
38
1
  export declare const Str: {
39
2
  slash: (str: string) => string;
40
3
  ensurePrefix: (prefix: string, str: string) => string;
@@ -47,11 +10,7 @@ export declare const Str: {
47
10
  random: (length?: number, dict?: string) => string;
48
11
  capitalize: (str: string) => string;
49
12
  slug: (str: string) => string;
50
- detectIndent: (str: string) => {
51
- amount: number
52
- indent: string
53
- type?: string | undefined
54
- };
13
+ detectIndent: (str: string) => unknown;
55
14
  detectNewline: (str: string) => string | undefined;
56
15
  camelCase: (str: string) => string;
57
16
  capitalCase: (str: string) => string;
@@ -18,4 +18,4 @@ declare interface PluralizeFunction {
18
18
  }
19
19
  declare type Rule = [RegExp, string];
20
20
  declare type StringOrRegExp = string | RegExp;
21
- export {};
21
+ export default pluralize;
package/dist/string.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './case';
2
2
  export * from './helpers';
3
+ export * from './html';
3
4
  export * from './macro';
4
5
  export * from './pluralize';
5
6
  export * from './slug';
package/dist/string.js CHANGED
@@ -1 +1 @@
1
- export*from"./case";export*from"./helpers";export*from"./macro";export*from"./pluralize";export*from"./slug";export*from"./utils";export*from"./validators";export*from"./csv";
1
+ export*from"./case";export*from"./helpers";export*from"./html";export*from"./macro";export*from"./pluralize";export*from"./slug";export*from"./utils";export*from"./validators";export*from"./csv";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/strings",
3
3
  "type": "module",
4
- "version": "0.75.528",
4
+ "version": "0.75.535",
5
5
  "description": "The Stacks string utilities.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -69,9 +69,9 @@
69
69
  "prepublishOnly": "bun run build"
70
70
  },
71
71
  "devDependencies": {
72
- "@stacksjs/alias": "0.75.528",
72
+ "@stacksjs/alias": "0.75.535",
73
73
  "better-dx": "^0.2.24",
74
- "@stacksjs/types": "0.75.528"
74
+ "@stacksjs/types": "0.75.535"
75
75
  },
76
76
  "sideEffects": false
77
77
  }