Skip to content

arisnacg/jshashmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Simple Javascript Utility Library

npm version license

How To Install

The preferred way to install the jshashmap for Node.js is to use the npm package manager for Node.js. Simply type the following into a terminal:

npm install jshashmap

Examples of Use

Version 1 only support 2 functions:

  • objtToMap(): Convert Javascript object into Javascript Map class
  • arrayToMap(): Convert Javascript object into Javascript Map class
const jshashmap = require("jshashmap");

const foodStocks = {
  apple: 12,
  bread: 20,
  meat: 2,
  vegetable: 35,
};
const hashmap1 = jshashmap.objToMap(foodStocks);
console.log(hashmap1);
// Output:
// Map(4) { 'apple' => 12, 'bread' => 20, 'meat' => 2, 'vegetable' => 35 }

const fruits = ["Apple", "Orange", "Blueberry"];
const hashmap2 = jshashmap.arrayToMap(fruits));
console.log(hashmap2)
// Output:
// Map(3) { 0 => 'Apple', 1 => 'Orange', 2 => 'Blueberry'

License

MIT

About

A simple Javascript hash map utility library

Resources

License

Stars

Watchers

Forks

Packages

No packages published