@autoplay/utils
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -49,12 +49,18 @@ import { devStringify } from "./devStringify"; | ||
const stringSubs = this._subs.map((sub) => devStringify(sub, true)); | ||
return typeof this._templateOrID === "number" | ||
let display = typeof this._templateOrID === "number" | ||
? `#${this._templateOrID}: ${stringSubs.join("; ")}` // if dev calls are replaced with message identifiers (this is speculative) | ||
: String.raw(this._templateOrID, stringSubs); | ||
if (this._values) { | ||
if (this._values.cause) { | ||
display += "\n because: " + devStringify(this._values.cause); | ||
} | ||
if (this._values.records) { | ||
display += "\n records: " + devStringify(this._values.records); | ||
} | ||
} | ||
return display; | ||
} | ||
// Notice that `"" + {toString() { return 1}} === "1"` | ||
toString() { | ||
const stringSubs = this._subs.map((sub) => devStringify(sub)); | ||
return typeof this._templateOrID === "number" | ||
? `#${this._templateOrID}: ${stringSubs.join("; ")}` // if dev calls are replaced with message identifiers (this is speculative) | ||
: String.raw(this._templateOrID, stringSubs); | ||
return this.toDisplay(); | ||
} | ||
@@ -61,0 +67,0 @@ toJSON(key) { |
{ | ||
"name": "@autoplay/utils", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Utilities designed for error management, parsing, and TypeScript domain modeling.", | ||
@@ -13,3 +13,4 @@ "keywords": [], | ||
"test": "jest", | ||
"prepare": "npm run clean && npm run build" | ||
"prepare": "npm run clean && npm run build", | ||
"prepack": "npm run prepare" | ||
}, | ||
@@ -16,0 +17,0 @@ "files": [ |
@@ -18,3 +18,5 @@ import { devStringify } from "./devStringify"; | ||
public readonly _subs: any[], | ||
public _values: undefined | { cause?: DevString | DevString[] | undefined; records?: Record<string, unknown> } = undefined, | ||
public _values: | ||
| undefined | ||
| { cause?: DevString | DevString[] | undefined; records?: Record<string, unknown> } = undefined, | ||
) {} | ||
@@ -57,5 +59,15 @@ | ||
const stringSubs = this._subs.map((sub) => devStringify(sub, true)); | ||
return typeof this._templateOrID === "number" | ||
? `#${this._templateOrID}: ${stringSubs.join("; ")}` // if dev calls are replaced with message identifiers (this is speculative) | ||
: String.raw(this._templateOrID as TemplateStringsArray, stringSubs); | ||
let display = | ||
typeof this._templateOrID === "number" | ||
? `#${this._templateOrID}: ${stringSubs.join("; ")}` // if dev calls are replaced with message identifiers (this is speculative) | ||
: String.raw(this._templateOrID as TemplateStringsArray, stringSubs); | ||
if (this._values) { | ||
if (this._values.cause) { | ||
display += "\n because: " + devStringify(this._values.cause); | ||
} | ||
if (this._values.records) { | ||
display += "\n records: " + devStringify(this._values.records); | ||
} | ||
} | ||
return display; | ||
} | ||
@@ -65,6 +77,3 @@ | ||
toString() { | ||
const stringSubs = this._subs.map((sub) => devStringify(sub)); | ||
return typeof this._templateOrID === "number" | ||
? `#${this._templateOrID}: ${stringSubs.join("; ")}` // if dev calls are replaced with message identifiers (this is speculative) | ||
: String.raw(this._templateOrID as TemplateStringsArray, stringSubs); | ||
return this.toDisplay(); | ||
} | ||
@@ -71,0 +80,0 @@ |
Sorry, the diff of this file is not supported yet
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
83009
1713
0