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.
- package/@types/helper/methods/index.d.ts +2 -1
- package/@types/helper/methods/stringify.d.ts +8 -0
- package/build/helper/methods/index.js +1 -0
- package/build/helper/methods/stringify.js +31 -0
- package/build/rest.js +1 -1
- package/dist/gd-sprest.d.ts +12 -0
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.js.LICENSE.txt +4 -0
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +1 -1
|
@@ -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
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -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";
|