Socket
Socket
Sign inDemoInstall

@hapi/hoek

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hapi/hoek - npm Package Compare versions

Comparing version 7.1.0 to 7.2.0

9

lib/index.d.ts

@@ -279,5 +279,12 @@ /**

@default true
*/
readonly functions?: boolean;
/**
If true, allows traversing Set and Map objects for properties. false will return undefined regardless of the Set or Map passed.
@default false
*/
readonly functions?: boolean;
readonly iterables?: boolean;
}

@@ -284,0 +291,0 @@ }

@@ -539,8 +539,10 @@ 'use strict';

let key = path[i];
const type = options.iterables && internals.iterables(ref);
if (Array.isArray(ref)) {
if (Array.isArray(ref) ||
type === 'set') {
const number = Number(key);
if (Number.isInteger(number) && number < 0) {
key = ref.length + number;
if (Number.isInteger(number)) {
key = number < 0 ? ref.length + number : number;
}

@@ -550,4 +552,4 @@ }

if (!ref ||
!((typeof ref === 'object' || typeof ref === 'function') && key in ref) ||
(typeof ref !== 'object' && options.functions === false)) { // Only object and function can have properties
typeof ref === 'function' && options.functions === false || // Defaults to true
!type && ref[key] === undefined) {

@@ -560,3 +562,11 @@ exports.assert(!options.strict || i + 1 === path.length, 'Missing segment', key, 'in reach path ', chain);

ref = ref[key];
if (!type) {
ref = ref[key];
}
else if (type === 'set') {
ref = [...ref][key];
}
else { // type === 'map'
ref = ref.get(key);
}
}

@@ -568,2 +578,14 @@

internals.iterables = function (ref) {
if (ref instanceof Set) {
return 'set';
}
if (ref instanceof Map) {
return 'map';
}
};
exports.reachTemplate = function (obj, template, options) {

@@ -570,0 +592,0 @@

2

package.json
{
"name": "@hapi/hoek",
"description": "General purpose node utilities",
"version": "7.1.0",
"version": "7.2.0",
"repository": "git://github.com/hapijs/hoek",

@@ -6,0 +6,0 @@ "main": "lib/index.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