MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / combineFn_arrayAppend

Function combineFn_arrayAppend

frontend/util/ijson.ts:71–83  ·  view source on GitHub ↗
(oldVal: any, newVal: any, opts: SetPathOpts)

Source from the content-addressed store, hash-verified

69};
70
71function combineFn_arrayAppend(oldVal: any, newVal: any, opts: SetPathOpts): any {
72 if (oldVal == null) {
73 return [newVal];
74 }
75 if (!isArray(oldVal) && !opts.force) {
76 throw new Error("Cannot append to non-array: " + oldVal);
77 }
78 if (!isArray(oldVal)) {
79 return [newVal];
80 }
81 oldVal.push(newVal);
82 return oldVal;
83}
84
85function checkPath(path: PathType): boolean {
86 if (!isArray(path)) {

Callers

nothing calls this directly

Calls 2

pushMethod · 0.80
isArrayFunction · 0.70

Tested by

no test coverage detected