UNPKG

695 BJavaScriptView Raw
1import { DEFAULT_CONFIG } from '../core/config'
2import { MATRIX_OPTIONS, NUMBER_OPTIONS } from '../core/function/config'
3
4// create a read-only version of config
5export const config = /* #__PURE__ */ function (options) {
6 if (options) {
7 throw new Error('The global config is readonly. \n' +
8 'Please create a mathjs instance if you want to change the default configuration. \n' +
9 'Example:\n' +
10 '\n' +
11 ' import { create, all } from \'mathjs\';\n' +
12 ' const mathjs = create(all);\n' +
13 ' mathjs.config({ number: \'BigNumber\' });\n')
14 }
15
16 return Object.freeze(DEFAULT_CONFIG)
17}
18Object.assign(config, DEFAULT_CONFIG, { MATRIX_OPTIONS, NUMBER_OPTIONS })