Skip to content

Commit

Permalink
Remove .at() polyfill for old versions of js
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Jan 25, 2024
1 parent c81d001 commit 11dad77
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/pretty-print-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const prettyPrintJson = {

toHtml(data: unknown, options?: FormatOptions): string {
// Converts an object or primitive into an HTML string suitable for rendering.
if (!''.at) String.prototype.at = function(i) { return this.charAt(i + (i < 0 ? this.length : 0)); } //polyfill to support older versions of Electron
const deprecatedTrailingComma = options?.[<keyof FormatOptions>'trailingComma']; //option renamed to trailingCommas
if (deprecatedTrailingComma !== undefined) options!.trailingCommas = <boolean>deprecatedTrailingComma; //backwards compatibility
if (deprecatedTrailingComma !== undefined) console.warn('pretty-print-json: Use "trailingCommas" option instead of "trailingComma".');
Expand Down

0 comments on commit 11dad77

Please sign in to comment.