MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / result

Function result

modules/piu/All/piuAll.js:124–141  ·  view source on GitHub ↗
($, it1)

Source from the content-addressed store, hash-verified

122export function template(f) {
123 let constructor = this;
124 let result = function($, it1) {
125 let self = (this) ? this : Object.create(constructor.prototype);
126 let it = f.call(self, $, it1);
127 if (it1) {
128 let contents = null;
129 if ("contents" in it)
130 contents = it.contents;
131 for (let i in it1) {
132 if (contents && (i == "contents"))
133 contents = contents.concat(it1.contents);
134 else
135 it[i] = it1[i];
136 }
137 if (contents)
138 it.contents = contents;
139 }
140 return constructor.call(self, $, it);
141 }
142 result.prototype = this.prototype;
143 result.template = template;
144 return result;

Callers

nothing calls this directly

Calls 2

_createMethod · 0.80
concatMethod · 0.65

Tested by

no test coverage detected