Skip to content

Commit e91a82e

Browse files
committed
template literal string coercion
1 parent 904bd8f commit e91a82e

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/client/sidebar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function preventDoubleClick(event) {
2323
}
2424

2525
function persistOpen() {
26-
sessionStorage.setItem(`observablehq-sidebar:${this.firstElementChild.textContent}`, String(this.open));
26+
sessionStorage.setItem(`observablehq-sidebar:${this.firstElementChild.textContent}`, this.open);
2727
}
2828

2929
for (const summary of document.querySelectorAll("#observablehq-sidebar summary")) {

src/client/stdlib/databaseClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function registerDatabase(name, token) {
77

88
export function DatabaseClient(name) {
99
if (new.target !== undefined) throw new TypeError("DatabaseClient is not a constructor");
10-
const token = databases.get((name += ""));
10+
const token = databases.get((name = `${name}`));
1111
if (!token) throw new Error(`Database not found: ${name}`);
1212
return new DatabaseClientImpl(name, token);
1313
}

src/client/stdlib/duckdb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ function getArrowFieldSchema(field) {
345345
name: field.name,
346346
type: getArrowType(field.type),
347347
nullable: field.nullable,
348-
databaseType: String(field.type)
348+
databaseType: `${field.type}`
349349
};
350350
}
351351

src/client/stdlib/fileAttachment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function registerFile(name, file) {
77

88
export function FileAttachment(name) {
99
if (new.target !== undefined) throw new TypeError("FileAttachment is not a constructor");
10-
const file = files.get((name += ""));
10+
const file = files.get((name = `${name}`));
1111
if (!file) throw new Error(`File not found: ${name}`);
1212
const {url, mimeType} = file;
1313
return new FileAttachmentImpl(url, name, mimeType);
@@ -103,7 +103,7 @@ class ZipArchive {
103103
this.filenames = Object.keys(archive.files).filter((name) => !archive.files[name].dir);
104104
}
105105
file(path) {
106-
const object = this._.file((path += ""));
106+
const object = this._.file((path = `${path}`));
107107
if (!object || object.dir) throw new Error(`file not found: ${path}`);
108108
return new ZipArchiveEntry(object);
109109
}

src/client/stdlib/xslx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class Workbook {
1717
}
1818
sheet(name, options) {
1919
const sname =
20-
typeof name === "number" ? this.sheetNames[name] : this.sheetNames.includes((name += "")) ? name : null;
20+
typeof name === "number" ? this.sheetNames[name] : this.sheetNames.includes((name = `${name}`)) ? name : null;
2121
if (sname == null) throw new Error(`Sheet not found: ${name}`);
2222
const sheet = this._.getWorksheet(sname);
2323
return extract(sheet, options);
@@ -76,7 +76,7 @@ function richText(value) {
7676
}
7777

7878
function parseRange(specifier = ":", {columnCount, rowCount}) {
79-
specifier += "";
79+
specifier = `${specifier}`;
8080
if (!specifier.match(/^[A-Z]*\d*:[A-Z]*\d*$/)) throw new Error("Malformed range specifier");
8181
const [[c0 = 0, r0 = 0], [c1 = columnCount - 1, r1 = rowCount - 1]] = specifier.split(":").map(fromCellReference);
8282
return [

0 commit comments

Comments
 (0)