Socket
Book a DemoInstallSign in
Socket

schob

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

schob

Rewrite the new object according to the schema. Delete the excess.

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
18
157.14%
Maintainers
1
Weekly downloads
 
Created
Source

Schob

Schob

Installation

pnpm add @huntersofbook/schob

Usage

import { merge } from '@huntersofbook/schob'

const schema = {
  isPro: false,
  darkMode: false,
  pages: {
    home: false,
    settings: false,
  },
}

const newData = {
  isPro: false,
  darkMode: true,
  pages: {
    home: false,
    settings: true,
    hello: false,
  },
  dd: 'dd',
  tt: {
    dd: 'dd',
  },
  cc: [{ dd: 'dd' }],
}

const res = merge({ schema, newData })

Output


{
    isPro: false,
    darkMode: true,
    pages: { home: false, settings: true },
 }

Sponsors

sponsors

License

MIT License © 2022-PRESENT productdevbook

Keywords

schema

FAQs

Package last updated on 21 May 2023

Did you know?

Socket

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