MCPcopy Create free account
hub / github.com/json-editor/json-editor / value

Method value

docs/scripts/ajv-validator.js:1486–1508  ·  view source on GitHub ↗
(nameOrPrefix, value)

Source from the content-addressed store, hash-verified

1484 return new ValueScopeName(prefix, this._newName(prefix));
1485 }
1486 value(nameOrPrefix, value) {
1487 var _a;
1488 if (value.ref === undefined)
1489 throw new Error("CodeGen: ref must be passed in value");
1490 const name = this.toName(nameOrPrefix);
1491 const { prefix } = name;
1492 const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;
1493 let vs = this._values[prefix];
1494 if (vs) {
1495 const _name = vs.get(valueKey);
1496 if (_name)
1497 return _name;
1498 }
1499 else {
1500 vs = this._values[prefix] = new Map();
1501 }
1502 vs.set(valueKey, name);
1503 const s = this._scope[prefix] || (this._scope[prefix] = []);
1504 const itemIndex = s.length;
1505 s[itemIndex] = value.ref;
1506 name.setValue(value, { property: prefix, itemIndex });
1507 return name;
1508 }
1509 getValue(prefix, keyOrRef) {
1510 const vs = this._values[prefix];
1511 if (!vs)

Callers 5

onWatchedFieldChangeMethod · 0.80
setValueMethod · 0.80
afterInputReadyMethod · 0.80
scopeValueMethod · 0.80
compileSchemaFunction · 0.80

Calls 3

toNameMethod · 0.80
getMethod · 0.80
setValueMethod · 0.45

Tested by

no test coverage detected