-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (25 loc) · 930 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const rdfFetch = require('rdf-fetch')
const SimpleFetchLite = require('simplerdf-fetch-lite')
class SimpleFetch extends SimpleFetchLite {
init (context, iri, graph, options) {
this._options.rdfFetch = options.rdfFetch || SimpleFetch.defaults.rdfFetch
}
fetch (url, options) {
options = options || {}
options.simpleFactory = this.create
options.context = options.context || this.context()
options.rdfFetch = options.rdfFetch || this._options.rdfFetch
return SimpleFetch.fetch(url, options)
}
static fetch (url, options) {
options = options || {}
options.context = options.context || SimpleFetch.defaults.context
options.formats = options.formats || rdfFetch.defaults.formats
options.rdfFetch = options.rdfFetch || SimpleFetch.defaults.rdfFetch
return SimpleFetchLite.fetch(url, options)
}
}
SimpleFetch.defaults = {
rdfFetch: rdfFetch
}
module.exports = SimpleFetch