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.58.0 to 0.59.0

docs/objects/has.md

38

dist/absurdum.esm.js

@@ -1340,2 +1340,39 @@ /**

/**
* Has, creates an array of values corresponding to paths of the object
*
* @param {object} object input object
* @param {Array|string} path strings describing paths to be returned from an object
* @returns {boolean} boolean true is a direct property of the object
*
* @example
* const result = objects.has({ front: [1, 3, 5], back: [37, 39] });
* console.log(result, 'back[1]');
* > true
*
* @example
* const result = objects.has({ front: [1, 3, 5], back: [37, 39] });
* console.log(result, ['front', 1]);
* > true
*/
function has (object, path) {
if (typeof path === 'undefined') { return false; }
let pathArray;
if (Array.isArray(path)) {
pathArray = path;
} else {
pathArray = String(path).replace(/\[(\w+)\]/g, '.$1').split('.');
}
return undefined !== pathArray.reduce((result, search) => {
if (result === undefined) { return undefined; }
if (Object.prototype.hasOwnProperty.call(result, search)) {
return result[search];
} else {
return undefined;
}
}, object);
}
/**
* Include filters elements in a new object based on an array of keys to include

@@ -1530,2 +1567,3 @@ *

findKey: findKey,
has: has,
include: include,

@@ -1532,0 +1570,0 @@ invert: invert,

2

package.json
{
"name": "absurdum",
"version": "0.58.0",
"version": "0.59.0",
"description": "Reductio Ad Absurdum - The Ridiculous Application of Reduce",

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

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

- [findKey][objects.findKey]
- [has][objects.has]
- [include][objects.include]

@@ -149,2 +150,3 @@ - [invert][objects.invert]

[objects.findKey]: ./docs/objects/findKey.md
[objects.has]: ./docs/objects/has.md
[objects.include]: ./docs/objects/include.md

@@ -151,0 +153,0 @@ [objects.invert]: ./docs/objects/invert.md

@@ -5,2 +5,3 @@ export { at } from "./at.js";

export { findKey } from "./findKey.js";
export { has } from "./has.js";
export { include } from "./include.js";

@@ -7,0 +8,0 @@ export { invert } from "./invert.js";

@@ -5,2 +5,3 @@ export { at } from './at.js';

export { findKey } from './findKey.js';
export { has } from './has.js';
export { include } from './include.js';

@@ -7,0 +8,0 @@ export { invert } from './invert.js';

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