# @ontola/memoized-hash-factory

> RDF Factory optimized for memory usage.

Latest version **2.1.0** (published 2022-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ontola/memoized-hash-factory
pnpm add @ontola/memoized-hash-factory
yarn add @ontola/memoized-hash-factory
bun add @ontola/memoized-hash-factory
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2022-05-30 |
| First published | 2019-10-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 50.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | fletcher91 |
| Keywords | rdf, rdfjs, data factory, rdf factory, ontologies, ontologies/core, linked data, link-lib, link-redux |

## Links

- npm: https://www.npmjs.com/package/@ontola/memoized-hash-factory
- npm.io page: https://npm.io/package/@ontola/memoized-hash-factory

## Dependencies (1)

- [murmurhash-js](https://npm.io/package/murmurhash-js.md) ^1.0.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 2.1.0 (latest) — 2022-05-30
- 2.0.0-alpha.0 (next) — 2020-01-14
- 2.0.1 — 2020-06-19
- 2.0.0 — 2020-03-30
- 2.0.0-alpha.2 — 2020-01-16
- 2.0.0-alpha.1 — 2020-01-15
- 1.2.1 — 2019-11-27
- 1.2.0 — 2019-11-27
- 1.1.2 — 2019-11-21
- 1.1.1 — 2019-11-15
- 1.1.0 — 2019-11-15
- 1.0.3 — 2019-11-12
- 1.0.2 — 2019-11-12
- 1.0.1 — 2019-10-23
- 1.0.0 — 2019-10-21

## README

# `@ontola/memoized-hash-factory`

[RDFJS compatible data factory](http://rdf.js.org/data-model-spec/) which implements memoization
based on the term's hash. Once a term is created the same instance will be returned for future
requests.

This saves memory and allows comparison by reference (`===`) which is great for browsers on mobile
devices, but can cause out of memory exceptions for long running processes since the current
implementation will always hold a strong reference to the created objects (I.e. they can't be
garbage collected).

See [@ontologies/core](https://npmjs.com/package/@ontologies/core) for more info on usage.

## Usage
Put the following in a file;

```javascript
/* useMemoizedHashFactory.js */
import singletonInstance from "@ontola/memoized-hash-factory";
import { setup } from "@ontologies/core";

setup(singletonInstance)
```

It is important to import the code which calls `setup` before importing any of the
`@ontologies/package` helpers, since their exports use the factory which you pass to `setup`;

```javascript
// This must be done first
import "./useMemoizedHashFactory"

// This import will use the factory you passed to `setup`.
import schema from "@ontologies/schema"
```

---
_Source: https://npm.io/package/@ontola/memoized-hash-factory · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
