Skip to content

Commit

Permalink
Stop depend on underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
kesla committed Jun 21, 2012
1 parent f053b6f commit 04849a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
17 changes: 8 additions & 9 deletions lib/css2json.js
Expand Up @@ -5,10 +5,6 @@
// compability planned) hosted on <a href="https://github.com/kesla/css2json">github</a>
// and written by <a href="http://davidbjorklund.se">David Björklund</a>.

// Require <a href="http://documentcloud.github.com/underscore/">underscore</a>
// for some utilities and browser support.
var _ = require('underscore');

// Parse a string with css to a json-object.
module.exports = function(css) {

Expand Down Expand Up @@ -54,10 +50,10 @@ module.exports = function(css) {
.split(";")
.map(function(declaration){
return declaration.trim();
});

// Remove any empty ("") values from the array
declarations = _.compact(declarations);
})
.filter(function(declaration) {
return declaration.length > 0;
}); // Remove any empty ("") values from the array

// _declaration_ is now an array reado to be transformed into an object.
declarations = toObject(declarations);
Expand All @@ -84,7 +80,10 @@ module.exports = function(css) {
// _selector_.
if (!json[selector]) json[selector] = {};
// Save the declarations to the right selector
_.extend(json[selector], declarations);

Object.keys(declarations).forEach(function(key) {
json[selector][key] = declarations[key];
});
});
// Continue to next instance
css = css.slice(rbracket + 1).trim()
Expand Down
3 changes: 0 additions & 3 deletions package.json
Expand Up @@ -11,9 +11,6 @@
"engines": {
"node": "*"
},
"dependencies": {
"underscore": "~1.1.7"
},
"devDependencies": {
"json-san": "0.0.2"
}
Expand Down

0 comments on commit 04849a1

Please sign in to comment.