Load partial values from multiple sources, such as other files.
This open source module is sponsored and supported by Voxgig. |
---|
# file: foo.jsonic
a:1
import { Jsonic } from '@jsonic/jsonic-next'
import { MultiSource } from '@jsonic/multisource'
import { makeFileResolver } from '@jsonic/multisource/resolver/file'
let j = Jsonic.make().use(MultiSource, {
resolver: makeFileResolver(),
})
const out = j('@"foo.jsonic" b:2')
// out === { a:1, b:2 }
- implictExt
- 0:
string
(default: jsonic) - 0 - 1:
string
(default: jsc) - 1 - 2:
string
(default: json) - 2 - 3:
string
(default: js) - 3
- 0:
- markchar:
string
(default: @) - markchar - processor
- __:
function
(default: (res) => (res.val = process(res.src, res))) - - js:
instance
(required) - js - jsc:
instance
(required) - jsc - json:
function
(default: (res) => (res.val = process(res.src, res))) - json - jsonic:
instance
(required) - jsonic
- __: