Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

through2-map

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

through2-map - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

10

index.js

@@ -5,2 +5,3 @@ "use strict";

module.exports.ctor = ctor
module.exports.objCtor = objCtor
module.exports.obj = obj

@@ -30,2 +31,11 @@

function objCtor(options, fn) {
if (typeof options === "function") {
fn = options
options = {}
}
options = xtend({objectMode: true, highWaterMark: 16}, options)
return ctor(options, fn)
}
function obj(options, fn) {

@@ -32,0 +42,0 @@ if (typeof options === "function") {

12

package.json
{
"name": "through2-map",
"version": "1.3.0",
"version": "1.4.0",
"description": "A through2 to create an Array.prototype.map analog for streams.",

@@ -38,11 +38,11 @@ "main": "index.js",

"devDependencies": {
"tape": "~2.4.0",
"stream-spigot": "~3.0.3",
"concat-stream": "~1.4.1"
"tape": "~2.13.2",
"stream-spigot": "~3.0.4",
"concat-stream": "~1.4.6"
},
"dependencies": {
"terminus": "~1.0.8",
"through2": "~0.4.1",
"terminus": "~1.0.10",
"through2": "~0.5.1",
"xtend": "^3.0.0"
}
}

@@ -61,3 +61,3 @@ through2-map

`require("through2-map")(options, fn)`
`require("through2-map")([options,] fn)`
---

@@ -67,3 +67,3 @@

`var Tx = require("through2-map").ctor(options, fn)`
`var Tx = require("through2-map").ctor([options,] fn)`
---

@@ -73,3 +73,3 @@

`require("through2-map").obj(options, fn)`
`require("through2-map").obj([options,] fn)`
---

@@ -79,2 +79,7 @@

`require("through2-map").objCtor([options,] fn)`
---
Just like ctor, but with `objectMode: true` defaulting to true.
Options

@@ -81,0 +86,0 @@ -------

@@ -58,2 +58,27 @@ "use strict";

test("objCtor", function (t) {
t.plan(7)
var Map = map.objCtor(function (record) {
t.equals(this.options.objectMode, true, "can see options")
record.foo.toUpperCase()
return record
})
function combine(records) {
t.equals(records.length, 5, "Correct number of remaining records")
t.notOk(records.filter(function (r) { /^[A-Z]$/.exec(r.foo) }).length, "Everything uppercased")
}
spigot({objectMode: true}, [
{foo: "bar"},
{foo: "baz"},
{foo: "bif"},
{foo: "blah"},
{foo: "buzz"},
])
.pipe(new Map({objectMode: true}))
.pipe(concat({objectMode: true}, combine))
})
test("ctor buffer wantStrings index", function (t) {

@@ -60,0 +85,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