MCPcopy Create free account
hub / github.com/TruthHun/BookStack / genAssignmentCode

Function genAssignmentCode

static/vuejs/vue.esm.js:5577–5590  ·  view source on GitHub ↗

* Cross-platform codegen helper for generating v-model value assignment code.

(
  value,
  assignment
)

Source from the content-addressed store, hash-verified

5575 * Cross-platform codegen helper for generating v-model value assignment code.
5576 */
5577function genAssignmentCode (
5578 value,
5579 assignment
5580) {
5581 var modelRs = parseModel(value);
5582 if (modelRs.idx === null) {
5583 return (value + "=" + assignment)
5584 } else {
5585 return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
5586 "if (!Array.isArray($$exp)){" +
5587 value + "=" + assignment + "}" +
5588 "else{$$exp.splice($$idx, 1, " + assignment + ")}"
5589 }
5590}
5591
5592/**
5593 * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)

Callers 4

genComponentModelFunction · 0.70
genRadioModelFunction · 0.70
genSelectFunction · 0.70
genDefaultModelFunction · 0.70

Calls 1

parseModelFunction · 0.70

Tested by

no test coverage detected