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

Function genAssignmentCode

static/vuejs/vue.js:5573–5586  ·  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

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