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.30.0 to 0.31.0

docs/objects/exclude.md

27

dist/absurdum.cjs.js

@@ -792,5 +792,29 @@ 'use strict';

/**
* Include determines whether one string can be found in another string
* Exclude filters out elements from an object based on an array of keys to exclude
*
* @param {object} object input string
* @param {array} filter array of keys to be excluded in the filtered object
* @returns {object} object filtered to exclude elemnts with a key from the filter
*
* @example
* const result = objects.exclude({ small: 'ant', medium: 'dog', big: 'elephant' }, ['small', 'big']);
* console.log(result);
* > { medium: "dog" }
*/
function exclude (object, filter) {
return Object.entries(object).reduce((acc, curr, i) => {
if (filter.reduce((res, cur) => {
if (res === false || cur === curr[0]) { return false; }
return true;
}, '')) {
acc[curr[0]] = curr[1];
}
return acc;
}, {});
}
/**
* Include filters elements in a new object based on an array of keys to include
*
* @param {object} object input string
* @param {array} filter array of keys to be kept in the filtered object

@@ -820,2 +844,3 @@ * @returns {object} object filtered to only include elemnts with a key from the filter

__proto__: null,
exclude: exclude,
include: include

@@ -822,0 +847,0 @@ });

@@ -788,5 +788,29 @@ /**

/**
* Include determines whether one string can be found in another string
* Exclude filters out elements from an object based on an array of keys to exclude
*
* @param {object} object input string
* @param {array} filter array of keys to be excluded in the filtered object
* @returns {object} object filtered to exclude elemnts with a key from the filter
*
* @example
* const result = objects.exclude({ small: 'ant', medium: 'dog', big: 'elephant' }, ['small', 'big']);
* console.log(result);
* > { medium: "dog" }
*/
function exclude (object, filter) {
return Object.entries(object).reduce((acc, curr, i) => {
if (filter.reduce((res, cur) => {
if (res === false || cur === curr[0]) { return false; }
return true;
}, '')) {
acc[curr[0]] = curr[1];
}
return acc;
}, {});
}
/**
* Include filters elements in a new object based on an array of keys to include
*
* @param {object} object input string
* @param {array} filter array of keys to be kept in the filtered object

@@ -816,2 +840,3 @@ * @returns {object} object filtered to only include elemnts with a key from the filter

__proto__: null,
exclude: exclude,
include: include

@@ -818,0 +843,0 @@ });

2

docs/objects/include.md

@@ -12,3 +12,3 @@ # objects.include

Include determines whether one string can be found in another string
Include filters elements in a new object based on an array of keys to include

@@ -15,0 +15,0 @@ #### Arguments

import * as arrays from './src/arrays/index.js';
import * as strings from './src/strings/index.js';
import * as objects from './src/objects/index.js';
export { arrays, strings, objects };
export { arrays, strings, objects };
{
"name": "absurdum",
"version": "0.30.0",
"version": "0.31.0",
"description": "Reductio Ad Absurdum - The Ridiculous Application of Reduce",

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

@@ -93,4 +93,6 @@ [![GitHub Releases](https://img.shields.io/github/release/vanillaes/absurdum.svg)](https://github.com/vanillaes/absurdum/releases)

- [exclude][objects.exclude]
- [include][objects.include]
[objects.exclude]: ./docs/objects/exclude.md
[objects.include]: ./docs/objects/include.md

@@ -97,0 +99,0 @@

/**
* Include determines whether one string can be found in another string
* Include filters elements in a new object based on an array of keys to include
*

@@ -4,0 +4,0 @@ * @param {object} object input string

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

export { exclude } from "./exclude.js";
export { include } from "./include.js";

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

export { exclude } from './exclude.js';
export { include } from './include.js';
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