Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 2.17 KB

README.md

File metadata and controls

56 lines (40 loc) · 2.17 KB

multisource

Load partial values from multiple sources, such as other files.

npm version build Coverage Status Known Vulnerabilities DeepScan grade Maintainability

Voxgig This open source module is sponsored and supported by Voxgig.

Basic Example

# 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 }

Options

  • implictExt
    • 0: string (default: jsonic) - 0
    • 1: string (default: jsc) - 1
    • 2: string (default: json) - 2
    • 3: string (default: js) - 3
  • 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