MCPcopy
hub / github.com/axios/axios / reduceDescriptors

Function reduceDescriptors

lib/utils.js:738–750  ·  view source on GitHub ↗
(obj, reducer)

Source from the content-addressed store, hash-verified

736const isRegExp = kindOfTest('RegExp');
737
738const reduceDescriptors = (obj, reducer) => {
739 const descriptors = Object.getOwnPropertyDescriptors(obj);
740 const reducedDescriptors = {};
741
742 forEach(descriptors, (descriptor, name) => {
743 let ret;
744 if ((ret = reducer(descriptor, name, obj)) !== false) {
745 reducedDescriptors[name] = ret || descriptor;
746 }
747 });
748
749 Object.defineProperties(obj, reducedDescriptors);
750};
751
752/**
753 * Makes all methods read-only

Callers 1

freezeMethodsFunction · 0.85

Calls 1

forEachFunction · 0.85

Tested by

no test coverage detected