New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

jsld

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsld

Javascript linked representation of JSON-LD graphs

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
5
-16.67%
Maintainers
1
Weekly downloads
 
Created
Source

jsld

Introduction

Library to create and visit a JS object representation of JSON-LD graphs, that we call JS-LD. JS-LD objects respect JSON-LD syntax but all the links between resources are represented as actual links (they are actual JS graphs, while JSON-LD is always serialized as a tree).

To explore a graph in JSON-LD notation, the developer has to know the specific way in which it has been serialized. Conversely, as JS-LD objects they have only a possible serialization and can be explored in multiple ways.

Requiring jsld.js:

node.js + npm

npm install jsld
var jsld = require('jsld');

Usage

/**
 * Creates a JS-LD graph representing a JSON-LD graph.
 * The JS-LD graph is a JS representation based on a JSON-LD named map with
 * every link added.
 *
 * @param jsonldInput the JSON-LD input graph.
 * @param ctx the context to compact with.
 * @param options object with options passed directly to jsonld.createNodeMap().
 * @param callback(err, graph) callback function taking an error or the JS-LD graph.
 */
jsld.convert(jsonldInput, ctx, options, callback);

Example of use

var jsldGraph = jsld.convert(jsonldGraph, jsonldContextToCompact, null, function(err, result) {
  if (err) {
    console.log(err);
  } else if (result) {
    ...
  }
}););

Keywords

JSON-LD

FAQs

Package last updated on 29 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts