crayon-syntax-highlighter/util/sample/js.txt

13 lines
243 B
Plaintext
Raw Normal View History

2019-08-30 19:30:19 +02:00
// Convert '-10px' to -10
function px_to_int(pixels) {
if (typeof pixels != 'string') {
return 0;
}
var result = pixels.replace(/[^-0-9]/g, '');
if (result.length == 0) {
return 0;
} else {
return parseInt(result);
}
}