@vue/shared
Advanced tools
Comparing version 3.0.0-beta.7 to 3.0.0-beta.8
@@ -378,2 +378,30 @@ 'use strict'; | ||
// For converting {{ interpolation }} values to displayed strings. | ||
const toDisplayString = (val) => { | ||
return val == null | ||
? '' | ||
: isObject(val) | ||
? JSON.stringify(val, replacer, 2) | ||
: String(val); | ||
}; | ||
const replacer = (_key, val) => { | ||
if (val instanceof Map) { | ||
return { | ||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => { | ||
entries[`${key} =>`] = val; | ||
return entries; | ||
}, {}) | ||
}; | ||
} | ||
else if (val instanceof Set) { | ||
return { | ||
[`Set(${val.size})`]: [...val.values()] | ||
}; | ||
} | ||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | ||
return String(val); | ||
} | ||
return val; | ||
}; | ||
const EMPTY_OBJ = Object.freeze({}) | ||
@@ -441,10 +469,2 @@ ; | ||
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue); | ||
// For converting {{ interpolation }} values to displayed strings. | ||
const toDisplayString = (val) => { | ||
return val == null | ||
? '' | ||
: isArray(val) || (isPlainObject(val) && val.toString === objectToString) | ||
? JSON.stringify(val, null, 2) | ||
: String(val); | ||
}; | ||
const invokeArrayFns = (fns, arg) => { | ||
@@ -451,0 +471,0 @@ for (let i = 0; i < fns.length; i++) { |
@@ -378,2 +378,30 @@ 'use strict'; | ||
// For converting {{ interpolation }} values to displayed strings. | ||
const toDisplayString = (val) => { | ||
return val == null | ||
? '' | ||
: isObject(val) | ||
? JSON.stringify(val, replacer, 2) | ||
: String(val); | ||
}; | ||
const replacer = (_key, val) => { | ||
if (val instanceof Map) { | ||
return { | ||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => { | ||
entries[`${key} =>`] = val; | ||
return entries; | ||
}, {}) | ||
}; | ||
} | ||
else if (val instanceof Set) { | ||
return { | ||
[`Set(${val.size})`]: [...val.values()] | ||
}; | ||
} | ||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | ||
return String(val); | ||
} | ||
return val; | ||
}; | ||
const EMPTY_OBJ = {}; | ||
@@ -440,10 +468,2 @@ const EMPTY_ARR = []; | ||
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue); | ||
// For converting {{ interpolation }} values to displayed strings. | ||
const toDisplayString = (val) => { | ||
return val == null | ||
? '' | ||
: isArray(val) || (isPlainObject(val) && val.toString === objectToString) | ||
? JSON.stringify(val, null, 2) | ||
: String(val); | ||
}; | ||
const invokeArrayFns = (fns, arg) => { | ||
@@ -450,0 +470,0 @@ for (let i = 0; i < fns.length; i++) { |
@@ -374,2 +374,30 @@ // Make a map and return a function for checking if a key | ||
// For converting {{ interpolation }} values to displayed strings. | ||
const toDisplayString = (val) => { | ||
return val == null | ||
? '' | ||
: isObject(val) | ||
? JSON.stringify(val, replacer, 2) | ||
: String(val); | ||
}; | ||
const replacer = (_key, val) => { | ||
if (val instanceof Map) { | ||
return { | ||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => { | ||
entries[`${key} =>`] = val; | ||
return entries; | ||
}, {}) | ||
}; | ||
} | ||
else if (val instanceof Set) { | ||
return { | ||
[`Set(${val.size})`]: [...val.values()] | ||
}; | ||
} | ||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | ||
return String(val); | ||
} | ||
return val; | ||
}; | ||
const EMPTY_OBJ = (process.env.NODE_ENV !== 'production') | ||
@@ -438,10 +466,2 @@ ? Object.freeze({}) | ||
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue); | ||
// For converting {{ interpolation }} values to displayed strings. | ||
const toDisplayString = (val) => { | ||
return val == null | ||
? '' | ||
: isArray(val) || (isPlainObject(val) && val.toString === objectToString) | ||
? JSON.stringify(val, null, 2) | ||
: String(val); | ||
}; | ||
const invokeArrayFns = (fns, arg) => { | ||
@@ -448,0 +468,0 @@ for (let i = 0; i < fns.length; i++) { |
{ | ||
"name": "@vue/shared", | ||
"version": "3.0.0-beta.7", | ||
"version": "3.0.0-beta.8", | ||
"description": "internal utils shared across @vue packages", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61653
1579