Sha256: b33607e495b910c3a4b26936c9edf4b85c22964ec88e03e66f1e89a8ba1cc026

Contents?: true

Size: 1.05 KB

Versions: 24

Compression:

Stored size: 1.05 KB

Contents

// Load modules


// Declare internals

var internals = {
    delimiter: '&'
};


internals.stringify = function (obj, prefix) {

    if (Buffer.isBuffer(obj)) {
        obj = obj.toString();
    }
    else if (obj instanceof Date) {
        obj = obj.toISOString();
    }
    else if (obj === null) {
        obj = '';
    }

    if (typeof obj === 'string' ||
        typeof obj === 'number' ||
        typeof obj === 'boolean') {

        return [encodeURIComponent(prefix) + '=' + encodeURIComponent(obj)];
    }

    var values = [];

    for (var key in obj) {
        if (obj.hasOwnProperty(key)) {
            values = values.concat(internals.stringify(obj[key], prefix + '[' + key + ']'));
        }
    }

    return values;
};


module.exports = function (obj, delimiter) {

    delimiter = typeof delimiter === 'undefined' ? internals.delimiter : delimiter;

    var keys = [];

    for (var key in obj) {
        if (obj.hasOwnProperty(key)) {
            keys = keys.concat(internals.stringify(obj[key], key));
        }
    }

    return keys.join(delimiter);
};

Version data entries

24 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
hooch-0.4.1 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
hooch-0.4.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
hooch-0.3.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
hooch-0.2.1 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
hooch-0.2.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
hooch-0.1.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
hooch-0.0.8 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
hooch-0.0.7 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
hooch-0.0.6 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.16 spec/dummy/public/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.15 spec/dummy/public/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.14 spec/dummy/public/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.13 spec/dummy/public/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.12 spec/dummy/public/node_modules/phantomjs/node_modules/request/node_modules/qs/lib/stringify.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/request/node_modules/qs/lib/stringify.js