Comparing version 0.3.0 to 0.4.0
@@ -124,2 +124,6 @@ var regeneratorRuntime = require('babel-regenerator-runtime');'use strict'; | ||
var _isstream = require('isstream'); | ||
var _isstream2 = _interopRequireDefault(_isstream); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -148,24 +152,33 @@ | ||
if (null != obj) { | ||
var str = void 0; | ||
if (Buffer.isBuffer(obj)) { | ||
res.setHeader('Content-Type', 'application/octet-stream'); | ||
res.setHeader('Content-Length', obj.length); | ||
res.end(obj); | ||
} else if ((0, _isstream2.default)(obj)) { | ||
res.setHeader('Content-Type', 'application/octet-stream'); | ||
obj.pipe(res); | ||
} else { | ||
var str = void 0; | ||
if ('object' === (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) { | ||
// we stringify before setting the header | ||
// in case `JSON.stringify` throws and a | ||
// 500 has to be sent instead | ||
if ('object' === (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) { | ||
// we stringify before setting the header | ||
// in case `JSON.stringify` throws and a | ||
// 500 has to be sent instead | ||
// the `JSON.stringify` call is split into | ||
// two cases as `JSON.stringify` is optimized | ||
// in V8 if called with only one argument | ||
if (DEV) { | ||
str = JSON.stringify(obj, null, 2); | ||
// the `JSON.stringify` call is split into | ||
// two cases as `JSON.stringify` is optimized | ||
// in V8 if called with only one argument | ||
if (DEV) { | ||
str = JSON.stringify(obj, null, 2); | ||
} else { | ||
str = JSON.stringify(obj); | ||
} | ||
res.setHeader('Content-Type', 'application/json'); | ||
} else { | ||
str = JSON.stringify(obj); | ||
str = obj; | ||
} | ||
res.setHeader('Content-Type', 'application/json'); | ||
} else { | ||
str = obj; | ||
res.setHeader('Content-Length', Buffer.byteLength(str)); | ||
res.end(str); | ||
} | ||
res.setHeader('Content-Length', Buffer.byteLength(str)); | ||
res.end(str); | ||
} else { | ||
@@ -172,0 +185,0 @@ res.end(); |
0.4.0 / 2016-06-07 | ||
================== | ||
* add support for Buffer and Stream in `send` [@kevin-roark] | ||
0.3.0 / 2016-05-16 | ||
@@ -3,0 +8,0 @@ ================== |
{ | ||
"name": "micro-core", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Micro core utilities", | ||
@@ -51,6 +51,7 @@ "main": "dist/index.js", | ||
"babel-regenerator-runtime": "6.5.0", | ||
"isstream": "0.1.2", | ||
"media-typer": "0.3.0", | ||
"raw-body": "2.1.6", | ||
"minimist": "1.2.0" | ||
"minimist": "1.2.0", | ||
"raw-body": "2.1.6" | ||
} | ||
} |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
10626
6
162
1
23
5
+ Addedisstream@0.1.2
+ Addedisstream@0.1.2(transitive)