New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

then-busboy

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

then-busboy - npm Package Compare versions

Comparing version 2.0.0-beta.6 to 2.0.0-beta.7

lib/util/isNaN.js

1

.eslintrc.json

@@ -10,3 +10,2 @@ {

"rules": {
"no-void": 0,
"ava/no-ignored-test-files": ["error", {

@@ -13,0 +12,0 @@ "files": [

@@ -41,3 +41,3 @@ "use strict";

*/
constructor({ contents, filename, enc, mime } = {}) {
constructor(file) {
this.read = () => new Promise((resolve, reject) => {

@@ -61,2 +61,4 @@ const data = [];

const { contents, filename, enc, mime } = file;
(0, _invariant2.default)(!contents, "File contents required.");

@@ -63,0 +65,0 @@

@@ -58,5 +58,5 @@ "use strict";

* @param {http.IncomingMessage} request – HTTP request object
* @param {object} options - then-busboy options
* @param {object} [options = {}] - then-busboy options
*
* @return {Promise<object>}
* @return {Promise<Object>}
*/

@@ -63,0 +63,0 @@ };const thenBusboy = (request, options = {}) => new Promise((resolve, reject) => {

@@ -17,2 +17,6 @@ "use strict";

var _isNaN = require("./isNaN");
var _isNaN2 = _interopRequireDefault(_isNaN);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -51,3 +55,3 @@

res.push(isNaN(key) ? key : Number(key));
res.push((0, _isNaN2.default)(key) ? key : Number(key));
}

@@ -54,0 +58,0 @@

@@ -6,2 +6,9 @@ "use strict";

});
var _isNaN = require("./isNaN");
var _isNaN2 = _interopRequireDefault(_isNaN);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -18,3 +25,3 @@ * @param {array|object} target

const currentPath = path.shift();
const curr = isNaN(currentPath) ? {} : [];
const curr = (0, _isNaN2.default)(currentPath) ? {} : [];

@@ -21,0 +28,0 @@ if (!target) {

@@ -6,2 +6,9 @@ "use strict";

});
var _isNaN = require("./isNaN");
var _isNaN2 = _interopRequireDefault(_isNaN);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -31,3 +38,3 @@ * Try restore value type

if (!isNaN(value)) {
if (!(0, _isNaN2.default)(value)) {
return Number(value);

@@ -34,0 +41,0 @@ }

{
"name": "then-busboy",
"version": "2.0.0-beta.6",
"version": "2.0.0-beta.7",
"description": "Promise-based wrapper around Busboy, inspired by async-busboy",

@@ -58,3 +58,3 @@ "repository": "octet-stream/then-busboy",

"devDependencies": {
"@octetstream/eslint-config": "1.0.1",
"@octetstream/eslint-config": "2.0.2",
"ava": "0.22.0",

@@ -69,3 +69,3 @@ "babel-cli": "6.26.0",

"codecov": "2.3.0",
"eslint": "3.19.x",
"eslint": "^4.6.0",
"eslint-import-resolver-babel-module": "3.0.0",

@@ -72,0 +72,0 @@ "eslint-plugin-ava": "4.2.1",

@@ -21,3 +21,5 @@ import {createWriteStream} from "fs"

*/
constructor({contents, filename, enc, mime} = {}) {
constructor(file) {
const {contents, filename, enc, mime} = file
invariant(!contents, "File contents required.")

@@ -24,0 +26,0 @@

@@ -26,5 +26,5 @@ import {IncomingMessage} from "http"

* @param {http.IncomingMessage} request – HTTP request object
* @param {object} options - then-busboy options
* @param {object} [options = {}] - then-busboy options
*
* @return {Promise<object>}
* @return {Promise<Object>}
*/

@@ -31,0 +31,0 @@ const thenBusboy = (request, options = {}) => new Promise((resolve, reject) => {

@@ -6,2 +6,3 @@ import {isString} from "util"

import getType from "lib/util/getType"
import isNaN from "lib/util/isNaN"

@@ -8,0 +9,0 @@ const format = /^([^[\]\n]+)(\[[^[\]]+\])*$/

@@ -0,1 +1,3 @@

import isNaN from "lib/util/isNaN"
/**

@@ -2,0 +4,0 @@ * @param {array|object} target

@@ -0,1 +1,3 @@

import isNaN from "lib/util/isNaN"
/**

@@ -2,0 +4,0 @@ * Try restore value type

@@ -65,3 +65,3 @@ import Stream, {Writable} from "stream"

const File = pq("../../lib/File", {
const MockedFile = pq("../../lib/File", {
nanoid: spyo,

@@ -76,3 +76,3 @@ os: {

const file = new File({
const file = new MockedFile({
contents,

@@ -134,3 +134,3 @@ filename,

const File = pq("../../lib/File", {
const MockedFile = pq("../../lib/File", {
fs: {

@@ -147,3 +147,3 @@ createWriteStream

const file = new File({
const file = new MockedFile({
contents,

@@ -176,3 +176,3 @@ filename,

const File = pq("../../lib/File", {
const MockedFile = pq("../../lib/File", {
fs: {

@@ -189,3 +189,3 @@ createWriteStream

const file = new File({
const file = new MockedFile({
contents,

@@ -192,0 +192,0 @@ filename,

@@ -147,2 +147,30 @@ import test from "ava"

test("Should receive files and fields at the same time", async t => {
t.plan(1)
const {body} = await request(mockServer(busboy)())
.post("/")
.field("message[sender]", "John Doe")
.field("message[text]", "Whatever test message text")
.field("message[attachments][0][description]", "Some test file")
.attach("message[attachments][0][file]", __filename)
const file = String(await readFile(__filename))
const expected = {
message: {
sender: "John Doe",
text: "Whatever test message text",
attachments: [
{
description: "Some test file",
file
}
]
}
}
t.deepEqual(body, expected)
})
test("Should throw an error when no request object given", async t => {

@@ -218,3 +246,4 @@ t.plan(3)

test("Should response an error on incorrect field name format of given file",
test(
"Should response an error on incorrect field name format of given file",
async t => {

@@ -221,0 +250,0 @@ t.plan(1)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc