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

Function set

static/vuejs/vue.esm.js:876–901  ·  view source on GitHub ↗

* Set a property on an object. Adds the new property and * triggers change notification if the property doesn't * already exist.

(target, key, val)

Source from the content-addressed store, hash-verified

874 * already exist.
875 */
876function set (target, key, val) {
877 if (Array.isArray(target) && typeof key === 'number') {
878 target.length = Math.max(target.length, key);
879 target.splice(key, 1, val);
880 return val
881 }
882 if (hasOwn(target, key)) {
883 target[key] = val;
884 return val
885 }
886 var ob = (target ).__ob__;
887 if (target._isVue || (ob && ob.vmCount)) {
888 process.env.NODE_ENV !== 'production' && warn(
889 'Avoid adding reactive properties to a Vue instance or its root $data ' +
890 'at runtime - declare it upfront in the data option.'
891 );
892 return val
893 }
894 if (!ob) {
895 target[key] = val;
896 return val
897 }
898 defineReactive$$1(ob.value, key, val);
899 ob.dep.notify();
900 return val
901}
902
903/**
904 * Delete a property and trigger change if necessary.

Callers 1

mergeDataFunction · 0.70

Calls 3

hasOwnFunction · 0.70
defineReactive$$1Function · 0.70
warnFunction · 0.50

Tested by

no test coverage detected