MCPcopy Create free account
hub / github.com/ljharb/qs / encoder

Function encoder

test/stringify.js:1280–1288  ·  view source on GitHub ↗
(str, defaultEncoder, charset, type)

Source from the content-addressed store, hash-verified

1278
1279 t.test('allows for encoding keys and values differently', function (st) {
1280 var encoder = function (str, defaultEncoder, charset, type) {
1281 if (type === 'key') {
1282 return defaultEncoder(str, defaultEncoder, charset, type).toLowerCase();
1283 }
1284 if (type === 'value') {
1285 return defaultEncoder(str, defaultEncoder, charset, type).toUpperCase();
1286 }
1287 throw 'this should never happen! type: ' + type;
1288 };
1289
1290 st.deepEqual(qs.stringify({ KeY: 'vAlUe' }, { encoder: encoder }), 'key=VALUE');
1291

Callers 2

stringifyFunction · 0.85
stringify.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected