# @workaja/omly

> small utility for do omit and only functions for non-ts programming language

Latest version **1.0.0** (published 2021-08-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install @workaja/omly
pnpm add @workaja/omly
yarn add @workaja/omly
bun add @workaja/omly
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-08-18 |
| First published | 2021-08-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | workaja |
| Maintainers | rixki |
| Keywords | omit, only, js |

## Links

- npm: https://www.npmjs.com/package/@workaja/omly
- Repository: https://github.com/Workaja/Omly
- Homepage: https://github.com/Workaja/Omly#readme
- Issues: https://github.com/Workaja/Omly/issues
- npm.io page: https://npm.io/package/@workaja/omly

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-08-18

## README

# Omly

Omly is concat between omit and only, a small functions that pick or remove specific notation of object. Basically this is already existed on Typescript, but because I don't use it, and I very like it... so I made omly to help my journey. Feel free to use it.

## Omit

You can use this function for remove notation based on provided array or string
```javascript
const { Omit } = require("omly")

const base = {
    name: 'Rizkiansyah',
    age: 35,
    feature: 'tall'
}

console.log(Omit(base, ['feature', 'age']))
// this return => { name: 'Rizkiansyah' }

console.log(Omit(base, ['age']))
// this return => { name: 'Rizkiansyah', feature: 'tall' }

console.log(Omit(base, ['name', 'age', 'feature']))
// this return => { }

console.log(Omit(base, 'name'))
// this return => { feature: 'tall', age: 35 }
```

## Only

You can use this function to keep selected notation based on provided array or string
```javascript
const { Only } = require("omly")

const base = {
    name: 'Rizkiansyah',
    age: 35,
    feature: 'tall'
}

console.log(Only(base, ['feature', 'age']))
// this return => { age: 35, feature: 'tall' }

console.log(Only(base, ['age']))
// this return => { age: 35 }

console.log(Only(base, ['name', 'age', 'feature']))
// this return => { name: 'Rizkiansyah', age: 35, feature: 'tall' }

console.log(Only(base, 'name'))
// this return => { name: 'Rizkiansyah' }
```

### Difference between Array and String
The array can remove/keep multiple notation, whilst the string only target for single notation

### Related to Typescript 
Why not using omit style on Typescript ? `Omit<base, "name || age">` especially the "string"... well basically it's just small function for me, to gain more advanced feature like that, I encourage you to learn or use Typescript, thought it's great feature too

### Capability
This small function, Omit or Only is capable to scan one layer of object
```javascript
const alternative = {
    anime: ['one punch man', 'junji ito collection'],
    movie: 'spirited away',
    other: 'studio ghibli'
}

// on above object, the Omit and Only capable to keep or remove
// one of the three notation, but on multiple layers of notation like this...

const alternative = {
    anime: ['one punch man', 'junji ito collection'],
    movie: 'spirited away',
    other: {
        studio: 'ghibli',
        game: 'mobile legends',
        laptop: [
            'msi alpha 15',
            'lenovo legion 15'
        ]
    }
}

// Omit and Only capable to keep or remove the first layer which are
// `anime`, `movie` and `other` notation, whilst if trying to remove
// specific notation inside `other` notation like `studio` or `laptop`
// it's will failed, though will processing the other notation that found
```

---
_Source: https://npm.io/package/@workaja/omly · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
