MCPcopy
hub / github.com/webpack/webpack / method

Method method

lib/RuntimeTemplate.js:416–420  ·  view source on GitHub ↗

* Renders an object-literal method, using method shorthand when supported * and falling back to a `prop: function/arrow` property otherwise. * @param {string} prop property name (or computed key like `[x]`) * @param {string} args arguments * @param {string | string[]} body body * @returns

(prop, args, body)

Source from the content-addressed store, hash-verified

414 * @returns {string} method code
415 */
416 method(prop, args, body) {
417 return this.supportsMethodShorthand()
418 ? `${prop}(${args}) {\n${Template.indent(body)}\n}`
419 : `${prop}: ${this.basicFunction(args, body)}`;
420 }
421
422 /**
423 * Returns an own-property check, using `Object.hasOwn` when supported and

Callers 3

generateMethod · 0.45
generateMethod · 0.45
generateMethod · 0.45

Calls 3

basicFunctionMethod · 0.95
indentMethod · 0.80

Tested by

no test coverage detected