🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@arcanejs/toolkit-frontend

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

@arcanejs/toolkit-frontend

Library of the frontend react components used to render the @arcanejs Toolkit

0.4.0
latest
Source
npm
Version published
Weekly downloads
3
-25%
Maintainers
1
Weekly downloads
 
Created
Source

@arcanejs/diff

NPM Version

This package provides an easy way to:

  • Create diffs by comparing objects
  • Update objects by applying diffs

This library is written in TypeScript, and produces diffs that are type-safe, and can only be applied to objects that match the type of the objects being compared.

This package is part of the arcanejs project, and is used to maintain a copy of a JSON tree in downstream clients in real-time via websockets.

Usage

import { diffJson, Diff } from '@arcanejs/diff/diff';
import { patchJson } from '@arcanejs/diff/patch';

type E = {
  foo: string;
  bar?: number[];
};

const a: E = { foo: 'bar' };
const b: E = { foo: 'baz', bar: [1] };

const diffA: Diff<E> = diffJson(a, b);

const resultA = patchJson(a, diffA);

console.log(resultB); // { foo: 'baz', bar: [1] }

const c = { baz: 'foo' };

const resultB = patchJson(c, diffA); // TypeScript Type Error: Property 'baz' is missing in type '{ foo: string; bar?: number[] | undefined; }' but required in type '{ baz: string; }'

FAQs

Package last updated on 17 Feb 2025

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