An Ember-friendly jsonld.js wrapper.
- Returns RSVP promises.
- Can be installed as an Ember-CLI addon.
ember install ember-jsonld
import { expand, compact, flatten, frame, toRDF, normalize } from 'ember-jsonld';
expand(json).then(function(expanded) {
// expansion success
}).catch(function(error) {
// expansion failure
}).finally(function() {
// expansion success or failure
});
var hash = Ember.RSVP.hash({
expanded: expand(json),
compacted: compact(json, context),
flattened: flatten(json),
framed: frame(json, frame),
nquads: toRDF(json, {format: 'application/nquads'}),
normalized: normalize(json, {format: 'application/nquads'})
});
Installing dependencies and running tests:
npm install && npm test