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

absurdum

Package Overview
Dependencies
Maintainers
1
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

absurdum - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

src/arrays/filter.js

27

dist/arrays.js

@@ -87,4 +87,13 @@ (function webpackUniversalModuleDefinition(root, factory) {

var _map = __webpack_require__(1);
var _filter = __webpack_require__(1);
Object.defineProperty(exports, 'filter', {
enumerable: true,
get: function get() {
return _filter.filter;
}
});
var _map = __webpack_require__(2);
Object.defineProperty(exports, 'map', {

@@ -107,2 +116,18 @@ enumerable: true,

});
var filter = exports.filter = function filter(input, predicate) {
return input.reduce(function (acc, curr) {
return predicate(curr) ? acc.concat([curr]) : acc;
}, []);
};
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var map = exports.map = function map(input, func) {

@@ -109,0 +134,0 @@ return input.reduce(function (acc, curr) {

2

package.json
{
"name": "absurdum",
"version": "0.1.1",
"version": "0.2.0",
"description": "Reductio Ad Absurdum - The Riduculous Application of Reduce",

@@ -5,0 +5,0 @@ "keywords": [

@@ -0,1 +1,2 @@

export { filter } from './filter';
export { map } from './map';

@@ -5,2 +5,11 @@ const test = require('tape');

test('filter(arr, predicate) - should filter out values based on the result of the predicate', (t) => {
let result = arrays.filter([1, 2, 3, 4], (x) => x % 2 === 0);
let expect = [2, 4];
t.equal(Object.prototype.toString.call(result), '[object Array]', 'type');
t.equal(result.length, 2, 'length');
t.deepEqual(result, expect, 'value');
t.end();
});
test('map(arr, func) - should map over and apply the function to each value', (t) => {

@@ -7,0 +16,0 @@ let result = arrays.map([1, 2, 3, 4], (x) => x + 2);

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