Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ES6/ES2015 module loading #12

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"description": "Remove unnecessary whitespace from an element.",
"main": "lib/whitespace.js",
"types": "whitespace.d.ts",
"module": "src/whitespace.js",
"jsnext:main": "src/whitespace.js",
"scripts": {
"prepublish": "make",
"test": "make test"
Expand Down
8 changes: 4 additions & 4 deletions src/whitespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ function isBlockElem (node) {

/**
* isPreElem(node) determines if the given node is a PRE element.
*
*
* Whitespace for PRE elements are not collapsed.
*
*
* @param {Node} node
* @return {Boolean}
*/
Expand Down Expand Up @@ -85,7 +85,7 @@ function collapseWhitespace (elem, isBlock, isPre) {
}

node.data = text

prevText = node
} else if (node.nodeType === 1) { // Node.ELEMENT_NODE
if (isBlock(node) || node.nodeName === 'BR') {
Expand Down Expand Up @@ -150,4 +150,4 @@ function next (prev, current, isPre) {
return current.firstChild || current.nextSibling || current.parentNode
}

module.exports = collapseWhitespace
export default collapseWhitespace