Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Using npm:
$ npm install hashmap
Using bower:
$ bower install hashmap
You can download the last stable version from the releases page.
If you like risk, you can download the latest master version, it's usually stable.
To run the tests:
$ npm test
This project provides a HashMap
class that works both on Node.js and the browser.
HashMap instances store key/value pairs allowing keys of any type.
Unlike regular objects, keys will not be stringified. For example numbers and strings won't be mixed, you can pass Date
's, RegExp
's, DOM Elements, anything! (even null
and undefined
)
new HashMap()
creates an empty hashmapnew HashMap(map:HashMap)
creates a hashmap with the key-value pairs of map
new HashMap(key:*, value:*, key2:*, value2:*, ...)
creates a hashmap with several key-value pairsget(key:*) : *
returns the value stored for that key.set(key:*, value:*) : HashMap
stores a key-value pairmulti(key:*, value:*, key2:*, value2:*, ...) : HashMap
stores several key-value pairscopy(other:HashMap) : HashMap
copies all key-value pairs from other to this instancehas(key:*) : Boolean
returns whether a key is set on the hashmapsearch(value:*) : *
returns key under which given value is stored (null
if not found)remove(key:*) : HashMap
deletes a key-value pair by keytype(key:*) : String
returns the data type of the provided key (used internally)keys() : Array<*>
returns an array with all the registered keysvalues() : Array<*>
returns an array with all the valuescount() : Number
returns the amount of key-value pairsclear() : HashMap
removes all the key-value pairs on the hashmapclone() : HashMap
creates a new hashmap with all the key-value pairs of the originalhash(key:*) : String
returns the stringified version of a key (used internally)forEach(function(value, key)) : HashMap
iterates the pairs and calls the function for each oneAll methods that don't return something, will return the HashMap instance to enable chaining.
Assume this for all examples below
var map = new HashMap();
If you're using this within Node, you first need to import the class
var HashMap = require('hashmap');
map.set("some_key", "some value");
map.get("some_key"); // --> "some value"
map.set("1", "string one");
map.set(1, "number one");
map.get("1"); // --> "string one"
A regular Object
used as a map would yield "number one"
var key = {};
var key2 = {};
map.set(key, 123);
map.set(key2, 321);
map.get(key); // --> 123
A regular Object
used as a map would yield 321
map.set(1, "test 1");
map.set(2, "test 2");
map.set(3, "test 3");
map.forEach(function(value, key) {
console.log(key + " : " + value);
});
map
.set(1, "test 1")
.set(2, "test 2")
.set(3, "test 3")
.forEach(function(value, key) {
console.log(key + " : " + value);
});
The MIT License (MIT)
Copyright (c) 2012-2015 Ariel Flesler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
2.0.5
FAQs
HashMap Class for JavaScript
The npm package hashmap receives a total of 17,166 weekly downloads. As such, hashmap popularity was classified as popular.
We found that hashmap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.