Intial Commit

This commit is contained in:
valki
2020-10-17 18:42:50 +02:00
commit 664c6d8ca3
5892 changed files with 759183 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
module.exports = [
require('./reviver')
];

View File

@@ -0,0 +1,22 @@
'use strict';
function factory (type, config, load, typed) {
/**
* Instantiate mathjs data types from their JSON representation
* @param {string} key
* @param {*} value
* @returns {*} Returns the revived object
*/
return function reviver(key, value) {
var constructor = type[value && value.mathjs];
if (constructor && typeof constructor.fromJSON === 'function') {
return constructor.fromJSON(value);
}
return value;
}
}
exports.name = 'reviver';
exports.path = 'json';
exports.factory = factory;