Skip to content

Commit

Permalink
refactor: Changes to meet projects requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Vieira committed Nov 27, 2017
1 parent 10ff149 commit 3ca6681
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
9 changes: 6 additions & 3 deletions lib/attributes-to-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
var utilities = require('./utilities');
var propertyConfig = require('./property-config');
var parser = require('style-to-object');
var styleToObject = require('style-to-object');
var config = propertyConfig.config;
var isCustomAttribute = propertyConfig.HTMLDOMPropertyConfig.isCustomAttribute;

Expand Down Expand Up @@ -66,8 +66,11 @@ function cssToJs(style) {

var styleObj = {};

parser(style, function(propName, propValue) {
styleObj[utilities.camelCase(propName)] = propValue;
styleToObject(style, function(propName, propValue) {
// Check if it's not a comment node
if (propName && propValue) {
styleObj[utilities.camelCase(propName)] = propValue;
}
});

return styleObj;
Expand Down
5 changes: 2 additions & 3 deletions lib/utilities.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
'use strict';

var _hyphenPattern = /-(.)/g;

/**
* Convert a string to camel case.
*
* @param {String} string - The string.
* @return {String}
*/

var _hyphenPattern = /-(.)/g;

function camelCase(string) {
if (typeof string !== 'string') { // null is an object
throw new TypeError('First argument must be a string');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"html-dom-parser": "0.1.2",
"react-dom-core": "0.0.2",
"style-to-object": "^0.2.0"
"style-to-object": "0.2.0"
},
"devDependencies": {
"coveralls": "^2.13.1",
Expand Down

0 comments on commit 3ca6681

Please sign in to comment.