1 | var toString = require('../lang/toString');
|
2 | /**
|
3 | * Remove non-printable ASCII chars
|
4 | */
|
5 | function removeNonASCII(str){
|
6 | str = toString(str);
|
7 |
|
8 | // Matches non-printable ASCII chars -
|
9 | // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
|
10 | return str.replace(/[^\x20-\x7E]/g, '');
|
11 | }
|
12 |
|
13 | module.exports = removeNonASCII;
|
14 |
|