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

    1.1.0 • Public • Published

    @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:

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

    Install

    npm i @rdfjs/term-map

    DownloadsWeekly Downloads

    562

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    13.9 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar
    • avatar