concat-with-sourcemaps
Advanced tools
Comparing version 1.0.6 to 1.0.7
18
index.js
@@ -16,5 +16,5 @@ 'use strict'; | ||
if (separator === undefined) { | ||
this.separator = Buffer.from(''); | ||
this.separator = bufferFrom(''); | ||
} else { | ||
this.separator = Buffer.from(separator); | ||
this.separator = bufferFrom(separator); | ||
} | ||
@@ -41,3 +41,3 @@ | ||
if (!Buffer.isBuffer(content)) { | ||
content = Buffer.from(content); | ||
content = bufferFrom(content); | ||
} | ||
@@ -123,2 +123,14 @@ | ||
function bufferFrom(content) { | ||
try { | ||
return Buffer.from(content); | ||
} catch(e) { | ||
if (Object.prototype.toString.call(content) !== '[object String]') { | ||
throw new TypeError("separator must be a string"); | ||
} | ||
return new Buffer(content); | ||
} | ||
} | ||
Concat.bufferFrom = bufferFrom; | ||
module.exports = Concat; |
{ | ||
"name": "concat-with-sourcemaps", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Concatenate file contents with a custom separator and generate a source map", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/floridoo/concat-with-sourcemaps", |
7768
119