MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / constructor

Method constructor

packages/repository/src/model.ts:126–143  ·  view source on GitHub ↗
(nameOrDef: string | ModelDefinitionSyntax)

Source from the content-addressed store, hash-verified

124 [attribute: string]: any; // Other attributes
125
126 constructor(nameOrDef: string | ModelDefinitionSyntax) {
127 if (typeof nameOrDef === 'string') {
128 nameOrDef = {name: nameOrDef};
129 }
130 const {name, properties, settings, relations} = nameOrDef;
131
132 this.name = name;
133
134 this.properties = {};
135 if (properties) {
136 for (const p in properties) {
137 this.addProperty(p, properties[p]);
138 }
139 }
140
141 this.settings = settings ?? new Map();
142 this.relations = relations ?? {};
143 }
144
145 /**
146 * Add a property

Callers

nothing calls this directly

Calls 1

addPropertyMethod · 0.95

Tested by

no test coverage detected