gd-sprest 7.4.0 → 7.4.1

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.
@@ -9,4 +9,5 @@ export * from "./loadSPCore";
9
9
  export * from "./parse";
10
10
  export * from "./request";
11
11
  export * from "./setContentTypeFields";
12
- export * from "./setGroupOwner";
12
+ export * from "./setGroupOwner";
13
+ export * from "./stringify";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Convert an object to a string
3
+ * @category Helper
4
+ */
5
+ export const stringify: IStringify;
6
+ export interface IStringify {
7
+ (obj: any): string;
8
+ }
@@ -22,3 +22,4 @@ __exportStar(require("./parse"), exports);
22
22
  __exportStar(require("./request"), exports);
23
23
  __exportStar(require("./setContentTypeFields"), exports);
24
24
  __exportStar(require("./setGroupOwner"), exports);
25
+ __exportStar(require("./stringify"), exports);
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringify = void 0;
4
+ /**
5
+ * Convert an object to a string
6
+ */
7
+ exports.stringify = function (obj) {
8
+ // Return the string
9
+ return JSON.stringify(obj, function (key, value) {
10
+ // Ensure a key exists
11
+ if (key) {
12
+ // See if this is a string or number, and return it
13
+ var valueType = typeof (value);
14
+ if (valueType === "string" || valueType === "number") {
15
+ return value;
16
+ }
17
+ try {
18
+ // Try to parse it
19
+ JSON.parse(value);
20
+ // Return the value
21
+ return value;
22
+ }
23
+ catch (_a) {
24
+ // Don't include this key/value pair
25
+ return undefined;
26
+ }
27
+ }
28
+ // Return the value
29
+ return value;
30
+ });
31
+ };
package/build/rest.js CHANGED
@@ -8,7 +8,7 @@ var sptypes_1 = require("./sptypes");
8
8
  * SharePoint REST Library
9
9
  */
10
10
  exports.$REST = {
11
- __ver: 7.40,
11
+ __ver: 7.41,
12
12
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
13
13
  Apps: Lib.Apps,
14
14
  ContextInfo: Lib.ContextInfo,
@@ -4045,6 +4045,7 @@ declare module 'gd-sprest/helper/methods' {
4045
4045
  export * from "gd-sprest/helper/methods/request";
4046
4046
  export * from "gd-sprest/helper/methods/setContentTypeFields";
4047
4047
  export * from "gd-sprest/helper/methods/setGroupOwner";
4048
+ export * from "gd-sprest/helper/methods/stringify";
4048
4049
  }
4049
4050
 
4050
4051
  declare module 'gd-sprest/sptypes/sptypes' {
@@ -6479,6 +6480,17 @@ declare module 'gd-sprest/helper/methods/setGroupOwner' {
6479
6480
  }
6480
6481
  }
6481
6482
 
6483
+ declare module 'gd-sprest/helper/methods/stringify' {
6484
+ /**
6485
+ * Convert an object to a string
6486
+ * @category Helper
6487
+ */
6488
+ export const stringify: IStringify;
6489
+ export interface IStringify {
6490
+ (obj: any): string;
6491
+ }
6492
+ }
6493
+
6482
6494
  declare module 'gd-sprest/utils/base' {
6483
6495
  import { IBaseExecution, IBaseResult } from "gd-sprest-def/lib/base";
6484
6496
  import { ITargetInfo, ITargetInfoProps } from "gd-sprest/utils/targetInfo";