File tree Expand file tree Collapse file tree 4 files changed +49
-53
lines changed Expand file tree Collapse file tree 4 files changed +49
-53
lines changed Original file line number Diff line number Diff line change 1-
21# pretify-deep-diff
32
43A utility to prettify the results of ` deep-diff ` with emojis and localization support.
@@ -16,40 +15,38 @@ npm install pretify-deep-diff
1615Here's an example of how to use ` pretify-deep-diff ` :
1716
1817``` javascript
19- const diff = require (' deep-diff' );
20- const pretifyDeepDiff = require (' pretify-deep-diff' );
18+ const diff = require (" deep-diff" );
19+ const pretifyDeepDiff = require (" pretify-deep-diff" );
2120
2221const lhs = {
23- name: ' John' ,
24- age: 30 ,
25- pets: [' dog' , ' cat' ],
26- address: {
27- city: ' Chicago' ,
28- street: ' Main St'
29- }
22+ name: " John" ,
23+ age: 30 ,
24+ pets: [" dog" , " cat" ],
25+ address: {
26+ city: " Chicago" ,
27+ street: " Main St" ,
28+ },
3029};
3130
3231const rhs = {
33- name: ' Jane' ,
34- age: 31 ,
35- pets: [' dog' , ' parrot' ],
36- city: ' New York'
32+ name: " Jane" ,
33+ age: 31 ,
34+ pets: [" dog" , " parrot" ],
35+ city: " New York" ,
3736};
3837
3938const changes = diff (lhs, rhs);
4039
41- console .log (pretifyDeepDiff (changes, { locale: ' ru ' }));
40+ console .log (pretifyDeepDiff (changes, { locale: " ru " }));
4241```
4342
4443### Output
4544
4645``` text
4746 Добавлено:
4847➕ Добавлено: city = "New York"
49-
5048❌ Удалено:
5149❌ Удалено: address
52-
5350✏️ Изменено:
5451✏️ Изменено: name с "John" на "Jane"
5552✏️ Изменено: age с 30 на 31
Original file line number Diff line number Diff line change 1- declare module ' pretify-deep-diff' {
2- interface Options {
3- locale ?: 'en' | 'ru' ;
4- customTexts ?: {
5- added ?: string ;
6- deleted ?: string ;
7- edited ?: string ;
8- arrayChange ?: string ;
9- addedTitle ?: string ;
10- deletedTitle ?: string ;
11- editedTitle ?: string ;
12- arrayChangeTitle ?: string ;
13- } ;
14- }
1+ declare module "@mincho-js/ pretify-deep-diff" {
2+ interface Options {
3+ locale ?: "en" | "ru" ;
4+ customTexts ?: {
5+ added ?: string ;
6+ deleted ?: string ;
7+ edited ?: string ;
8+ arrayChange ?: string ;
9+ addedTitle ?: string ;
10+ deletedTitle ?: string ;
11+ editedTitle ?: string ;
12+ arrayChangeTitle ?: string ;
13+ } ;
14+ }
1515
16- interface Change {
17- kind : 'N' | 'D' | 'E' | 'A' ;
18- path ?: ( string | number ) [ ] ;
19- lhs ?: any ;
20- rhs ?: any ;
21- index ?: number ;
22- item ?: Change ;
23- }
16+ interface Change {
17+ kind : "N" | "D" | "E" | "A" ;
18+ path ?: ( string | number ) [ ] ;
19+ lhs ?: any ;
20+ rhs ?: any ;
21+ index ?: number ;
22+ item ?: Change ;
23+ }
2424
25- function pretifyDeepDiff ( changes : Change [ ] , options ?: Options ) : string ;
25+ function pretifyDeepDiff ( changes : Change [ ] , options ?: Options ) : string ;
2626
27- export = pretifyDeepDiff ;
28- }
27+ export = pretifyDeepDiff ;
28+ }
Original file line number Diff line number Diff line change 11{
2- "name" : " pretify-deep-diff" ,
3- "version" : " 1.0.1 " ,
2+ "name" : " @mincho-js/ pretify-deep-diff" ,
3+ "version" : " 1.0.5 " ,
44 "description" : " A utility to prettify the results of deep-diff with emojis and localization support." ,
55 "main" : " index.js" ,
66 "types" : " index.d.ts" ,
77 "scripts" : {
88 "test" : " node test.js"
99 },
10-
1110 "dependencies" : {
1211 "deep-diff" : " ^1.0.2" ,
13- "pretify-deep-diff" : " ^1.0.0 "
12+ "@mincho-js/ pretify-deep-diff" : " ^1.0.5 "
1413 },
1514 "repository" : {
1615 "type" : " git" ,
17- "url" : " git+https://github.com/whoekage /pretify-deep-diff.git"
16+ "url" : " git+https://github.com/mincho-js /pretify-deep-diff.git"
1817 },
1918 "keywords" : [
2019 " deep-diff" ,
2726 "author" : " sharkaev.ph@gmail.com" ,
2827 "license" : " MIT" ,
2928 "bugs" : {
30- "url" : " https://github.com/whoekage /pretify-deep-diff/issues"
29+ "url" : " https://github.com/mincho-js /pretify-deep-diff/issues"
3130 },
32- "homepage" : " https://github.com/whoekage /pretify-deep-diff#readme"
31+ "homepage" : " https://github.com/mincho-js /pretify-deep-diff#readme"
3332}
You can’t perform that action at this time.
0 commit comments