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

Function genCheckboxModel

static/vuejs/vue.esm.js:5744–5773  ·  view source on GitHub ↗
(
  el,
  value,
  modifiers
)

Source from the content-addressed store, hash-verified

5742}
5743
5744function genCheckboxModel (
5745 el,
5746 value,
5747 modifiers
5748) {
5749 var number = modifiers && modifiers.number;
5750 var valueBinding = getBindingAttr(el, 'value') || 'null';
5751 var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
5752 var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
5753 addProp(el, 'checked',
5754 "Array.isArray(" + value + ")" +
5755 "?_i(" + value + "," + valueBinding + ")>-1" + (
5756 trueValueBinding === 'true'
5757 ? (":(" + value + ")")
5758 : (":_q(" + value + "," + trueValueBinding + ")")
5759 )
5760 );
5761 addHandler(el, CHECKBOX_RADIO_TOKEN,
5762 "var $$a=" + value + "," +
5763 '$$el=$event.target,' +
5764 "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
5765 'if(Array.isArray($$a)){' +
5766 "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
5767 '$$i=_i($$a,$$v);' +
5768 "if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
5769 "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
5770 "}else{" + value + "=$$c}",
5771 null, true
5772 );
5773}
5774
5775function genRadioModel (
5776 el,

Callers 1

modelFunction · 0.70

Calls 3

getBindingAttrFunction · 0.70
addPropFunction · 0.70
addHandlerFunction · 0.70

Tested by

no test coverage detected