@dosgato/templating 0.0.36 → 0.0.37

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.
@@ -192,11 +192,11 @@ export declare type GraphQLQueryFn = <T>(query: string, variables?: any) => Prom
192
192
  * This function is used by API template definitions to help them identify links inside large blocks
193
193
  * of text and return them for indexing.
194
194
  */
195
- export declare function extractLinksFromText(text: string): LinkDefinition[];
195
+ export declare function extractLinksFromText(text: string | undefined): LinkDefinition[];
196
196
  /**
197
197
  * This function is used by API template definitions to help them identify all the searchable
198
198
  * words in a large block of text and return them for indexing.
199
199
  */
200
- export declare function getKeywords(text: string, options?: {
200
+ export declare function getKeywords(text?: string, options?: {
201
201
  stopwords?: boolean;
202
202
  }): string[];
@@ -10,6 +10,8 @@ export var ValidationMessageType;
10
10
  * of text and return them for indexing.
11
11
  */
12
12
  export function extractLinksFromText(text) {
13
+ if (!text)
14
+ return [];
13
15
  const matches = text.matchAll(/{.*"type"\s?:\s+"\w+".*?}/gi);
14
16
  return Array.from(matches).map(m => JSON.parse(m[0]));
15
17
  }
@@ -18,6 +20,8 @@ export function extractLinksFromText(text) {
18
20
  * words in a large block of text and return them for indexing.
19
21
  */
20
22
  export function getKeywords(text, options) {
23
+ if (!text)
24
+ return [];
21
25
  return Array.from(new Set(text
22
26
  .toLocaleLowerCase()
23
27
  .normalize('NFD').replace(/\p{Diacritic}/gu, '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {