boma 2.0.5 → 2.0.6
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/dist/index.js +3 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -150,10 +150,7 @@ export const sanitizeNonSerializable = (value, path = '$', ancestors = new WeakM
|
|
|
150
150
|
if (typeof value === 'number') {
|
|
151
151
|
return Number.isFinite(value) ? value : 'non-finite-number';
|
|
152
152
|
}
|
|
153
|
-
if (
|
|
154
|
-
typeof value === 'function' ||
|
|
155
|
-
typeof value === 'symbol' ||
|
|
156
|
-
typeof value === 'bigint') {
|
|
153
|
+
if (['undefined', 'function', 'symbol', 'bigint'].includes(typeof value)) {
|
|
157
154
|
return typeFlagFromValue(value);
|
|
158
155
|
}
|
|
159
156
|
if (Array.isArray(value)) {
|
|
@@ -188,8 +185,8 @@ export const saveJSON = (saveInput) => {
|
|
|
188
185
|
const { filePath, objToSave, format = false, logSaving = false, replaceNonSerializable = false, silent = true, } = saveInput;
|
|
189
186
|
const issues = getSerializationIssues(objToSave);
|
|
190
187
|
if (issues.length > 0) {
|
|
191
|
-
logSerializationIssues(issues);
|
|
192
|
-
if (!replaceNonSerializable) {
|
|
188
|
+
!silent && logSerializationIssues(issues);
|
|
189
|
+
if (!replaceNonSerializable && !silent) {
|
|
193
190
|
const firstIssue = issues[0];
|
|
194
191
|
const errorMessage = `[${getDate()}] Boma got non JSON-serializable object at saveJSON! ${getIssueMessage(firstIssue)}`;
|
|
195
192
|
console.error(errorMessage);
|