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

Function set

static/vuejs/vue.runtime.js:878–903  ·  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

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