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

namastey-hash-table

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

namastey-hash-table

A powerful and efficient implementation of hash tables for JavaScript, optimized for performance and scalability.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by100%
Maintainers
0
Weekly downloads
 
Created
Source

namastey-hash-table

A simple and efficient JavaScript implementation of a Hash Table with various important methods.

Features

  • set(key, value): Adds a key-value pair to the hash table. If the key already exists, it updates the value.
  • get(key): Retrieves the value associated with the given key. Returns undefined if the key does not exist.
  • delete(key): Removes the key-value pair from the hash table. Returns true if the pair was removed, false otherwise.
  • has(key): Checks if the key exists in the hash table. Returns true if the key exists, false otherwise.
  • keys(): Returns an array of all the keys in the hash table.
  • values(): Returns an array of all the values in the hash table.

Installation

To install the package globally, run:

npm install -g .

Examples

const HashTable = require('namastey-hash-table');

const hashTable = new HashTable();

hashTable.set('name', 'Alice');
console.log(hashTable.get('name')); // Output: Alice

hashTable.set('age', 25);
console.log(hashTable.keys()); // Output: ['name', 'age']
console.log(hashTable.values()); // Output: ['Alice', 25]

hashTable.delete('age');
console.log(hashTable.has('age')); // Output: false

Keywords

FAQs

Package last updated on 06 Sep 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc