actions-on-google
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -43,3 +43,3 @@ /// <reference types="debug" /> | ||
/** @hidden */ | ||
export declare const stringify: (o: {}, override?: {} | undefined) => string; | ||
export declare const stringify: (root: any, ...exclude: string[]) => string; | ||
/** @hidden */ | ||
@@ -46,0 +46,0 @@ export declare type ProtoAny<TType, TSpec> = { |
@@ -35,5 +35,25 @@ "use strict"; | ||
/** @hidden */ | ||
exports.stringify = (o, override) => JSON.stringify(Object.assign(exports.clone(o), override), null, 2); | ||
// tslint:disable-next-line:no-any root can by anything | ||
exports.stringify = (root, ...exclude) => { | ||
const excluded = new Set(exclude); | ||
const filtered = Object.keys(root).reduce((o, k) => { | ||
if (excluded.has(k)) { | ||
o[k] = '[Excluded]'; | ||
return o; | ||
} | ||
const value = root[k]; | ||
try { | ||
JSON.stringify(value); | ||
o[k] = value; | ||
return o; | ||
} | ||
catch (e) { | ||
o[k] = `[Stringify Error] ${e}`; | ||
return o; | ||
} | ||
}, {}); | ||
return JSON.stringify(filtered, null, 2); | ||
}; | ||
/** @hidden */ | ||
exports.toArray = (a) => Array.isArray(a) ? a : [a]; | ||
//# sourceMappingURL=common.js.map |
@@ -119,7 +119,3 @@ "use strict"; | ||
const log = debug ? common.info : common.debug; | ||
log('Conversation', common.stringify(conv, { | ||
request: null, | ||
headers: null, | ||
body: null, | ||
})); | ||
log('Conversation', common.stringify(conv, 'request', 'headers', 'body')); | ||
const { intent } = conv; | ||
@@ -126,0 +122,0 @@ const traversed = {}; |
@@ -127,7 +127,3 @@ "use strict"; | ||
const log = debug ? common.info : common.debug; | ||
log('Conversation', common.stringify(conv, { | ||
request: null, | ||
headers: null, | ||
body: null, | ||
})); | ||
log('Conversation', common.stringify(conv, 'request', 'headers', 'body')); | ||
const { intent } = conv; | ||
@@ -134,0 +130,0 @@ const traversed = {}; |
@@ -6,3 +6,3 @@ { | ||
"types": "dist/index.d.ts", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"license": "Apache-2.0", | ||
@@ -9,0 +9,0 @@ "author": "Google Inc.", |
@@ -49,4 +49,22 @@ /** | ||
/** @hidden */ | ||
export const stringify = | ||
(o: {}, override?: {}) => JSON.stringify(Object.assign(clone(o), override), null, 2) | ||
// tslint:disable-next-line:no-any root can by anything | ||
export const stringify = (root: any, ...exclude: string[]) => { | ||
const excluded = new Set(exclude) | ||
const filtered = Object.keys(root).reduce((o, k) => { | ||
if (excluded.has(k)) { | ||
o[k] = '[Excluded]' | ||
return o | ||
} | ||
const value = root[k] | ||
try { | ||
JSON.stringify(value) | ||
o[k] = value | ||
return o | ||
} catch (e) { | ||
o[k] = `[Stringify Error] ${e}` | ||
return o | ||
} | ||
}, {} as typeof root) | ||
return JSON.stringify(filtered, null, 2) | ||
} | ||
@@ -53,0 +71,0 @@ /** @hidden */ |
@@ -337,7 +337,3 @@ /** | ||
const log = debug ? common.info : common.debug | ||
log('Conversation', common.stringify(conv, { | ||
request: null, | ||
headers: null, | ||
body: null, | ||
})) | ||
log('Conversation', common.stringify(conv, 'request', 'headers', 'body')) | ||
const { intent } = conv | ||
@@ -344,0 +340,0 @@ const traversed: Traversed = {} |
@@ -423,7 +423,3 @@ /** | ||
const log = debug ? common.info : common.debug | ||
log('Conversation', common.stringify(conv, { | ||
request: null, | ||
headers: null, | ||
body: null, | ||
})) | ||
log('Conversation', common.stringify(conv, 'request', 'headers', 'body')) | ||
const { intent } = conv | ||
@@ -430,0 +426,0 @@ const traversed: Traversed = {} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
911829
20190