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

Function set

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

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