@rdfjs/term-set
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/rdfjs__term-set package

2.0.2 • Public • Published

@rdfjs/term-set

build status npm version

A Set for RDF/JS Terms.

This package implements the JavaScript Set interface exclusively for RDF/JS Terms and treats Terms with the same N-Triples representation as they are the same object.

Usage

Use the following command to add the package as a dependency to your project:

npm install @rdfjs/term-set --save

The package exports the constructor of the Term-Set. New instances can be created just like JavaScript Sets:

import rdf from '@rdfjs/data-model'
import TermSet from '@rdfjs/term-set'

const terms = new TermSet([
  rdf.namedNode('http://example.org/'),
  rdf.literal('test')
])

// The rdf factory will return a new instance of the literal,
// but the Term-Set will check for the N-Triple representation.
// That's why the output will be: "true"
console.log(terms.has(rdf.literal('test')))

Readme

Keywords

Package Sidebar

Install

npm i @rdfjs/term-set

Weekly Downloads

13,729

Version

2.0.2

License

MIT

Unpacked Size

15.8 kB

Total Files

9

Last publish

Collaborators

  • bergos