Skip to content

Commit

Permalink
chore: change log style
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZillaGold committed May 8, 2021
1 parent f6c88d0 commit e2a1355
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 97 deletions.
125 changes: 29 additions & 96 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rawjsonbuilder",
"version": "1.1.15",
"version": "1.1.16",
"description": "Minecraft Raw JSON text builder",
"main": "./lib/RawJSONBuilder.js",
"types": "./lib/interfaces.d.ts",
Expand All @@ -27,9 +27,11 @@
"url": "https://github.com/MrZillaGold/RawJSONBuilder/issues"
},
"dependencies": {
"inspectable": "^1.1.1",
"minecraft-protocol-chat-parser": "^3.0.2"
},
"devDependencies": {
"@types/node": "^15.0.2",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.17.0",
"eslint": "^7.22.0",
Expand Down
12 changes: 12 additions & 0 deletions src/RawJSONBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-ignore
import * as minecraftProtocolChatParser from "minecraft-protocol-chat-parser";
import { inspectable } from "inspectable";

import { IKeybind, ITranslate, IClickEvent, NBT, IText, IScore, ISelector, RawJSON, RawJSONBuilderOptions } from "./interfaces";

Expand Down Expand Up @@ -193,4 +194,15 @@ export class RawJSONBuilder {
this.toJSON()
);
}

[Symbol("serializeData")](): RawJSON {
return this.toJSON();
}
}

inspectable(RawJSONBuilder, {
serialize: (instance) => instance.toJSON(),
stringify: (instance, payload, context): string => (
`${context.stylize(instance.constructor.name, "special")} ${context.inspect(payload)}`
)
});

0 comments on commit e2a1355

Please sign in to comment.