diff --git a/package-lock.json b/package-lock.json
index 755aa4d..ff494b9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "angular2-prettyjson",
- "version": "3.0.7",
+ "version": "3.0.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "angular2-prettyjson",
- "version": "3.0.7",
+ "version": "3.0.8",
"dependencies": {
"@angular/animations": "18.2.14",
"@angular/common": "18.2.14",
diff --git a/package.json b/package.json
index 3a24fae..d2ea76e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "angular2-prettyjson",
- "version": "3.0.7",
+ "version": "3.0.8",
"scripts": {
"ng": "ng",
"build": "npm-run-all -s clean:build build:prod",
diff --git a/projects/angular2-prettyjson/package.json b/projects/angular2-prettyjson/package.json
index 1a15663..24c83dc 100644
--- a/projects/angular2-prettyjson/package.json
+++ b/projects/angular2-prettyjson/package.json
@@ -2,7 +2,7 @@
"name": "@talentia/angular2-prettyjson",
"title": "Angular Pretty JSON",
"description": "An Angular module to pretty print JSON objects.",
- "version": "3.0.7",
+ "version": "3.0.8",
"license": "MIT",
"licenseFilename": "LICENSE",
"peerDependencies": {
diff --git a/projects/angular2-prettyjson/src/lib/json-utils.ts b/projects/angular2-prettyjson/src/lib/json-utils.ts
index 7b84e58..4288482 100644
--- a/projects/angular2-prettyjson/src/lib/json-utils.ts
+++ b/projects/angular2-prettyjson/src/lib/json-utils.ts
@@ -3,14 +3,14 @@ export function serializer() {
const stack: any[] = [];
const keys: string[] = [];
- const cycleReplacer = function(key: string, value: any) {
+ const cycleReplacer = function (key: string, value: any) {
if (stack[0] === value) {
return "[Circular ~]";
}
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
};
- return function(this: any, key: string, value: any) {
+ return function (this: any, key: string, value: any) {
if (stack.length > 0) {
const thisPos = stack.indexOf(this);
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
diff --git a/projects/angular2-prettyjson/src/lib/prettyjson.component.ts b/projects/angular2-prettyjson/src/lib/prettyjson.component.ts
index 01ee5f6..79b7e94 100644
--- a/projects/angular2-prettyjson/src/lib/prettyjson.component.ts
+++ b/projects/angular2-prettyjson/src/lib/prettyjson.component.ts
@@ -1,4 +1,4 @@
-import {Component, Input} from "@angular/core";
+import { Component, Input } from "@angular/core";
@Component({
standalone: false,
diff --git a/projects/angular2-prettyjson/src/lib/prettyjson.module.ts b/projects/angular2-prettyjson/src/lib/prettyjson.module.ts
index b090fce..5dfc1e8 100644
--- a/projects/angular2-prettyjson/src/lib/prettyjson.module.ts
+++ b/projects/angular2-prettyjson/src/lib/prettyjson.module.ts
@@ -5,18 +5,16 @@ import { PrettyJsonPipe } from './prettyjson.pipe';
import { PrettyJsonComponent } from './prettyjson.component';
@NgModule({
- imports: [ CommonModule ],
- declarations: [
+ imports: [CommonModule],
+ declarations: [
PrettyJsonPipe,
SafeJsonPipe,
PrettyJsonComponent
- ],
- exports: [
+ ],
+ exports: [
PrettyJsonPipe,
SafeJsonPipe,
PrettyJsonComponent
- ]
+ ]
})
-export class PrettyJsonModule {
-
-}
+export class PrettyJsonModule { }
diff --git a/projects/angular2-prettyjson/src/lib/prettyjson.pipe.ts b/projects/angular2-prettyjson/src/lib/prettyjson.pipe.ts
index b3322d6..3e6d0c0 100644
--- a/projects/angular2-prettyjson/src/lib/prettyjson.pipe.ts
+++ b/projects/angular2-prettyjson/src/lib/prettyjson.pipe.ts
@@ -1,4 +1,4 @@
-import {Pipe, PipeTransform} from "@angular/core";
+import { Pipe, PipeTransform } from "@angular/core";
import { serializer as circularSerializer } from './json-utils';
@Pipe({
@@ -13,7 +13,7 @@ export class PrettyJsonPipe implements PipeTransform {
private _syntaxHighlight(json: any, serializer: any, spacing: number): string {
if (json === undefined) {
- return '';
+ return '';
}
// Credits to the accepted answer here
// http://stackoverflow.com/questions/4810841/how-can-i-pretty-print-json-using-javascript
@@ -22,19 +22,19 @@ export class PrettyJsonPipe implements PipeTransform {
}
json = json.replace(/&/g, "&").replace(//g, ">");
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, (match: any) => {
- let cls = "number";
- if (/^"/.test(match)) {
- if (/:$/.test(match)) {
- cls = "key";
- } else {
- cls = "string";
- }
- } else if (/true|false/.test(match)) {
- cls = "boolean";
- } else if (/null/.test(match)) {
- cls = "null";
+ let cls = "number";
+ if (/^"/.test(match)) {
+ if (/:$/.test(match)) {
+ cls = "key";
+ } else {
+ cls = "string";
}
- return `${match}`;
+ } else if (/true|false/.test(match)) {
+ cls = "boolean";
+ } else if (/null/.test(match)) {
+ cls = "null";
+ }
+ return `${match}`;
});
}
}
diff --git a/projects/demo/src/app/app.module.ts b/projects/demo/src/app/app.module.ts
index 8b17ac0..912402f 100644
--- a/projects/demo/src/app/app.module.ts
+++ b/projects/demo/src/app/app.module.ts
@@ -13,7 +13,6 @@ import { PrettyJsonModule } from '@talentia/angular2-prettyjson';
AppRoutingModule,
PrettyJsonModule
],
- providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }