{"size": 2338, "ext": "js", "max_stars_repo_path": "lib/_polyfill-quote.js", "max_stars_repo_name": "feliking/model-generator-sequelize", "max_stars_repo_stars_event_min_datetime": "2015-03-28T21:04:30.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-02T13:35:24.000Z", "max_issues_repo_path": "lib/_polyfill-quote.js", "max_issues_repo_name": "feliking/model-generator-sequelize", "max_issues_repo_issues_event_min_datetime": "2015-04-16T04:47:12.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-05T07:43:28.000Z", "max_forks_repo_path": "lib/_polyfill-quote.js", "max_forks_repo_name": "feliking/model-generator-sequelize", "max_forks_repo_forks_event_min_datetime": "2015-03-28T21:08:20.000Z", "max_forks_repo_forks_event_max_datetime": "2019-06-23T04:52:39.000Z"}
{"max_stars_count": 41, "max_issues_count": 21, "max_forks_count": 12, "avg_line_length": 38.9666666667, "max_line_length": 96, "alphanum_fraction": 0.4811804962}
/**
 * @private
 */
/*jslint node: true, nomen: true, regexp: true */
"use strict";

if (!String.prototype.quote) {
    // oop version - no dependencies
    String.prototype.quote = (function () {
        // prepare fallback
        // ----------------
        // backslash escape double quotes and backslashes
        var escp_regex = /[\\"]/g,
            escp_callback = '\\$&',
        // escape control characters
            ctrl_map = {
                '\b': '\\b', // backspace
                '\t': '\\t', // tab
                '\n': '\\n', // new line
                '\f': '\\f', // form feed
                '\r': '\\r'  // carriage return
            },
        // don't rely on `Object.keys(ctrl_map).join('')`
            ctrl_regex = new RegExp('[\b\t\n\f\r]', 'g'),
            ctrl_callback = function (match) {
                return ctrl_map[match];
            },
        // hex-escape, spare out control characters and ASCII printables
        // [0-7,11,14-31,127-255]
            xhex_regex = /[\x00-\x07\x0B\x0E-\x1F\x7F-\xFF]/g,
            xhex_callback = function (match, char_code) {
                char_code = match.charCodeAt(0);
                return '\\x' + (char_code < 16 ? '0' : '') + char_code;
            },
        // hex-escape all others
            uhex_regex = /[\u0100-\uFFFF]/g,
            uhex_callback = function (match, char_code) {
                char_code = match.charCodeAt(0);
                return '\\u' + (char_code < 4096 ? '0' : '') + char_code;
            },
        // delegate to native `JSON.stringify` if available
            stringify = typeof JSON !== 'undefined' && JSON.stringify;

        // return actual polyfill
        // ----------------------
        return function () {
            var self = this; // promote compression
            if (self === null) { throw new TypeError('can\'t convert ' + self + ' to object'); }
            if (stringify) { return stringify(self); }
            return '"' + self
                    .replace(escp_regex, escp_callback)
                    .replace(ctrl_regex, ctrl_callback)
                    .replace(xhex_regex, xhex_callback)
                    .replace(uhex_regex, uhex_callback) + '"';
        };
    }());

    // generic version - requires Function#bind
    String.quote = Function.call.bind(''.quote);
}