JSPM

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

Set for RDFJS Terms

Package Exports

  • @rdfjs/term-set

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rdfjs/term-set) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@rdfjs/term-set

A Set for RDFJS Terms.

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

Usage

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

const rdf = require('@rdfjs/data-model')
const TermSet = require('@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')))