deep-stub-object
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -5,14 +5,14 @@ export function deepStub(target, message) { | ||
get(record, prop) { | ||
var _a; | ||
const nextPath = [...path, prop]; | ||
return typeof record[prop] === 'function' | ||
? record[prop] | ||
: iter(record[prop] ?? | ||
(() => { | ||
throw new Error(message(nextPath)); | ||
}), nextPath); | ||
: iter((_a = record[prop]) !== null && _a !== void 0 ? _a : (() => { | ||
throw new Error(message(nextPath)); | ||
}), nextPath); | ||
} | ||
}); | ||
}; | ||
return iter((target ?? {})); | ||
return iter((target !== null && target !== void 0 ? target : {})); | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "deep-stub-object", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Proxy-backed custom error message instead of `TypeError: x is undefined`", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
# deep-stub-object | ||
[![npm version](https://badge.fury.io/js/deep-stub-object.svg?t=1495378566925)](https://badge.fury.io/js/deep-stub-object) | ||
[![npm](https://img.shields.io/npm/v/deep-stub-object)](https://npm.im/deep-stub-object) | ||
[![CircleCI](https://circleci.com/gh/iyegoroff/deep-stub-object.svg?style=svg)](https://circleci.com/gh/iyegoroff/deep-stub-object) | ||
[![codecov](https://codecov.io/gh/iyegoroff/deep-stub-object/branch/master/graph/badge.svg?t=1520230083925)](https://codecov.io/gh/iyegoroff/deep-stub-object) | ||
[![Dependency Status](https://david-dm.org/iyegoroff/deep-stub-object.svg?t=1495378566925)](https://david-dm.org/iyegoroff/deep-stub-object) | ||
[![devDependencies Status](https://david-dm.org/iyegoroff/deep-stub-object/dev-status.svg)](https://david-dm.org/iyegoroff/deep-stub-object?type=dev) | ||
[![codecov](https://codecov.io/gh/iyegoroff/deep-stub-object/branch/main/graph/badge.svg?t=1520230083925)](https://codecov.io/gh/iyegoroff/deep-stub-object) | ||
![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/deep-stub-object) | ||
[![Bundlephobia](https://badgen.net/bundlephobia/minzip/deep-stub-object?label=min+gzip)](https://bundlephobia.com/package/deep-stub-object@3) | ||
[![npm](https://img.shields.io/npm/l/deep-stub-object.svg?t=1495378566925)](https://www.npmjs.com/package/deep-stub-object) | ||
@@ -9,0 +9,0 @@ |
Sorry, the diff of this file is not supported yet
10857