UNPKG

@resourge/react-fetch

Version:

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

40 lines (37 loc) 1 kB
/** * react-fetch v1.41.3 * * Copyright (c) resourge. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import { isBuiltinWithMutableMethods } from './utils'; function createProxy(target, state, isRecursive = false) { var _state$state; state.state = (_state$state = state.state) != null ? _state$state : { keys: new Set(), all: false }; return new Proxy(target, { get(target, key) { const value = target[key]; if (!isRecursive && key !== 'filter') { return value; } state.keys.add(String(key)); if (typeof value === 'object' && value !== null && !isBuiltinWithMutableMethods(value)) { return createProxy(value, state.state, true); } return value; }, ownKeys(target) { state.all = true; return Reflect.ownKeys(target); } }); } export { createProxy }; //# sourceMappingURL=createProxy.js.map