MCPcopy
hub / github.com/Vincit/objection.js / ensureModelArray

Method ensureModelArray

lib/model/Model.js:585–601  ·  view source on GitHub ↗
(input, options)

Source from the content-addressed store, hash-verified

583 }
584
585 static ensureModelArray(input, options) {
586 if (!input) {
587 return [];
588 }
589
590 if (Array.isArray(input)) {
591 const models = new Array(input.length);
592
593 for (let i = 0, l = input.length; i < l; ++i) {
594 models[i] = this.ensureModel(input[i], options);
595 }
596
597 return models;
598 } else {
599 return [this.ensureModel(input, options)];
600 }
601 }
602
603 static getRelationUnsafe(name) {
604 const mapping = this.getRelationMappings()[name];

Callers 5

fetchGraphMethod · 0.95
onAddMethod · 0.80
constructorMethod · 0.80
testFunction · 0.80
Model.jsFile · 0.80

Calls 2

ensureModelMethod · 0.95
isArrayMethod · 0.45

Tested by 1

testFunction · 0.64