Package Exports
- @rdfjs/term-map
- @rdfjs/term-map/Factory.js
- @rdfjs/term-map/TermMap.js
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-map) 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-map
A Map for RDF/JS Terms keys.
This package implements the JavaScript Map interface exclusively for RDF/JS Terms keys and treats Terms with the same N-Triples representation as they are the same object.
Usage
The package exports the constructor of the Term-Map. New instances can be created just like JavaScript Maps:
import rdf from '@rdfjs/data-model'
import TermMap from '@rdfjs/term-map'
const terms = new TermMap([
[rdf.namedNode('http://example.org/'), { data: 1 }],
[rdf.literal('test'), { data: 2 }]
])
// The rdf factory will return a new instance of the literal,
// but the TermMap will check for the N-Triple representation.
// That's why the output will be: "true"
console.log(terms.has(rdf.literal('test')))