# @rdfjs/environment

> A flexible RDF/JS factory

Latest version **1.0.0** (published 2023-11-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rdfjs/environment
pnpm add @rdfjs/environment
yarn add @rdfjs/environment
bun add @rdfjs/environment
```

## Health

**Score 43/100 (D)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-11-18 |
| First published | 2021-07-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/rdfjs__environment) |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Thomas Bergwinkl |
| Maintainers | bergos |
| Keywords | rdf, rdfjs, environment |

## Links

- npm: https://www.npmjs.com/package/@rdfjs/environment
- Repository: https://github.com/rdfjs-base/environment
- Issues: https://github.com/rdfjs-base/environment/issues
- npm.io page: https://npm.io/package/@rdfjs/environment

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-11-18
- 0.1.2 — 2023-01-08
- 0.1.1 — 2021-11-27
- 0.1.0 — 2021-07-18

## README

# @rdfjs/environment

[![build status](https://img.shields.io/github/actions/workflow/status/rdfjs-base/environment/test.yaml?branch=master)](https://github.com/rdfjs-base/environment/actions/workflows/test.yaml)
[![npm version](https://img.shields.io/npm/v/@rdfjs/environment.svg)](https://www.npmjs.com/package/@rdfjs/environment)

This package provides a flexible RDF/JS factory.
The `Environment` class takes one or more RDF/JS factory classes and creates a new, merged instance.
All factory methods will use the `Environment` instance as factory to create new object instances.
Clones can be created to manipulate an instance isolated from other instances.

## Usage

The main export of the package is the `Environment` class.
It can be imported like this:

```javascript
import Environment from '@rdfjs/environment'
```

The following example shows how to build an environment that is a combined factory of a [DataFactory](http://rdf.js.org/data-model-spec/#datafactory-interface) and [DatasetCoreFactory](https://rdf.js.org/dataset-spec/#datasetcorefactory-interface): 

```javascript
import DataFactory from '@@rdfjs/data-model/Factory.js'
import DatasetFactory from '@rdfjs/dataset/Factory.js'
import Environment from '@rdfjs/environment'

const env = new Environment([DataFactory, DatasetFactory])
```

### Environment(factories)

Creates a new `Environment` instance.
`factories` must be an iterable (e.g., `Array`) of RDF/JS factory classes.

#### clone()

This method creates a new, isolated `Environment` instance with the same set of factories and clones of the instance data.

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