-
Notifications
You must be signed in to change notification settings - Fork 0
/
newtonmath-min.js
3 lines (2 loc) · 1.36 KB
/
newtonmath-min.js
1
2
3
(function(){'use strict';function a(a,b){return new Promise(function(c,d){let e='https://newton.now.sh/'+a+'/'+encodeURIComponent(b),f=new g.XMLHttpRequest;f.onload=function(){200<=this.status&&300>this.status?c(f.responseText):d({status:this.status,msg:f.statusText})},f.onerror=function(){d({status:this.status,msg:f.statusText})},f.open('GET',e),f.send()})}function b(b,e,f){a(b,e).then((a)=>f(c(JSON.parse(a)))).catch((a)=>d('HTTP status',a.status,a))}function c(a){if(a.hasOwnProperty('error'))d(a.error);else{let b=a.result;try{return JSON.parse(b)}catch(a){return b.constructor==String&&'nan'==b.toLowerCase()?NaN:b}}}function d(){console.error('NewtonMath error:',...arguments)}let e=this,f=e.NewtonMath,g={},h={};return g.XMLHttpRequest='undefined'==typeof e.XMLHttpRequest?require('xmlhttprequest').XMLHttpRequest:e.XMLHttpRequest,'undefined'==typeof exports?e.NewtonMath=h:('undefined'!=typeof module&&module.exports&&(exports=module.exports=h),exports.NewtonMath=h),h.noConflict=function(){return e.NewtonMath=f,h},['simplify','factor','derive','integrate','zeroes','tangent','area','cos','sin','tan','arccos','arcsin','arctan','abs','log'].forEach((a)=>{g[a]=(c,d)=>b(a,c,d),h[a]=g[a]}),h.log=(a,b,c)=>g.log(c?b+'|'+a:a,c?c:b),h.tangent=(a,b,c)=>g.tangent(c?b+'|'+a:a,c?c:b),h.area=(a,b,c,d)=>g.area(d?b+':'+c+'|'+a:a,d?d:b),h}).call(this);
//# sourceMappingURL=newtonmath-min.js.map