This package has been deprecated

Author message:

use @devlop/tap instead

@devlop-ab/tap
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Latest Stable Version License

tap

A JavaScript implementation of Laravel's tap helper.

Installing

using npm

npm install @devlop-ab/tap

Usage

import tap from '@devlop-ab/tap';

// or
const tap = require('@devlop-ab/tap');

tap accepts two arguments, a value and a callback. The callback will get the value as the first argument, any return value of the callback will be ignored and the original value will be returned.

Examples

let someVariable = true;

let anotherValue = tap(someVariable, function () {
    console.log(someVariable); // true
});

console.log(anotherValue); // true
let someVariable = true;

let anotherValue = tap(someVariable, function () {
    console.log(someVariable); // true
    
    // re-assignments have no effect
    someVariable = false;
    
    // return values are ignored
    return false;
});

console.log(anotherValue); // still true 

Readme

Keywords

none

Package Sidebar

Install

npm i @devlop-ab/tap

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.74 kB

Total Files

7

Last publish

Collaborators

  • johanrosenson