@yuji-min/google-docs-parser 1.0.2 → 1.0.3
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/README.md +1 -0
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -156,6 +156,7 @@ async function main() {
|
|
|
156
156
|
console.log(JSON.stringify(data, null, 2));
|
|
157
157
|
|
|
158
158
|
// ✅ Full type inference - no manual types needed
|
|
159
|
+
console.log(data.Profile); // string: "Senior Software Engineer..."
|
|
159
160
|
const firstJob = data.Experience[0];
|
|
160
161
|
console.log(firstJob.title.company); // "Tech Corp"
|
|
161
162
|
console.log(firstJob.title.role); // "Backend Lead"
|
package/dist/index.d.cts
CHANGED
|
@@ -104,15 +104,25 @@ type ItemField<T extends Schema> = T extends {
|
|
|
104
104
|
} ? {
|
|
105
105
|
[P in K & string]: string;
|
|
106
106
|
} : string;
|
|
107
|
+
/**
|
|
108
|
+
* Helper Type: Represents a keyed list item (parsed from "Key: Value" format).
|
|
109
|
+
*/
|
|
110
|
+
type KeyedListItem = {
|
|
111
|
+
key: string;
|
|
112
|
+
value: string[];
|
|
113
|
+
};
|
|
107
114
|
/**
|
|
108
115
|
* Helper Type: Infers the result type for a `List` content.
|
|
109
116
|
*
|
|
110
|
-
* - If
|
|
117
|
+
* - If `keys` is defined, returns an array of mapped objects.
|
|
118
|
+
* - If `keyDelimiter` is defined, returns an array of `{ key, value }` objects.
|
|
111
119
|
* - Otherwise, returns an array of strings.
|
|
112
120
|
*/
|
|
113
121
|
type ContentListType<C extends List> = C extends {
|
|
114
122
|
keys: readonly any[];
|
|
115
|
-
} ? Array<ItemField<C>> :
|
|
123
|
+
} ? Array<ItemField<C>> : C extends {
|
|
124
|
+
keyDelimiter: string;
|
|
125
|
+
} ? Array<KeyedListItem> : string[];
|
|
116
126
|
/**
|
|
117
127
|
* Helper Type: Recursively infers the type of a Node's content.
|
|
118
128
|
*
|
|
@@ -155,7 +165,7 @@ type GetParsedType<T extends ParseSchema> = {
|
|
|
155
165
|
node: infer N extends Node;
|
|
156
166
|
} ? Array<StructuredItem<N>> : S["content"] extends {
|
|
157
167
|
kind: "list";
|
|
158
|
-
} ? ContentListType<S["content"]> :
|
|
168
|
+
} ? ContentListType<S["content"]> : string;
|
|
159
169
|
};
|
|
160
170
|
|
|
161
171
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -104,15 +104,25 @@ type ItemField<T extends Schema> = T extends {
|
|
|
104
104
|
} ? {
|
|
105
105
|
[P in K & string]: string;
|
|
106
106
|
} : string;
|
|
107
|
+
/**
|
|
108
|
+
* Helper Type: Represents a keyed list item (parsed from "Key: Value" format).
|
|
109
|
+
*/
|
|
110
|
+
type KeyedListItem = {
|
|
111
|
+
key: string;
|
|
112
|
+
value: string[];
|
|
113
|
+
};
|
|
107
114
|
/**
|
|
108
115
|
* Helper Type: Infers the result type for a `List` content.
|
|
109
116
|
*
|
|
110
|
-
* - If
|
|
117
|
+
* - If `keys` is defined, returns an array of mapped objects.
|
|
118
|
+
* - If `keyDelimiter` is defined, returns an array of `{ key, value }` objects.
|
|
111
119
|
* - Otherwise, returns an array of strings.
|
|
112
120
|
*/
|
|
113
121
|
type ContentListType<C extends List> = C extends {
|
|
114
122
|
keys: readonly any[];
|
|
115
|
-
} ? Array<ItemField<C>> :
|
|
123
|
+
} ? Array<ItemField<C>> : C extends {
|
|
124
|
+
keyDelimiter: string;
|
|
125
|
+
} ? Array<KeyedListItem> : string[];
|
|
116
126
|
/**
|
|
117
127
|
* Helper Type: Recursively infers the type of a Node's content.
|
|
118
128
|
*
|
|
@@ -155,7 +165,7 @@ type GetParsedType<T extends ParseSchema> = {
|
|
|
155
165
|
node: infer N extends Node;
|
|
156
166
|
} ? Array<StructuredItem<N>> : S["content"] extends {
|
|
157
167
|
kind: "list";
|
|
158
|
-
} ? ContentListType<S["content"]> :
|
|
168
|
+
} ? ContentListType<S["content"]> : string;
|
|
159
169
|
};
|
|
160
170
|
|
|
161
171
|
/**
|
package/package.json
CHANGED