Socket
Socket
Sign inDemoInstall

hashmap

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hashmap - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

bower.json

26

hashmap.js
/**
* HashMap
* HashMap - HashMap Class for JavaScript
* @author Ariel Flesler <aflesler@gmail.com>
* @version 1.0.0
* @version 1.0.1
* Homepage: https://github.com/flesler/hashmap

@@ -12,3 +12,3 @@ */

this.clear();
};
}

@@ -46,8 +46,16 @@ HashMap.prototype = {

keys:function() {
var keys = [];
this.forEach(function(value, key) { keys.push(key); });
return keys;
},
values:function() {
var values = [];
this.forEach(function(value) { values.push(value); });
return values;
},
count:function() {
var n = 0;
for (var key in this._data) {
n++;
}
return n;
return this.keys().length;
},

@@ -96,3 +104,3 @@

var data = this._data[key];
func(data[1], data[0]);
func.call(this, data[1], data[0]);
}

@@ -99,0 +107,0 @@ }

{
"name": "hashmap"
, "author": "Ariel Flesler <aflesler@gmail.com>"
, "version": "1.0.0"
, "description": "HashMap for Node JS"
, "keywords": ["hashmap", "map", "object", "array", "associative", "javascript", "nodejs", "node", "browser"]
, "license": "MIT"
, "repository": "git://github.com/flesler/hashmap"
, "main": "./hashmap.js"
, "engines": { "node": "*" }
, "dependencies": {
"name": "hashmap",
"author": "Ariel Flesler <aflesler@gmail.com>",
"version": "1.0.1",
"description": "HashMap Class for JavaScript",
"keywords": ["hashmap", "map", "object", "array", "associative", "javascript", "nodejs", "node", "browser"],
"license": "MIT",
"homepage": "https://github.com/flesler/hashmap",
"bugs": "https://github.com/flesler/hashmap/issues",
"repository": "git://github.com/flesler/hashmap",
"main": "./hashmap.js",
"scripts": {
"test": "./node_modules/.bin/mocha test/*.js"
},
"engines": { "node": "*" },
"dependencies": {},
"devDependencies": {
"mocha": "*",
"chai": "*"
}
}
# HashMap Class for JavaScript
## Installation
Using npm:
$ npm install hashmap
Using bower:
$ bower install hashmap
You can download the last stable version from the [releases page](https://github.com/flesler/hashmap/releases).
If you like risk, you can download the [latest master version](https://raw.github.com/flesler/hashmap/master/hashmap.js), it's usually stable.
To run the tests:
$ npm test
## Description
This project provides a `HashMap` class that works both on __NodeJS__ and the __browser__.
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 won't 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`)
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`)

@@ -53,12 +71,31 @@ ## Examples

[Check the tests](https://github.com/flesler/hashmap/blob/master/test/all.js) for some more real code.
[Check the tests](test/test.js) for some more real code.
## LICENSE
The MIT License (MIT)
Copyright (c) 2014 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
## TODO's
This project is in early development, so any feedback/changes are specially appreciated.
* (?) Allow extending the hashing function in a AOP way or by passing a service
* Fix: The hashmap will expose an enumerable expando when `Object.defineProperty` doesn't exist maybe use a different hashing approach for this case like `Array.indexOf`
* Use a real test framework
* Make tests work on the browser
* Document the public API of HashMap's
* Document the public API of HashMap's
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