Skip to content

Commit d76c68c

Browse files
refactor(dom-to-react): require react on top and tidy JSDoc
1 parent 42317c7 commit d76c68c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/dom-to-react.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
var React = require('react');
12
var attributesToProps = require('./attributes-to-props');
23
var utilities = require('./utilities');
34

45
/**
56
* Converts DOM nodes to React elements.
67
*
7-
* @param {DomElement[]} nodes - The DOM nodes.
8-
* @param {Object} [options={}] - The additional options.
9-
* @param {Function} [options.replace] - The replacer.
10-
* @param {Object} [options.library] - The library (React, Preact, etc.).
11-
* @return {String|ReactElement|ReactElement[]}
8+
* @param {DomElement[]} nodes - DOM nodes.
9+
* @param {object} [options={}] - Options.
10+
* @param {Function} [options.replace] - Replacer.
11+
* @param {object} [options.library] - Library (React/Preact/etc.).
12+
* @return {string|ReactElement|ReactElement[]}
1213
*/
1314
function domToReact(nodes, options) {
1415
options = options || {};
1516

16-
var React = options.library || require('react');
17-
var cloneElement = React.cloneElement;
18-
var createElement = React.createElement;
19-
var isValidElement = React.isValidElement;
17+
var library = options.library || React;
18+
var cloneElement = library.cloneElement;
19+
var createElement = library.createElement;
20+
var isValidElement = library.isValidElement;
2021

2122
var result = [];
2223
var node;

0 commit comments

Comments
 (0)