An open API service indexing awesome lists of open source software.

https://github.com/hejny/unundefined

Proxies an object so that non of the properties will be undefined.
https://github.com/hejny/unundefined

draft library

Last synced: 7 months ago
JSON representation

Proxies an object so that non of the properties will be undefined.

Awesome Lists containing this project

README

          

# 👻 Unundefined

[![NPM Version of Unundefined](https://badge.fury.io/js/unundefined.svg)](https://www.npmjs.com/package/unundefined)
[![Quality of package Unundefined](https://packagequality.com/shield/unundefined.svg)](https://packagequality.com/#?package=unundefined)
[![lint](https://github.com/hejny/unundefined/actions/workflows/lint.yml/badge.svg)](https://github.com/hejny/unundefined/actions/workflows/lint.yml)
[![test](https://github.com/hejny/unundefined/actions/workflows/test.yml/badge.svg)](https://github.com/hejny/unundefined/actions/workflows/test.yml)
[![Known Vulnerabilities](https://snyk.io/test/github/hejny/unundefined/badge.svg)](https://snyk.io/test/github/hejny/unundefined)
[![Issues](https://img.shields.io/github/issues/hejny/unundefined.svg?style=flat)](https://github.com/hejny/unundefined/issues)
[![Socket](https://socket.dev/api/badge/npm/package/unundefined)](https://socket.dev/npm/package/unundefined)

Proxies an object so that non of the properties will be undefined.

[![Wallpaper of 👻 Unundefined](assets/ai/wallpaper/gallery/0a64d1f9-79db-48cb-b789-6253491840eb-0_0.png)](https://www.midjourney.com/app/jobs/0a64d1f9-79db-48cb-b789-6253491840eb)

## Usage

```bash
npm i unundefined
```

```typescript
import { unundefined } from 'unundefined';

const fakeWindow = unundefined(window);

console.log(fakeWindow.contains.everything.you.want);
console.log(fakeWindow.alert /* ... but also existing stuff as usual */);
```

_See more examples in [simple tests](./src/unundefined.test.ts)._

## 🖋️ Contributing

I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [☕ buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).

You can also ⭐ star the unundefined package, [follow me on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).

## ✨ Partners

Collboard
     
WebGPT
     
Promptbook

[Become a partner](https://www.pavolhejny.com/contact/)