Skip to content

Commit

Permalink
run jshint
Browse files Browse the repository at this point in the history
  • Loading branch information
cuth committed Apr 23, 2014
1 parent eefe5c5 commit bbb49db
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ node_modules/
test/
example/
.editorconfig
.jshintrc
spec/
21 changes: 21 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"node": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"white": true
}
10 changes: 5 additions & 5 deletions lib/pxtorem.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
module.exports = function pixrem(css, rootvalue, options) {
var postcss = require('postcss');
var remgex = /(\d*\.?\d+)px/ig;
var rootvalue = rootvalue || 16;
var options = typeof options !== 'undefined' ? options : {
rootvalue = rootvalue || 16;
options = typeof options !== 'undefined' ? options : {
replace: true
};

Expand All @@ -27,7 +27,7 @@ module.exports = function pixrem(css, rootvalue, options) {
var rule = decl.parent;
var value = decl.value;

if (value.indexOf('px') != -1) {
if (value.indexOf('px') !== -1) {

value = value.replace(remgex, function (m, $1) {
return toFixed((parseFloat($1) / rootvalue), 5) + 'rem';
Expand All @@ -41,11 +41,11 @@ module.exports = function pixrem(css, rootvalue, options) {
}
});

css.each(function (rule, i) {
css.each(function (rule) {
if (rule.type !== 'atrule' && rule.name !== 'media') {
return true;
}
if (rule._params.indexOf('px') != 1) {
if (rule._params.indexOf('px') !== 1) {
rule._params = rule._params.replace(remgex, function (m, $1) {
return toFixed((parseFloat($1) / rootvalue), 5) + 'rem';
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"author": "Jon Cuthbert <[email protected]> (http://cuth.net)",
"repository": {
"type": "git",
"url": "git://github.com/cuth/..."
"url": "git://github.com/cuth/node-pxtorem"
},
"bugs": "https://github.com/cuth/.../issues",
"bugs": "https://github.com/cuth/node-pxtorem/issues",
"licenses": [
{
"type": "BSD-new"
Expand Down

0 comments on commit bbb49db

Please sign in to comment.