@almadar/std 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.
Files changed (78) hide show
  1. package/LICENSE +72 -0
  2. package/dist/behaviors/action-affinity.d.ts +88 -0
  3. package/dist/behaviors/action-affinity.js +290 -0
  4. package/dist/behaviors/action-affinity.js.map +1 -0
  5. package/dist/behaviors/async.d.ts +20 -0
  6. package/dist/behaviors/async.js +542 -0
  7. package/dist/behaviors/async.js.map +1 -0
  8. package/dist/behaviors/data-management.d.ts +40 -0
  9. package/dist/behaviors/data-management.js +495 -0
  10. package/dist/behaviors/data-management.js.map +1 -0
  11. package/dist/behaviors/feedback.d.ts +18 -0
  12. package/dist/behaviors/feedback.js +307 -0
  13. package/dist/behaviors/feedback.js.map +1 -0
  14. package/dist/behaviors/game-core.d.ts +40 -0
  15. package/dist/behaviors/game-core.js +443 -0
  16. package/dist/behaviors/game-core.js.map +1 -0
  17. package/dist/behaviors/game-entity.d.ts +39 -0
  18. package/dist/behaviors/game-entity.js +643 -0
  19. package/dist/behaviors/game-entity.js.map +1 -0
  20. package/dist/behaviors/game-ui.d.ts +29 -0
  21. package/dist/behaviors/game-ui.js +493 -0
  22. package/dist/behaviors/game-ui.js.map +1 -0
  23. package/dist/behaviors/index.d.ts +11 -0
  24. package/dist/behaviors/index.js +4539 -0
  25. package/dist/behaviors/index.js.map +1 -0
  26. package/dist/behaviors/registry.d.ts +103 -0
  27. package/dist/behaviors/registry.js +4166 -0
  28. package/dist/behaviors/registry.js.map +1 -0
  29. package/dist/behaviors/types.d.ts +179 -0
  30. package/dist/behaviors/types.js +111 -0
  31. package/dist/behaviors/types.js.map +1 -0
  32. package/dist/behaviors/ui-interaction.d.ts +36 -0
  33. package/dist/behaviors/ui-interaction.js +1104 -0
  34. package/dist/behaviors/ui-interaction.js.map +1 -0
  35. package/dist/index.d.ts +195 -0
  36. package/dist/index.js +8209 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/modules/array.d.ts +28 -0
  39. package/dist/modules/array.js +556 -0
  40. package/dist/modules/array.js.map +1 -0
  41. package/dist/modules/async.d.ts +22 -0
  42. package/dist/modules/async.js +112 -0
  43. package/dist/modules/async.js.map +1 -0
  44. package/dist/modules/format.d.ts +21 -0
  45. package/dist/modules/format.js +129 -0
  46. package/dist/modules/format.js.map +1 -0
  47. package/dist/modules/index.d.ts +12 -0
  48. package/dist/modules/index.js +3131 -0
  49. package/dist/modules/index.js.map +1 -0
  50. package/dist/modules/math.d.ts +22 -0
  51. package/dist/modules/math.js +215 -0
  52. package/dist/modules/math.js.map +1 -0
  53. package/dist/modules/nn.d.ts +23 -0
  54. package/dist/modules/nn.js +189 -0
  55. package/dist/modules/nn.js.map +1 -0
  56. package/dist/modules/object.d.ts +22 -0
  57. package/dist/modules/object.js +257 -0
  58. package/dist/modules/object.js.map +1 -0
  59. package/dist/modules/str.d.ts +21 -0
  60. package/dist/modules/str.js +344 -0
  61. package/dist/modules/str.js.map +1 -0
  62. package/dist/modules/tensor.d.ts +23 -0
  63. package/dist/modules/tensor.js +427 -0
  64. package/dist/modules/tensor.js.map +1 -0
  65. package/dist/modules/time.d.ts +24 -0
  66. package/dist/modules/time.js +323 -0
  67. package/dist/modules/time.js.map +1 -0
  68. package/dist/modules/train.d.ts +23 -0
  69. package/dist/modules/train.js +308 -0
  70. package/dist/modules/train.js.map +1 -0
  71. package/dist/modules/validate.d.ts +23 -0
  72. package/dist/modules/validate.js +301 -0
  73. package/dist/modules/validate.js.map +1 -0
  74. package/dist/registry.d.ts +140 -0
  75. package/dist/registry.js +3240 -0
  76. package/dist/registry.js.map +1 -0
  77. package/dist/types-I95R8_FN.d.ts +91 -0
  78. package/package.json +59 -0
@@ -0,0 +1,22 @@
1
+ import { a as StdOperatorMeta } from '../types-I95R8_FN.js';
2
+
3
+ /**
4
+ * Async Module - Asynchronous Operations
5
+ *
6
+ * Provides functions for handling async operations, delays, and timing.
7
+ * These operators have side effects as they affect execution timing.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+
12
+ /**
13
+ * Async module operators.
14
+ * These operators control execution timing and have side effects.
15
+ */
16
+ declare const ASYNC_OPERATORS: Record<string, StdOperatorMeta>;
17
+ /**
18
+ * Get all async operator names.
19
+ */
20
+ declare function getAsyncOperators(): string[];
21
+
22
+ export { ASYNC_OPERATORS, getAsyncOperators };
@@ -0,0 +1,112 @@
1
+ // modules/async.ts
2
+ var ASYNC_OPERATORS = {
3
+ "async/delay": {
4
+ module: "async",
5
+ category: "std-async",
6
+ minArity: 1,
7
+ maxArity: 1,
8
+ description: "Wait for specified milliseconds",
9
+ hasSideEffects: true,
10
+ returnType: "void",
11
+ params: [{ name: "ms", type: "number", description: "Milliseconds to wait" }],
12
+ example: '["async/delay", 2000] // Wait 2 seconds'
13
+ },
14
+ "async/timeout": {
15
+ module: "async",
16
+ category: "std-async",
17
+ minArity: 2,
18
+ maxArity: 2,
19
+ description: "Add timeout to an effect",
20
+ hasSideEffects: true,
21
+ returnType: "any",
22
+ params: [
23
+ { name: "effect", type: "expression", description: "Effect to execute" },
24
+ { name: "ms", type: "number", description: "Timeout in milliseconds" }
25
+ ],
26
+ example: '["async/timeout", ["call", "api", "fetchData"], 5000]'
27
+ },
28
+ "async/debounce": {
29
+ module: "async",
30
+ category: "std-async",
31
+ minArity: 2,
32
+ maxArity: 2,
33
+ description: "Debounce an event (wait for pause in events)",
34
+ hasSideEffects: true,
35
+ returnType: "void",
36
+ params: [
37
+ { name: "event", type: "string", description: "Event name to emit" },
38
+ { name: "ms", type: "number", description: "Debounce delay in milliseconds" }
39
+ ],
40
+ example: '["async/debounce", "SEARCH", 300]'
41
+ },
42
+ "async/throttle": {
43
+ module: "async",
44
+ category: "std-async",
45
+ minArity: 2,
46
+ maxArity: 2,
47
+ description: "Throttle an event (emit at most once per interval)",
48
+ hasSideEffects: true,
49
+ returnType: "void",
50
+ params: [
51
+ { name: "event", type: "string", description: "Event name to emit" },
52
+ { name: "ms", type: "number", description: "Throttle interval in milliseconds" }
53
+ ],
54
+ example: '["async/throttle", "SCROLL", 100]'
55
+ },
56
+ "async/retry": {
57
+ module: "async",
58
+ category: "std-async",
59
+ minArity: 2,
60
+ maxArity: 2,
61
+ description: "Retry an effect with configurable backoff",
62
+ hasSideEffects: true,
63
+ returnType: "any",
64
+ params: [
65
+ { name: "effect", type: "expression", description: "Effect to retry" },
66
+ { name: "opts", type: "object", description: "{ attempts, backoff, baseDelay }" }
67
+ ],
68
+ example: `["async/retry",
69
+ ["call", "api", "fetchData", { "id": "@entity.id" }],
70
+ { "attempts": 3, "backoff": "exponential", "baseDelay": 1000 }]`
71
+ },
72
+ "async/race": {
73
+ module: "async",
74
+ category: "std-async",
75
+ minArity: 2,
76
+ maxArity: null,
77
+ description: "Execute effects in parallel, return first to complete",
78
+ hasSideEffects: true,
79
+ returnType: "any",
80
+ params: [{ name: "...effects", type: "expression[]", description: "Effects to race" }],
81
+ example: '["async/race", ["call", "api1"], ["call", "api2"]]'
82
+ },
83
+ "async/all": {
84
+ module: "async",
85
+ category: "std-async",
86
+ minArity: 2,
87
+ maxArity: null,
88
+ description: "Execute effects in parallel, wait for all to complete",
89
+ hasSideEffects: true,
90
+ returnType: "array",
91
+ params: [{ name: "...effects", type: "expression[]", description: "Effects to execute" }],
92
+ example: '["async/all", ["call", "api1"], ["call", "api2"]]'
93
+ },
94
+ "async/sequence": {
95
+ module: "async",
96
+ category: "std-async",
97
+ minArity: 2,
98
+ maxArity: null,
99
+ description: "Execute effects in sequence (one after another)",
100
+ hasSideEffects: true,
101
+ returnType: "array",
102
+ params: [{ name: "...effects", type: "expression[]", description: "Effects to execute in order" }],
103
+ example: '["async/sequence", ["call", "validate"], ["call", "save"]]'
104
+ }
105
+ };
106
+ function getAsyncOperators() {
107
+ return Object.keys(ASYNC_OPERATORS);
108
+ }
109
+
110
+ export { ASYNC_OPERATORS, getAsyncOperators };
111
+ //# sourceMappingURL=async.js.map
112
+ //# sourceMappingURL=async.js.map
@@ -0,0 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AU,CAAA;AAAA,IACV,QAAA,EAAU,IAAA;AAAA,IACV,WAAA,EAAa,uDAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,IAChB,UAAA,EAAY,KAAA;AAAA,IACZ,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAM,cAAc,IAAA,EAAM,cAAA,EAAgB,WAAA,EAAa,iBAAA,EAAmB,CAAA;AAAA,IACrF,OAAA,EAAS;AAAA,GACX;AAAA,EACA,WAAA,EAAa;AAAA,IACX,MAAA,EAAQ,OAAA;AAAA,IACR,QAAA,EAAU,WAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,IAAA;AAAA,IACV,WAAA,EAAa,uDAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,IAChB,UAAA,EAAY,OAAA;AAAA,IACZ,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAM,cAAc,IAAA,EAAM,cAAA,EAAgB,WAAA,EAAa,oBAAA,EAAsB,CAAA;AAAA,IACxF,OAAA,EAAS;AAAA,GACX;AAAA,EACA,gBAAA,EAAkB;AAAA,IAChB,MAAA,EAAQ,OAAA;AAAA,IACR,QAAA,EAAU,WAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,IAAA;AAAA,IACV,WAAA,EAAa,iDAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,IAChB,UAAA,EAAY,OAAA;AAAA,IACZ,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAM,cAAc,IAAA,EAAM,cAAA,EAAgB,WAAA,EAAa,6BAAA,EAA+B,CAAA;AAAA,IACjG,OAAA,EAAS;AAAA;AAEb;AAKO,SAAS,iBAAA,GAA8B;AAC5C,EAAA,OAAO,MAAA,CAAO,KAAK,eAAe,CAAA;AACpC","file":"async.js","sourcesContent":["/**\n * Async Module - Asynchronous Operations\n *\n * Provides functions for handling async operations, delays, and timing.\n * These operators have side effects as they affect execution timing.\n *\n * @packageDocumentation\n */\n\nimport type { StdOperatorMeta } from '../types.js';\n\n/**\n * Async module operators.\n * These operators control execution timing and have side effects.\n */\nexport const ASYNC_OPERATORS: Record<string, StdOperatorMeta> = {\n 'async/delay': {\n module: 'async',\n category: 'std-async',\n minArity: 1,\n maxArity: 1,\n description: 'Wait for specified milliseconds',\n hasSideEffects: true,\n returnType: 'void',\n params: [{ name: 'ms', type: 'number', description: 'Milliseconds to wait' }],\n example: '[\"async/delay\", 2000] // Wait 2 seconds',\n },\n 'async/timeout': {\n module: 'async',\n category: 'std-async',\n minArity: 2,\n maxArity: 2,\n description: 'Add timeout to an effect',\n hasSideEffects: true,\n returnType: 'any',\n params: [\n { name: 'effect', type: 'expression', description: 'Effect to execute' },\n { name: 'ms', type: 'number', description: 'Timeout in milliseconds' },\n ],\n example: '[\"async/timeout\", [\"call\", \"api\", \"fetchData\"], 5000]',\n },\n 'async/debounce': {\n module: 'async',\n category: 'std-async',\n minArity: 2,\n maxArity: 2,\n description: 'Debounce an event (wait for pause in events)',\n hasSideEffects: true,\n returnType: 'void',\n params: [\n { name: 'event', type: 'string', description: 'Event name to emit' },\n { name: 'ms', type: 'number', description: 'Debounce delay in milliseconds' },\n ],\n example: '[\"async/debounce\", \"SEARCH\", 300]',\n },\n 'async/throttle': {\n module: 'async',\n category: 'std-async',\n minArity: 2,\n maxArity: 2,\n description: 'Throttle an event (emit at most once per interval)',\n hasSideEffects: true,\n returnType: 'void',\n params: [\n { name: 'event', type: 'string', description: 'Event name to emit' },\n { name: 'ms', type: 'number', description: 'Throttle interval in milliseconds' },\n ],\n example: '[\"async/throttle\", \"SCROLL\", 100]',\n },\n 'async/retry': {\n module: 'async',\n category: 'std-async',\n minArity: 2,\n maxArity: 2,\n description: 'Retry an effect with configurable backoff',\n hasSideEffects: true,\n returnType: 'any',\n params: [\n { name: 'effect', type: 'expression', description: 'Effect to retry' },\n { name: 'opts', type: 'object', description: '{ attempts, backoff, baseDelay }' },\n ],\n example: `[\"async/retry\",\n [\"call\", \"api\", \"fetchData\", { \"id\": \"@entity.id\" }],\n { \"attempts\": 3, \"backoff\": \"exponential\", \"baseDelay\": 1000 }]`,\n },\n 'async/race': {\n module: 'async',\n category: 'std-async',\n minArity: 2,\n maxArity: null,\n description: 'Execute effects in parallel, return first to complete',\n hasSideEffects: true,\n returnType: 'any',\n params: [{ name: '...effects', type: 'expression[]', description: 'Effects to race' }],\n example: '[\"async/race\", [\"call\", \"api1\"], [\"call\", \"api2\"]]',\n },\n 'async/all': {\n module: 'async',\n category: 'std-async',\n minArity: 2,\n maxArity: null,\n description: 'Execute effects in parallel, wait for all to complete',\n hasSideEffects: true,\n returnType: 'array',\n params: [{ name: '...effects', type: 'expression[]', description: 'Effects to execute' }],\n example: '[\"async/all\", [\"call\", \"api1\"], [\"call\", \"api2\"]]',\n },\n 'async/sequence': {\n module: 'async',\n category: 'std-async',\n minArity: 2,\n maxArity: null,\n description: 'Execute effects in sequence (one after another)',\n hasSideEffects: true,\n returnType: 'array',\n params: [{ name: '...effects', type: 'expression[]', description: 'Effects to execute in order' }],\n example: '[\"async/sequence\", [\"call\", \"validate\"], [\"call\", \"save\"]]',\n },\n};\n\n/**\n * Get all async operator names.\n */\nexport function getAsyncOperators(): string[] {\n return Object.keys(ASYNC_OPERATORS);\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { a as StdOperatorMeta } from '../types-I95R8_FN.js';
2
+
3
+ /**
4
+ * Format Module - Display Formatting
5
+ *
6
+ * Provides formatting functions for numbers, currencies, and display values.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+
11
+ /**
12
+ * Format module operators.
13
+ * All operators return formatted strings and have no side effects.
14
+ */
15
+ declare const FORMAT_OPERATORS: Record<string, StdOperatorMeta>;
16
+ /**
17
+ * Get all format operator names.
18
+ */
19
+ declare function getFormatOperators(): string[];
20
+
21
+ export { FORMAT_OPERATORS, getFormatOperators };
@@ -0,0 +1,129 @@
1
+ // modules/format.ts
2
+ var FORMAT_OPERATORS = {
3
+ "format/number": {
4
+ module: "format",
5
+ category: "std-format",
6
+ minArity: 1,
7
+ maxArity: 2,
8
+ description: "Format number with locale-aware separators",
9
+ hasSideEffects: false,
10
+ returnType: "string",
11
+ params: [
12
+ { name: "n", type: "number", description: "Number to format" },
13
+ { name: "opts", type: "object", description: "Format options (decimals, locale)", optional: true }
14
+ ],
15
+ example: '["format/number", 1234567.89] // => "1,234,567.89"'
16
+ },
17
+ "format/currency": {
18
+ module: "format",
19
+ category: "std-format",
20
+ minArity: 2,
21
+ maxArity: 3,
22
+ description: "Format as currency",
23
+ hasSideEffects: false,
24
+ returnType: "string",
25
+ params: [
26
+ { name: "n", type: "number", description: "Amount" },
27
+ { name: "currency", type: "string", description: "Currency code (USD, EUR, etc.)" },
28
+ { name: "locale", type: "string", description: "Locale", optional: true, defaultValue: "en-US" }
29
+ ],
30
+ example: '["format/currency", 1234.56, "USD"] // => "$1,234.56"'
31
+ },
32
+ "format/percent": {
33
+ module: "format",
34
+ category: "std-format",
35
+ minArity: 1,
36
+ maxArity: 2,
37
+ description: "Format as percentage",
38
+ hasSideEffects: false,
39
+ returnType: "string",
40
+ params: [
41
+ { name: "n", type: "number", description: "Number (0.5 = 50%)" },
42
+ { name: "decimals", type: "number", description: "Decimal places", optional: true, defaultValue: 0 }
43
+ ],
44
+ example: '["format/percent", 0.856, 1] // => "85.6%"'
45
+ },
46
+ "format/bytes": {
47
+ module: "format",
48
+ category: "std-format",
49
+ minArity: 1,
50
+ maxArity: 1,
51
+ description: "Format bytes as human-readable size",
52
+ hasSideEffects: false,
53
+ returnType: "string",
54
+ params: [{ name: "n", type: "number", description: "Bytes" }],
55
+ example: '["format/bytes", 2500000] // => "2.4 MB"'
56
+ },
57
+ "format/ordinal": {
58
+ module: "format",
59
+ category: "std-format",
60
+ minArity: 1,
61
+ maxArity: 1,
62
+ description: "Format number as ordinal (1st, 2nd, 3rd)",
63
+ hasSideEffects: false,
64
+ returnType: "string",
65
+ params: [{ name: "n", type: "number", description: "Number" }],
66
+ example: '["format/ordinal", 42] // => "42nd"'
67
+ },
68
+ "format/plural": {
69
+ module: "format",
70
+ category: "std-format",
71
+ minArity: 3,
72
+ maxArity: 3,
73
+ description: "Format count with singular/plural word",
74
+ hasSideEffects: false,
75
+ returnType: "string",
76
+ params: [
77
+ { name: "n", type: "number", description: "Count" },
78
+ { name: "singular", type: "string", description: "Singular form" },
79
+ { name: "plural", type: "string", description: "Plural form" }
80
+ ],
81
+ example: '["format/plural", 5, "item", "items"] // => "5 items"'
82
+ },
83
+ "format/list": {
84
+ module: "format",
85
+ category: "std-format",
86
+ minArity: 1,
87
+ maxArity: 2,
88
+ description: "Format array as natural language list",
89
+ hasSideEffects: false,
90
+ returnType: "string",
91
+ params: [
92
+ { name: "arr", type: "array", description: "Array of strings" },
93
+ { name: "style", type: "string", description: '"and" or "or"', optional: true, defaultValue: "and" }
94
+ ],
95
+ example: '["format/list", ["Alice", "Bob", "Charlie"], "and"] // => "Alice, Bob, and Charlie"'
96
+ },
97
+ "format/phone": {
98
+ module: "format",
99
+ category: "std-format",
100
+ minArity: 1,
101
+ maxArity: 2,
102
+ description: "Format phone number",
103
+ hasSideEffects: false,
104
+ returnType: "string",
105
+ params: [
106
+ { name: "str", type: "string", description: "Phone number digits" },
107
+ { name: "format", type: "string", description: "Format pattern", optional: true, defaultValue: "US" }
108
+ ],
109
+ example: '["format/phone", "5551234567"] // => "(555) 123-4567"'
110
+ },
111
+ "format/creditCard": {
112
+ module: "format",
113
+ category: "std-format",
114
+ minArity: 1,
115
+ maxArity: 1,
116
+ description: "Format credit card with masked digits",
117
+ hasSideEffects: false,
118
+ returnType: "string",
119
+ params: [{ name: "str", type: "string", description: "Card number" }],
120
+ example: '["format/creditCard", "4111111111111234"] // => "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 1234"'
121
+ }
122
+ };
123
+ function getFormatOperators() {
124
+ return Object.keys(FORMAT_OPERATORS);
125
+ }
126
+
127
+ export { FORMAT_OPERATORS, getFormatOperators };
128
+ //# sourceMappingURL=format.js.map
129
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../modules/format.ts"],"names":[],"mappings":";AAcO,IAAM,gBAAA,GAAoD;AAAA,EAC/D,eAAA,EAAiB;AAAA,IACf,MAAA,EAAQ,QAAA;AAAA,IACR,QAAA,EAAU,YAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,4CAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,GAAA,EAAK,IAAA,EAAM,QAAA,EAAU,aAAa,kBAAA,EAAmB;AAAA,MAC7D,EAAE,MAAM,MAAA,EAAQ,IAAA,EAAM,UAAU,WAAA,EAAa,mCAAA,EAAqC,UAAU,IAAA;AAAK,KACnG;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,iBAAA,EAAmB;AAAA,IACjB,MAAA,EAAQ,QAAA;AAAA,IACR,QAAA,EAAU,YAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,oBAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,GAAA,EAAK,IAAA,EAAM,QAAA,EAAU,aAAa,QAAA,EAAS;AAAA,MACnD,EAAE,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,QAAA,EAAU,aAAa,gCAAA,EAAiC;AAAA,MAClF,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,QAAA,EAAU,QAAA,EAAU,IAAA,EAAM,YAAA,EAAc,OAAA;AAAQ,KACjG;AAAA,IACA,OAAA,EAAS;AA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AA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,qBAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,KAAA,EAAO,IAAA,EAAM,QAAA,EAAU,aAAa,qBAAA,EAAsB;AAAA,MAClE,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,gBAAA,EAAkB,QAAA,EAAU,IAAA,EAAM,YAAA,EAAc,IAAA;AAAK,KACtG;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,mBAAA,EAAqB;AAAA,IACnB,MAAA,EAAQ,QAAA;AAAA,IACR,QAAA,EAAU,YAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,uCAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAM,OAAO,IAAA,EAAM,QAAA,EAAU,WAAA,EAAa,aAAA,EAAe,CAAA;AAAA,IACpE,OAAA,EAAS;AAAA;AAEb;AAKO,SAAS,kBAAA,GAA+B;AAC7C,EAAA,OAAO,MAAA,CAAO,KAAK,gBAAgB,CAAA;AACrC","file":"format.js","sourcesContent":["/**\n * Format Module - Display Formatting\n *\n * Provides formatting functions for numbers, currencies, and display values.\n *\n * @packageDocumentation\n */\n\nimport type { StdOperatorMeta } from '../types.js';\n\n/**\n * Format module operators.\n * All operators return formatted strings and have no side effects.\n */\nexport const FORMAT_OPERATORS: Record<string, StdOperatorMeta> = {\n 'format/number': {\n module: 'format',\n category: 'std-format',\n minArity: 1,\n maxArity: 2,\n description: 'Format number with locale-aware separators',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 'n', type: 'number', description: 'Number to format' },\n { name: 'opts', type: 'object', description: 'Format options (decimals, locale)', optional: true },\n ],\n example: '[\"format/number\", 1234567.89] // => \"1,234,567.89\"',\n },\n 'format/currency': {\n module: 'format',\n category: 'std-format',\n minArity: 2,\n maxArity: 3,\n description: 'Format as currency',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 'n', type: 'number', description: 'Amount' },\n { name: 'currency', type: 'string', description: 'Currency code (USD, EUR, etc.)' },\n { name: 'locale', type: 'string', description: 'Locale', optional: true, defaultValue: 'en-US' },\n ],\n example: '[\"format/currency\", 1234.56, \"USD\"] // => \"$1,234.56\"',\n },\n 'format/percent': {\n module: 'format',\n category: 'std-format',\n minArity: 1,\n maxArity: 2,\n description: 'Format as percentage',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 'n', type: 'number', description: 'Number (0.5 = 50%)' },\n { name: 'decimals', type: 'number', description: 'Decimal places', optional: true, defaultValue: 0 },\n ],\n example: '[\"format/percent\", 0.856, 1] // => \"85.6%\"',\n },\n 'format/bytes': {\n module: 'format',\n category: 'std-format',\n minArity: 1,\n maxArity: 1,\n description: 'Format bytes as human-readable size',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 'n', type: 'number', description: 'Bytes' }],\n example: '[\"format/bytes\", 2500000] // => \"2.4 MB\"',\n },\n 'format/ordinal': {\n module: 'format',\n category: 'std-format',\n minArity: 1,\n maxArity: 1,\n description: 'Format number as ordinal (1st, 2nd, 3rd)',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 'n', type: 'number', description: 'Number' }],\n example: '[\"format/ordinal\", 42] // => \"42nd\"',\n },\n 'format/plural': {\n module: 'format',\n category: 'std-format',\n minArity: 3,\n maxArity: 3,\n description: 'Format count with singular/plural word',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 'n', type: 'number', description: 'Count' },\n { name: 'singular', type: 'string', description: 'Singular form' },\n { name: 'plural', type: 'string', description: 'Plural form' },\n ],\n example: '[\"format/plural\", 5, \"item\", \"items\"] // => \"5 items\"',\n },\n 'format/list': {\n module: 'format',\n category: 'std-format',\n minArity: 1,\n maxArity: 2,\n description: 'Format array as natural language list',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 'arr', type: 'array', description: 'Array of strings' },\n { name: 'style', type: 'string', description: '\"and\" or \"or\"', optional: true, defaultValue: 'and' },\n ],\n example: '[\"format/list\", [\"Alice\", \"Bob\", \"Charlie\"], \"and\"] // => \"Alice, Bob, and Charlie\"',\n },\n 'format/phone': {\n module: 'format',\n category: 'std-format',\n minArity: 1,\n maxArity: 2,\n description: 'Format phone number',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 'str', type: 'string', description: 'Phone number digits' },\n { name: 'format', type: 'string', description: 'Format pattern', optional: true, defaultValue: 'US' },\n ],\n example: '[\"format/phone\", \"5551234567\"] // => \"(555) 123-4567\"',\n },\n 'format/creditCard': {\n module: 'format',\n category: 'std-format',\n minArity: 1,\n maxArity: 1,\n description: 'Format credit card with masked digits',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 'str', type: 'string', description: 'Card number' }],\n example: '[\"format/creditCard\", \"4111111111111234\"] // => \"•••• •••• •••• 1234\"',\n },\n};\n\n/**\n * Get all format operator names.\n */\nexport function getFormatOperators(): string[] {\n return Object.keys(FORMAT_OPERATORS);\n}\n"]}
@@ -0,0 +1,12 @@
1
+ export { MATH_OPERATORS, getMathOperators } from './math.js';
2
+ export { STR_OPERATORS, getStrOperators } from './str.js';
3
+ export { ARRAY_OPERATORS, getArrayOperators, getLambdaArrayOperators } from './array.js';
4
+ export { OBJECT_OPERATORS, getObjectOperators } from './object.js';
5
+ export { TIME_OPERATORS, getTimeOperators } from './time.js';
6
+ export { VALIDATE_OPERATORS, getValidateOperators } from './validate.js';
7
+ export { FORMAT_OPERATORS, getFormatOperators } from './format.js';
8
+ export { ASYNC_OPERATORS, getAsyncOperators } from './async.js';
9
+ export { NN_OPERATORS, getNnOperators } from './nn.js';
10
+ export { TENSOR_OPERATORS, getTensorOperators } from './tensor.js';
11
+ export { TRAIN_OPERATORS, getTrainOperators } from './train.js';
12
+ import '../types-I95R8_FN.js';