Socket
Socket
Sign inDemoInstall

hoek

Package Overview
Dependencies
0
Maintainers
5
Versions
116
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

hoek

General purpose node utilities


Version published
Maintainers
5
Weekly downloads
2,244,994
decreased by-12.52%

Weekly downloads

Package description

What is hoek?

The hoek package is a utility library that offers a variety of functions for object manipulation, array manipulation, type checking, and encoding. It is designed to provide developers with tools to simplify common tasks in JavaScript programming.

What are hoek's main functionalities?

Object cloning

This feature allows for deep cloning of objects, ensuring that nested objects are cloned properly rather than just copying references.

const hoek = require('hoek');
const obj = { a: 1 };
const clone = hoek.clone(obj);

Merge objects

Merge two objects into one, where the second object's properties are added to the first object. This is useful for combining configurations or settings.

const hoek = require('hoek');
const target = { a: 1 };
const source = { b: 2 };
hoek.merge(target, source);

Assert

Provides a simple assertion utility to validate conditions. If the condition is false, it throws an error with the provided message.

const hoek = require('hoek');
hoek.assert(1 === 1, 'This will not throw');
hoek.assert(1 === 2, 'This will throw an error');

Reach

Allows for safely reaching into an object for a nested property. This helps in avoiding errors when accessing deeply nested properties.

const hoek = require('hoek');
const obj = { a: { b: { c: 1 } } };
const value = hoek.reach(obj, 'a.b.c');

Other packages similar to hoek

Readme

Source

hoek Logo

Utility methods for the hapi ecosystem. This module is not intended to solve every problem for everyone, but rather as a central place to store hapi-specific methods. If you're looking for a general purpose utility module, check out lodash or underscore.

Build Status

Lead Maintainer: Gil Pedersen

Documentation

API Reference

Keywords

FAQs

Last updated on 27 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc