diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/share.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/share.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/share.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/share.js new file mode 100644 index 0000000000..9e7d962b8f --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/share.js @@ -0,0 +1,58 @@ +/** + * Shared funcs/values + */ + +export const ENTER = 13; +export const ESCAPE = 27; + +export const filters = { + all: t => true, + active: t => !t.completed, + completed: t => t.completed +} + +/** + * Read the `location.hash` value + * @return {String} + */ +export function read() { + return location.hash.replace('#/', '') || 'all'; +} + +/** + * Modified `Object.assign` shim + * - always writes to new object + * @return {Object} + */ +export function assign() { + let src; + let tar = {}; + for (let s = 0; s < arguments.length; s++) { + src = Object(arguments[s]); + for (const k in src) { + tar[k] = src[k]; + } + } + return tar; +} + +/** + * Are two Objects equal values? + * @param {Object} a + * @param {Object} b + * @return {Boolean} + */ +export function isEqual(a, b) { + // Create arrays of property names + const aProps = Object.getOwnPropertyNames(a); + const bProps = Object.getOwnPropertyNames(b); + + if (aProps.length !== bProps.length) return false; + + for (let i = 0; i < aProps.length; i++) { + const k = aProps[i]; + if (a[k] !== b[k]) return false; + } + + return true; +} |