@jace.dev/exceptjs

2.0.0 • Public • Published

EXCEPT JS

A simple script that adds a function to objects to help with key filtering.

Installation

# NPM
npm i @jace.dev/exceptjs 

# YARN
yarn add @jace.dev/exceptjs 

# PNMP
pnpm i @jace.dev/exceptjs

Examples:

<!-- BASIC HTML  -->
<script src="https://raw.githubusercontent.com/Jace-Tech/except-js/main/except.js"></script>

<script>     
    const obj1 = { name: "foo",  age: 20, city: "bar" }

    console.log(obj1.except('name')) 
    // output: { age: 20, city: "bar" }

    console.log(obj1.except(['name'])) 
    // output: { age: 20, city: "bar" }

    console.log(obj1.except('name', 'age')) 
    // output: { city: 'bar' }

    console.log(obj1.except(['name', 'age'])) 
    // output: { city: 'bar' }


    const user = { name: "John Smith", age: 45, email: "john.smith@gmail.com", password: "password"}
    console.log(user.except('password'))
    // output: { name: "John Smith", age: 45, email: "john.smith@gmail.com" }
</script>
// NODE JS  

    require("@jace.dev/exceptjs")

    const obj1 = { name: "foo",  age: 20, city: "bar" }

    console.log(obj1.except('name')) 
    // output: { age: 20, city: "bar" }

    console.log(obj1.except(['name'])) 
    // output: { age: 20, city: "bar" }

    console.log(obj1.except('name', 'age')) 
    // output: { city: 'bar' }

    console.log(obj1.except(['name', 'age'])) 
    // output: { city: 'bar' }


    const user = { name: "John Smith", age: 45, email: "john.smith@gmail.com", password: "password"}
    console.log(user.except('password'))
    // output: { name: "John Smith", age: 45, email: "john.smith@gmail.com" }

Package Sidebar

Install

npm i @jace.dev/exceptjs

Weekly Downloads

66

Version

2.0.0

License

MIT

Unpacked Size

5.8 kB

Total Files

6

Last publish

Collaborators

  • jace.dev