{"size": 2074, "ext": "js", "max_stars_repo_path": "scripts/export-data.js", "max_stars_repo_name": "swhiteman/q-encoding", "max_stars_repo_stars_event_min_datetime": "2015-05-20T07:58:15.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T22:50:26.000Z", "max_issues_repo_path": "scripts/export-data.js", "max_issues_repo_name": "swhiteman/q-encoding", "max_issues_repo_issues_event_min_datetime": "2016-11-10T12:56:20.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-08T06:55:41.000Z", "max_forks_repo_path": "scripts/export-data.js", "max_forks_repo_name": "swhiteman/q-encoding", "max_forks_repo_forks_event_min_datetime": "2016-11-09T22:25:17.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-08T06:58:12.000Z"}
{"max_stars_count": 14, "max_issues_count": 4, "max_forks_count": 2, "avg_line_length": 45.0869565217, "max_line_length": 77, "alphanum_fraction": 0.637415622}
var fs = require('fs');
var regenerate = require('regenerate');

// Let’s start with the safe/unsafe symbols in `Quoted-Printable` encoding.
// https://tools.ietf.org/html/rfc2045#section-6.7
//
// safe-char := <any octet with decimal value of 33 through
//              60 inclusive, and 62 through 126>
//              ; Characters not listed as "mail-safe" in
//              ; RFC 2049 are also not recommended.
// hex-octet := "=" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F")
//              ; Octet must be used for characters > 127, =,
//              ; SPACEs or TABs at the ends of lines, and is
//              ; recommended for any character not listed in
//              ; RFC 2049 as "mail-safe".
//
// https://tools.ietf.org/html/rfc2047#section-5 restricts this much
// more severely in the case quoting is used for a “word” in an email header:
//
//    In this case the set of characters that may be used in a "Q"-encoded
//    'encoded-word' is restricted to: <upper and lower case ASCII
//    letters, decimal digits, "!", "*", "+", "-", "/", "=", and "_"
//    (underscore, ASCII 95.)>.  An 'encoded-word' that appears within a
//    'phrase' MUST be separated from any adjacent 'word', 'text' or
//    'special' by 'linear-white-space'.

var safeSymbols = regenerate()
	.addRange('A', 'Z')
	.addRange('a', 'z') // lower case ASCII
	.addRange('0', '9') // decimal digits
	.add('!', '*', '+', '-', '/', '_');
var definitelyUnsafeSymbols = regenerate()
	.addRange(0x0, 0x10FFFF)
	// Note: the script assumes the input is already encoded into octets (e.g.
	// using UTF-8), and that the resulting octets are within the extended ASCII
	// range. Thus, there is no need to match astral symbols.
	.removeRange(0x010000, 0x10FFFF)
	.remove(safeSymbols)
	.remove(' '); // Note: space is excluded because it’s special-cased.
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-pairs

module.exports = {
	'unsafeSymbols': definitelyUnsafeSymbols.toString({ 'bmpOnly': true }),
	'version': JSON.parse(fs.readFileSync('package.json', 'utf-8')).version
};
