StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
'use strict';
|
|
|
|
/**
|
|
* Is this string all whitespace?
|
|
* This solution kind of makes my brain hurt, but it's significantly faster
|
|
* than !str.trim() or any other solution I could find.
|
|
*
|
|
* whitespace codes from: http://en.wikipedia.org/wiki/Whitespace_character
|
|
* and verified with:
|
|
*
|
|
* for(var i = 0; i < 65536; i++) {
|
|
* var s = String.fromCharCode(i);
|
|
* if(+s===0 && !s.trim()) console.log(i, s);
|
|
* }
|
|
*
|
|
* which counts a couple of these as *not* whitespace, but finds nothing else
|
|
* that *is* whitespace. Note that charCodeAt stops at 16 bits, but it appears
|
|
* that there are no whitespace characters above this, and code points above
|
|
* this do not map onto white space characters.
|
|
*/
|
|
|
|
module.exports = function(str){
|
|
var l = str.length,
|
|
a;
|
|
for(var i = 0; i < l; i++) {
|
|
a = str.charCodeAt(i);
|
|
if((a < 9 || a > 13) && (a !== 32) && (a !== 133) && (a !== 160) &&
|
|
(a !== 5760) && (a !== 6158) && (a < 8192 || a > 8205) &&
|
|
(a !== 8232) && (a !== 8233) && (a !== 8239) && (a !== 8287) &&
|
|
(a !== 8288) && (a !== 12288) && (a !== 65279)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|