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

Function genAssignmentCode

static/vuejs/vue.common.js:5579–5592  ·  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

5577 * Cross-platform codegen helper for generating v-model value assignment code.
5578 */
5579function genAssignmentCode (
5580 value,
5581 assignment
5582) {
5583 var modelRs = parseModel(value);
5584 if (modelRs.idx === null) {
5585 return (value + "=" + assignment)
5586 } else {
5587 return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
5588 "if (!Array.isArray($$exp)){" +
5589 value + "=" + assignment + "}" +
5590 "else{$$exp.splice($$idx, 1, " + assignment + ")}"
5591 }
5592}
5593
5594/**
5595 * 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