
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
javasetmap.ts
Advanced tools
Java-style Set and Map collections (on `{ hashCode(): int, equals(x: any): boolean}` objects) written in TypeScript.
Java-style Set and Map collections (on { hashCode(): int, equals(x: any): boolean}
objects) written in TypeScript.
NPM: npm install javasetmap.ts --save
In the browser, you can include the UMD bundle in a script tag, and the module will be available under the global javasetmap_ts
import {JavaMap} from 'javasetmap.ts'
// node: const {JavaMap} = require('javasetmap.ts')
// browser: const {JavaMap} = nla
declare global { // remove this block if not using TypeScript
interface Array<T> extends Equalable {}
interface Number extends Equalable {}
}
Array.prototype.equals = function (o) {
return this == o || this.length == o.length && this.every((el, i) => el.equals(o[i]))
}
Array.prototype.hashCode = function () {
return this.reduce((acc, current) => acc * 31 + current.hashCode(), 0)
}
Number.prototype.equals = function (o) { return this == o }
Number.prototype.hashCode = function () { return this | 0 }
const myMap = new JavaMap<[number, number], string>() // new JavaMap() if not using TypeScript
myMap.set([1, 2], "foo")
myMap.has([1, 2]) // === true
myMap.get([1, 2]) // === "foo"
myMap.has([1, 3]) // === false
myMap.get([2, 1]) // === undefined
LICENSE MIT
FAQs
Java-style Set and Map collections (on `{ hashCode(): int, equals(x: any): boolean}` objects) written in TypeScript.
The npm package javasetmap.ts receives a total of 3 weekly downloads. As such, javasetmap.ts popularity was classified as not popular.
We found that javasetmap.ts 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.