Socket
Socket
Sign inDemoInstall

minobjs

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    minobjs

minimal object manipulation


Version published
Maintainers
1
Created

Readme

Source

minobjs

minimal object manipulation

Contents

For now, the current implementation supports isEmpty and merge functions over objects

export interface IObjs {
  merge(...items: any[]): any;

  isEmpty(obj: any): boolean;
}

Example

loading the module

const { Objs } = require("minobjs");

// initialization
const obj = new Objs();

isEmpty


// previous initialization

// checks if an object is empty
console.log(obj.isEmpty({}));
// outputs: true
console.log(obj.isEmpty({ a: 1 }));
// outputs: false

merge


// previous initialization

const obj1 = {
  a: 1,
  b: 2,
  c: {
    a: 1,
    b: 2,
    c: {
      d: 1,
      e: 2
    }
  }
};

const obj2 = {
  a: 1,
  b: 3,
  c: {
    a: 1,
    b: 2,
    c: {
      d: 1,
      e: 3
    }
  }
};

const obj3 = {
  e: 7
};

const obj4 = {
  e: 8,
  f: 1
};

const result = obj.merge(obj1, obj2, obj3, obj4);
console.log(result);
// outputs { a: 1, b: 3, c: { a: 1, b: 2, c: { d: 1, e: 3 } }, e: 8, f: 1 }

Instalation

yarn add minobjs
# or
npm install minobjs

Keywords

FAQs

Last updated on 09 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc