Comparing version 0.2.0 to 0.2.1
39
index.js
@@ -17,5 +17,5 @@ | ||
module.exports = exports = function(key){ | ||
return key in memo | ||
? memo[key] | ||
: memo[key] = prefix(key) | ||
return key in memo | ||
? memo[key] | ||
: memo[key] = prefix(key) | ||
} | ||
@@ -37,18 +37,23 @@ | ||
function prefix(key){ | ||
// without prefix | ||
if (style[key] !== undefined) return key | ||
// camel case | ||
key = key.replace(/-([a-z])/g, function(_, char){ | ||
return char.toUpperCase() | ||
}) | ||
// with prefix | ||
var Key = capitalize(key) | ||
var i = prefixes.length | ||
while (i--) { | ||
var name = prefixes[i] + Key | ||
if (style[name] !== undefined) return name | ||
} | ||
// without prefix | ||
if (style[key] !== undefined) return key | ||
throw new Error('unable to prefix ' + key) | ||
// with prefix | ||
var Key = capitalize(key) | ||
var i = prefixes.length | ||
while (i--) { | ||
var name = prefixes[i] + Key | ||
if (style[name] !== undefined) return name | ||
} | ||
throw new Error('unable to prefix ' + key) | ||
} | ||
function capitalize(str){ | ||
return str.charAt(0).toUpperCase() + str.slice(1) | ||
return str.charAt(0).toUpperCase() + str.slice(1) | ||
} | ||
@@ -65,5 +70,5 @@ | ||
function dashedPrefix(key){ | ||
key = prefix(key) | ||
if (upper.test(key)) key = '-' + key.replace(upper, '-$1') | ||
return key.toLowerCase() | ||
key = prefix(key) | ||
if (upper.test(key)) key = '-' + key.replace(upper, '-$1') | ||
return key.toLowerCase() | ||
} |
{ | ||
"name": "prefix", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "prefix a css attribute", | ||
"dependencies": {}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/jkroso/prefix.git" | ||
"devDependencies": { | ||
"serve": "jkroso/serve#1.5.1", | ||
"assert": "component/assert", | ||
"mocha": "*" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/jkroso/prefix/issues" | ||
}, | ||
"repository": "git://github.com/jkroso/prefix.git", | ||
"bugs": "https://github.com/jkroso/prefix/issues", | ||
"keywords": ["prefix"], | ||
@@ -17,2 +17,2 @@ "author": "Jake Rosoman", | ||
"files": ["index.js"] | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2423
58
3
2
1