MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / doNfc

Function doNfc

libraries/p5.js:31158–31180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31156 }
31157};
31158function doNfc() {
31159 var num = arguments[0].toString();
31160 var dec = num.indexOf('.');
31161 var rem = dec !== -1 ? num.substring(dec) : '';
31162 var n = dec !== -1 ? num.substring(0, dec) : num;
31163 n = n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
31164 if (arguments[1] === 0) {
31165 rem = '';
31166 }
31167 else if(arguments[1] !== undefined){
31168 if(arguments[1] > rem.length){
31169 rem+= dec === -1 ? '.' : '';
31170 var len = arguments[1] - rem.length + 1;
31171 for(var i =0; i< len; i++){
31172 rem += '0';
31173 }
31174 }
31175 else{
31176 rem = rem.substring(0, arguments[1] + 1);
31177 }
31178 }
31179 return n + rem;
31180}
31181
31182/**
31183 * Utility function for formatting numbers into strings. Similar to nf() but

Callers 1

p5.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected