@twin.org/data-json-ld 0.0.1-next.22 → 0.0.1-next.23

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.
@@ -1582,10 +1582,13 @@ class JsonLdProcessor {
1582
1582
  */
1583
1583
  static async expand(compacted) {
1584
1584
  try {
1585
- const expanded = await jsonLd.expand(core.ObjectHelper.removeEmptyProperties(compacted), {
1586
- documentLoader: JsonLdProcessor.DOCUMENT_LOADER
1587
- });
1588
- return expanded;
1585
+ if (core.Is.object(compacted)) {
1586
+ const expanded = await jsonLd.expand(core.ObjectHelper.removeEmptyProperties(compacted), {
1587
+ documentLoader: JsonLdProcessor.DOCUMENT_LOADER
1588
+ });
1589
+ return expanded;
1590
+ }
1591
+ return [];
1589
1592
  }
1590
1593
  catch (err) {
1591
1594
  if (core.Is.object(err) &&
@@ -1580,10 +1580,13 @@ class JsonLdProcessor {
1580
1580
  */
1581
1581
  static async expand(compacted) {
1582
1582
  try {
1583
- const expanded = await jsonLd.expand(ObjectHelper.removeEmptyProperties(compacted), {
1584
- documentLoader: JsonLdProcessor.DOCUMENT_LOADER
1585
- });
1586
- return expanded;
1583
+ if (Is.object(compacted)) {
1584
+ const expanded = await jsonLd.expand(ObjectHelper.removeEmptyProperties(compacted), {
1585
+ documentLoader: JsonLdProcessor.DOCUMENT_LOADER
1586
+ });
1587
+ return expanded;
1588
+ }
1589
+ return [];
1587
1590
  }
1588
1591
  catch (err) {
1589
1592
  if (Is.object(err) &&
@@ -26,7 +26,7 @@ export declare class JsonLdProcessor {
26
26
  * @param compacted The compacted JSON-LD document to expand.
27
27
  * @returns The expanded JSON-LD document.
28
28
  */
29
- static expand<T extends IJsonLdNodeObject>(compacted: T): Promise<IJsonLdNodeObject[]>;
29
+ static expand<T>(compacted: T): Promise<IJsonLdNodeObject[]>;
30
30
  /**
31
31
  * Add a redirect to use during document resolution.
32
32
  * @param from The URL to redirect from.
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/data-json-ld - Changelog
2
2
 
3
- ## v0.0.1-next.22
3
+ ## v0.0.1-next.23
4
4
 
5
5
  - Initial Release
@@ -72,7 +72,7 @@ Expand a document, removing its context.
72
72
 
73
73
  #### Type Parameters
74
74
 
75
- • **T** *extends* [`IJsonLdNodeObject`](../interfaces/IJsonLdNodeObject.md)
75
+ • **T**
76
76
 
77
77
  #### Parameters
78
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/data-json-ld",
3
- "version": "0.0.1-next.22",
3
+ "version": "0.0.1-next.23",
4
4
  "description": "Models which define the structure of JSON LD",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
- "@twin.org/data-core": "0.0.1-next.22",
18
+ "@twin.org/data-core": "0.0.1-next.23",
19
19
  "@twin.org/entity": "next",
20
20
  "@twin.org/nameof": "next",
21
21
  "@twin.org/web": "next",