grunt-json5-to-json
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "grunt-json5-to-json", | ||
"description": "Convert json5 to json.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/leader22/grunt-json5-to-json", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -64,1 +64,3 @@ # grunt-json5-to-json | ||
- 0.1.0: pre release. | ||
- 0.1.1: npm publish. | ||
- 0.1.2: Refactor some code. |
@@ -25,2 +25,7 @@ /* | ||
var JSON5 = require('json5'); | ||
var cnst = { | ||
windows: 'win32', | ||
file: 'file', | ||
directory: 'directory' | ||
}; | ||
@@ -50,3 +55,3 @@ grunt.registerMultiTask('json5_to_json', 'Convert json5 to json.', function() { | ||
filePair.src.forEach(function(src) { | ||
if (detectDestType(filePair.dest) === 'directory') { | ||
if (detectDestType(filePair.dest) === cnst.directory) { | ||
dest = (isExpandedPair) ? filePair.dest : unixifyPath(path.join(filePair.dest, src)); | ||
@@ -92,12 +97,14 @@ } else { | ||
var detectDestType = function(dest) { | ||
// Private functions. | ||
function detectDestType(dest) { | ||
if (grunt.util._.endsWith(dest, '/')) { | ||
return 'directory'; | ||
return cnst.directory; | ||
} else { | ||
return 'file'; | ||
return cnst.file; | ||
} | ||
}; | ||
var unixifyPath = function(filepath) { | ||
if (process.platform === 'win32') { | ||
function unixifyPath(filepath) { | ||
if (process.platform === cnst.win32) { | ||
return filepath.replace(/\\/g, '/'); | ||
@@ -104,0 +111,0 @@ } else { |
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
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
10012
156
66