Skip to content
Merged
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
17 changes: 2 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ var VALUE_REGEX =
/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/;
var SEMICOLON_REGEX = /^[;\s]*/;

// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
var TRIM_REGEX = /^\s+|\s+$/g;

// strings
var NEWLINE = '\n';
var FORWARD_SLASH = '/';
Expand Down Expand Up @@ -210,9 +207,9 @@ export default function (style, options) {

var ret = pos({
type: TYPE_DECLARATION,
property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
property: prop[0].replace(COMMENT_REGEX, EMPTY_STRING).trim(),
value: val
? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))
? val[0].replace(COMMENT_REGEX, EMPTY_STRING).trim()
: EMPTY_STRING
});

Expand Down Expand Up @@ -245,13 +242,3 @@ export default function (style, options) {
whitespace();
return declarations();
}

/**
* Trim `str`.
*
* @param {String} str
* @return {String}
*/
function trim(str) {
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
}