MCPcopy Create free account
hub / github.com/chartjs/Chart.js / assertOwnOrNew

Function assertOwnOrNew

src/core/core.defaults.ts:30–36  ·  view source on GitHub ↗

* A key may name an own property of the node or one it does not have yet, never * one it inherits: the walk would leave the defaults through it. * @param node The node the key is read from, undefined when it does not exist yet * @param key * @param path The path to report

(node: any, key: string, path: string)

Source from the content-addressed store, hash-verified

28 * @param path The path to report
29 */
30function assertOwnOrNew(node: any, key: string, path: string) {
31 // `in` throws on a primitive, such as the string a path `color.length` reads
32 // `length` from; Object() wraps it.
33 if (UNSAFE_KEYS.includes(key) || (node && !_hasOwn(node, key) && key in Object(node))) {
34 throw new Error(`Invalid defaults scope: ${path}`);
35 }
36}
37
38/**
39 * Checks every key of a path before anything is created, so that a rejected

Callers 1

assertPathFunction · 0.85

Calls 1

_hasOwnFunction · 0.85

Tested by

no test coverage detected