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

Function set

static/vuejs/vue.runtime.common.js:874–899  ·  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

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