npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@workaja/omly

v1.0.0

Published

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

Downloads

2

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

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

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

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