@synstack/text 1.2.5 → 1.2.6

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 (2) hide show
  1. package/README.md +47 -1
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -54,7 +54,10 @@ List of items:
54
54
 
55
55
  ```bash
56
56
  npm install @synstack/text
57
+ # or
57
58
  yarn add @synstack/text
59
+ # or
60
+ pnpm add @synstack/text
58
61
  ```
59
62
 
60
63
  ## Features
@@ -151,7 +154,7 @@ This is a list of items:
151
154
  - You can infer the value type of the extra object by using a type assertion from `Text.ExtraObject.Infer`
152
155
 
153
156
  ```ts
154
- import { t, tParse, type Text } from "@pairprog/text";
157
+ import { t, tParse, type Text } from "@synstack/text";
155
158
 
156
159
  // @ts-expect-error - The non-matching extra object will be rejected
157
160
  const textFail: Text.String<{ type: "extra"; value: string }> =
@@ -164,3 +167,46 @@ const text: string & { __extra: { type: "extra"; value: string } } =
164
167
  console.log(tParse(text));
165
168
  // ["Hello ", { type: "extra", value: "Hello" }, " World"]
166
169
  ```
170
+
171
+ ### Configuration Options
172
+
173
+ You can configure text processing behavior using `Text.options()`:
174
+
175
+ ```ts
176
+ import { Text } from "@synstack/text";
177
+
178
+ // Custom join string for arrays
179
+ const customText = Text.options({ joinString: " | " });
180
+ const result = customText.t`Items: ${["A", "B", "C"]}`;
181
+ // "Items: A | B | C"
182
+
183
+ // Chain options
184
+ const text = Text.options()
185
+ .options({ joinString: ", " })
186
+ .t`List: ${["item1", "item2"]}`;
187
+ // "List: item1, item2"
188
+ ```
189
+
190
+
191
+ ## API Reference
192
+
193
+ ### Core Functions
194
+
195
+ - **`t`** - Main templating function for creating formatted text
196
+ - **`tParse`** - Parse text with extra objects back into components
197
+
198
+ ### Classes & Types
199
+
200
+ - **`Text`** - Main text processing class with configurable options
201
+ - **`Text.Options`** - Configuration options interface
202
+ - **`Text.String<T>`** - String type with extra object information
203
+ - **`Text.ExtraObject.Base`** - Base type for extra objects
204
+ - **`TextParseExtraItemException`** - Exception thrown during parsing errors
205
+
206
+ ### Configuration
207
+
208
+ ```ts
209
+ type Text.Options = {
210
+ joinString?: string; // Default: "\n"
211
+ }
212
+ ```
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "1.2.5",
7
+ "version": "1.2.6",
8
8
  "description": "String templating as it was meant to be",
9
9
  "keywords": [
10
10
  "string",
@@ -51,7 +51,7 @@
51
51
  "dependencies": {
52
52
  "@synstack/json": "^1.1.10",
53
53
  "@synstack/resolved": "^1.2.7",
54
- "@synstack/str": "^1.2.10"
54
+ "@synstack/str": "^1.2.11"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/node": "^22.15.32",
@@ -63,5 +63,5 @@
63
63
  "!src/**/*.test.ts",
64
64
  "dist/**/*"
65
65
  ],
66
- "gitHead": "48aa2c8c15458d93a91ead4e0bf3f66bbead9a90"
66
+ "gitHead": "a72e34df6c1d75680e5914d05a12e695283a1f6b"
67
67
  }