EnvironmentSource with all the default values used by the loader.
The default values are:
{ id: 'random id', isRequired: false, isOrdered: false, ignoreError: false, strategy: SourceStrategy.ADD,};
loaderSourceFactory({ load: () => [{}] });// {// id: '1fvtjeqav0.fpjcvk57vno',// isRequired: false,// isOrdered: false,// ignoreError: false,// strategy: SourceStrategy.ADD,// load: () => [{}]// }
const source = { id: 'a', isRequired: true, isOrdered: true, ignoreError: true, strategy: SourceStrategy.MERGE, path: 'a', load: () => [{}]};loaderSourceFactory(source);// {// id: 'a',// isRequired: true,// isOrdered: true,// ignoreError: true,// strategy: SourceStrategy.MERGE,// path: 'a',// load: () => [{}]// }
loaderSourceFactory({ load: 0 }); // throws InvalidSourceError
const source1 = { load: () => [{ a: 0 }] };loaderSourcesFactory(source1);// [{// id: '1fvtjeqav0.fpjcvk57vno',// isRequired: false,// isOrdered: false,// ignoreError: false,// strategy: SourceStrategy.ADD,// load: () => [{a:0}]// }]
const source1 = { load: () => [{ a: 0 }] };const source2 = { load: () => [{ a: 1 }] };loaderSourcesFactory([source1, source2]);// [{// id: '1fvtjeqav0.fpjcvk57vno',// isRequired: false,// isOrdered: false,// ignoreError: false,// strategy: SourceStrategy.ADD,// load: () => [{a:0}]// },// {// id: '1fvtjfh8q0.tnprppqrf3g',// isRequired: false,// isOrdered: false,// ignoreError: false,// strategy: SourceStrategy.ADD,// load: () => [{a:1}]// }]
loaderSourcesFactory({ load: 0 }); // throws InvalidSourceError
const source1 = { id: 'a', load: () => [{ a: 0 }] };const source2 = { id: 'a', load: () => [{ a: 1 }] };loaderSourcesFactory([source1, source2]); // throws DuplicatedSourcesError
new DuplicatedSourcesError(['a', 'b']); // There are sources with duplicate id's: a, b
Generated using TypeDoc
Loader Source
Use cases
Table of Contents
loaderSourceFactory
The default values are:
loaderSourcesFactory
Errors