Skip to content

Commit 9ab151e

Browse files
committed
Migrate to ESM, upgrade deps
1 parent d92c4c9 commit 9ab151e

File tree

7 files changed

+6939
-50
lines changed

7 files changed

+6939
-50
lines changed

example/example.js

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,6 @@ Hello!
2828
![](asdf)
2929
`;
3030

31-
/**
32-
* @typedef {Object} Section
33-
* @prop {string} header
34-
* @prop {any[]} range
35-
*/
36-
37-
/**
38-
* @returns {Section[]}
39-
*/
40-
const getSections = (allChildren, headerIndexes) =>
41-
headerIndexes.map((_, i, array) => {
42-
let [startIndex, endIndex] = [array[i], array[i + 1]];
43-
const header = allChildren[startIndex];
44-
startIndex += 1;
45-
46-
return {
47-
header,
48-
range: allChildren.slice(startIndex, endIndex)
49-
};
50-
});
51-
5231
// Create a plugin for remark
5332
const plugin = () => (tree) => {
5433
// `start` and `end` nodes to look for, and find between.
@@ -68,9 +47,9 @@ const plugin = () => (tree) => {
6847
list.shift();
6948
list.pop();
7049

71-
for (let node of list) {
72-
for (let child of node.children) {
73-
child.value = child.value + "! This is cool!"
50+
for (const node of list) {
51+
for (const child of node.children) {
52+
child.value += '! This is cool!';
7453
}
7554
}
7655

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
'use strict';
2-
3-
const is = require('unist-util-is');
1+
import {is} from 'unist-util-is';
42

53
function replaceAllBetween(parent, start, end, func) {
64
if (!parent || !parent.type || !parent.children) {
@@ -82,4 +80,4 @@ function replaceAllBetween(parent, start, end, func) {
8280
return children;
8381
}
8482

85-
module.exports = replaceAllBetween;
83+
export default replaceAllBetween;

0 commit comments

Comments
 (0)