New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pretify-deep-diff

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pretify-deep-diff

A utility to prettify the results of deep-diff with emojis and localization support.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
0
Created
Source

pretify-deep-diff

A utility to prettify the results of deep-diff with emojis and localization support.

Installation

To install the package, use npm:

npm install pretify-deep-diff

Usage

Here's an example of how to use pretify-deep-diff:

const diff = require('deep-diff');
const pretifyDeepDiff = require('pretify-deep-diff');

const lhs = {
    name: 'John',
    age: 30,
    pets: ['dog', 'cat'],
    address: {
        city: 'Chicago',
        street: 'Main St'
    }
};

const rhs = {
    name: 'Jane',
    age: 31,
    pets: ['dog', 'parrot'],
    city: 'New York'
};

const changes = diff(lhs, rhs);

console.log(pretifyDeepDiff(changes, { locale: 'ru' }));

Output

 Добавлено:
➕ Добавлено: city = "New York"

❌ Удалено:
❌ Удалено: address

✏️ Изменено:
✏️ Изменено: name с "John" на "Jane"
✏️ Изменено: age с 30 на 31
✏️ Изменено: pets.1 с "cat" на "parrot"

Options

  • locale: Specify the locale (en or ru). Default is en.
  • customTexts: An object to customize text templates.

Localization

The library supports localization through JSON files in the locales directory.

Keywords

deep-diff

FAQs

Package last updated on 21 Jun 2024

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