Skip to content

Commit 13705b3

Browse files
committed
fix: replace lodash with native functions in import-notebook
1 parent 0527985 commit 13705b3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/import-notebook.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { TextEditor, Grammar } from "atom";
22
import * as path from "path";
33
import { promises } from "fs";
44
const { readFile } = promises;
5-
import _ from "lodash";
65
import type { HydrogenCellType } from "./hydrogen";
76

87
import { remote } from "electron";
@@ -42,7 +41,7 @@ export function ipynbOpener(uri: string) {
4241
*/
4342
export function importNotebook(event?: CustomEvent) {
4443
// Use selected filepath if called from tree-view context menu
45-
const filenameFromTreeView = _.get(event, "target.dataset.path");
44+
const filenameFromTreeView = event.target.dataset?.path;
4645

4746
if (filenameFromTreeView && path.extname(filenameFromTreeView) === ".ipynb") {
4847
return _loadNotebook(
@@ -265,8 +264,8 @@ function getGrammarForFileExtension(ext: string): Grammar | null | undefined {
265264
}
266265
ext = ext.startsWith(".") ? ext.slice(1) : ext;
267266
const grammars = atom.grammars.getGrammars();
268-
return _.find(grammars, (grammar) => {
269-
return _.includes(grammar.fileTypes, ext);
267+
return grammars.find((grammar) => {
268+
return grammar.fileTypes.includes(ext);
270269
});
271270
}
272271

0 commit comments

Comments
 (0)