JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2217
  • Score
    100M100P100Q120598F
  • License MIT

Immutable ProximityMap implementation for TypeScript

Package Exports

  • @rimbu/proximity
  • @rimbu/proximity/common
  • @rimbu/proximity/map
  • @rimbu/proximity/map-custom

Readme

npm version Deno

Licence

@rimbu/proximity

Welcome to @rimbu/proximity! This package provides proximity-based collections, with the ProximityMap type being the highlight. These collections use a configurable DistanceFunction to determine the proximity of values or objects, making them ideal for scenarios where spatial relationships matter.

Key Features:

  • Proximity-Based Mapping: Use a DistanceFunction to compare keys based on their proximity.
  • Flexible Configurations: Customize how proximity is calculated to suit your specific needs.

Exported Types:

Name Description
ProximityMap<K, V> A map with entries of key type K and value type V, where keys are compared via a DistanceFunction.

Documentation

For complete documentation, please visit the Map page in the Rimbu Docs, or directly explore the Rimbu Proximity API Docs.

Try It Out

Experience @rimbu/proximity in action! Try Out Rimbu on CodeSandBox.

Installation

Compabitity

Package Managers

Yarn:

yarn add @rimbu/proximity

npm:

npm install @rimbu/proximity

Bun:

bun add @rimbu/proximity

Deno Setup

Create or edit import_map.json in your project root:

{
  "imports": {
    "@rimbu/": "https://deno.land/x/rimbu@x.y.z/"
  }
}

Replace x.y.z with the desired version.

In this way you can use relative imports from Rimbu in your code, like so:

import { List } from '@rimbu/core/mod.ts';
import { ProximityMap } from '@rimbu/proximity/mod.ts';

Note that for sub-packages, due to conversion limitations it is needed to import the index.ts instead of mod.ts, like so:

import { ProximityMap } from '@rimbu/proximity/map/index.ts';

To run your script (let's assume the entry point is in src/main.ts):

deno run --import-map import_map.json src/main.ts

Usage

import { ProximityMap } from '@rimbu/proximity';

console.log(
  ProximityMap.from([
    [1, 'A'],
    [2, 'B'],
  ]).toString()
);

Author

Created and maintained by Arvid Nicolaas and Gianluca Costa.

Contributing

We welcome contributions! Please read our Contributing guide.

Contributors

Made with contributors-img.

License

This project is licensed under the MIT License. See the LICENSE for details.