Comparing version 0.3.1 to 0.4.0
@@ -114,2 +114,11 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var _tap = __webpack_require__(4); | ||
Object.defineProperty(exports, 'tap', { | ||
enumerable: true, | ||
get: function get() { | ||
return _tap.tap; | ||
} | ||
}); | ||
/***/ }), | ||
@@ -163,2 +172,19 @@ /* 1 */ | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var tap = exports.tap = function tap(input, func) { | ||
input.forEach(function (x) { | ||
return func(x); | ||
}); | ||
return input; | ||
}; | ||
/***/ }) | ||
@@ -165,0 +191,0 @@ /******/ ]); |
@@ -33,1 +33,15 @@ # Type: Array | ||
``` | ||
### arrays.tap(arr, func) | ||
Applies a function to each element in the array without mutating it | ||
```javascript | ||
let result = arrays.tap([1, 2, 3, 4], console.log); | ||
console.log(result); | ||
> 1 | ||
> 2 | ||
> 3 | ||
> 4 | ||
> [1, 2, 3, 4] | ||
``` |
{ | ||
"name": "absurdum", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "Reductio Ad Absurdum - The Riduculous Application of Reduce", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
export { filter } from './filter'; | ||
export { map } from './map'; | ||
export { reverse } from './reverse'; | ||
export { tap } from './tap'; |
@@ -31,1 +31,10 @@ const test = require('tape'); | ||
}); | ||
test('tap(arr) - should apply a function to the input without mutating it', (t) => { | ||
let result = arrays.tap([1, 2, 3, 4], console.log); | ||
let expect = [1, 2, 3, 4]; | ||
t.equal(Object.prototype.toString.call(result), '[object Array]', 'type'); | ||
t.equal(result.length, 4, 'length'); | ||
t.deepEqual(result, expect, 'value'); | ||
t.end(); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20188
23
248