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

p-tap

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-tap - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

12

index.js
'use strict';
module.exports = fn => val => {
const ret = () => val;
return Promise.resolve(val).then(fn).then(ret, ret);
module.exports = fn => value => {
const ret = () => value;
return Promise.resolve(value).then(fn).then(ret);
};
module.exports.catch = fn => err => {
const ret = () => Promise.reject(err);
return Promise.resolve(err).then(fn).then(ret, ret);
module.exports.catch = fn => error => {
const ret = () => Promise.reject(error);
return Promise.resolve(error).then(fn).then(ret);
};
{
"name": "p-tap",
"version": "1.0.0",
"description": "Tap into a promise chain without affecting its value or state",
"license": "MIT",
"repository": "sindresorhus/p-tap",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"promise",
"tap",
"debug",
"log",
"then",
"catch",
"error",
"chain",
"pipeline",
"thunk",
"function",
"async",
"await",
"promises",
"bluebird"
],
"devDependencies": {
"ava": "*",
"delay": "^1.3.1",
"time-span": "^1.0.0",
"xo": "*"
},
"xo": {
"esnext": true
}
"name": "p-tap",
"version": "2.0.0",
"description": "Tap into a promise chain without affecting its value or state",
"license": "MIT",
"repository": "sindresorhus/p-tap",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"promise",
"tap",
"debug",
"log",
"then",
"catch",
"error",
"chain",
"pipeline",
"thunk",
"function",
"async",
"await",
"promises",
"bluebird"
],
"devDependencies": {
"ava": "*",
"delay": "^3.0.0",
"time-span": "^2.0.0",
"xo": "*"
}
}

@@ -9,3 +9,3 @@ # p-tap [![Build Status](https://travis-ci.org/sindresorhus/p-tap.svg?branch=master)](https://travis-ci.org/sindresorhus/p-tap)

```
$ npm install --save p-tap
$ npm install p-tap
```

@@ -20,3 +20,3 @@

Promise.resolve('unicorn')
.then(pTap(console.log)) // logs `unicorn`
.then(pTap(console.log)) // Logs `unicorn`
.then(value => {

@@ -31,3 +31,3 @@ // `value` is still `unicorn`

getUser()
.then(tap(user => saveUser(user))) // `user` is saved async before the chain continues
.then(pTap(user => recordStatsAsync(user))) // Stats are saved about `user` async before the chain continues
.then(user => {

@@ -66,3 +66,3 @@ // `user` is the user from getUser(), not recordStatsAsync()

Any return value or exception is ignored.
Any return value is ignored. Exceptions thrown in `input` are relayed back to the original promise chain.

@@ -76,2 +76,3 @@ If `input` returns a `Promise`, it will be awaited before passing through the original value.

- [p-if](https://github.com/sindresorhus/p-if) - Conditional promise chains
- [p-catch-if](https://github.com/sindresorhus/p-catch-if) - Conditional promise catch handler
- [More…](https://github.com/sindresorhus/promise-fun)

@@ -78,0 +79,0 @@

Sorry, the diff of this file is not supported yet

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