Skip to content

Commit 6998870

Browse files
author
Rik
authored
Merge pull request #5 from unicorn-utterances/master
Upgrade deps & migrate to ESM
2 parents 1200bf5 + 3c3a558 commit 6998870

File tree

5 files changed

+6658
-23
lines changed

5 files changed

+6658
-23
lines changed

example.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var remark = require('remark')
2-
var find = require('./index.js')
1+
import { remark } from 'remark'
2+
import find from './index.js'
33

44
remark()
55
.use(function () {

index.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
* @module unist:find
66
* @fileoverview Unist node finder
77
*/
8-
9-
'use strict'
10-
11-
var visit = require('unist-util-visit')
12-
var iteratee = require('lodash.iteratee')
8+
import { visit } from 'unist-util-visit'
9+
import iteratee from 'lodash.iteratee'
1310

1411
/**
1512
* Find
@@ -21,8 +18,8 @@ function find (tree, condition) {
2118
if (!tree) throw new Error('unist-find requires a tree to search')
2219
if (!condition) throw new Error('unist-find requires a condition')
2320

24-
var predicate = iteratee(condition)
25-
var result
21+
const predicate = iteratee(condition)
22+
let result
2623

2724
visit(tree, function (node) {
2825
if (predicate(node)) {
@@ -37,4 +34,4 @@ function find (tree, condition) {
3734
/*
3835
* Expose.
3936
*/
40-
module.exports = find
37+
export default find

0 commit comments

Comments
 (0)