UNPKG

ductile

Version:

Elasticsearch Bulk Loader

41 lines (36 loc) 954 B
// Generated by CoffeeScript 1.11.1 (function() { var url; url = require('url'); module.exports = function(u) { var _, index, p, pass, query, ref, ref1, ref2, s, server, type, user; p = url.parse(u); s = []; s.push(p.protocol); s.push('//'); if (p.auth) { ref = p.auth.split(':'), user = ref[0], pass = ref[1]; s.push(encodeURIComponent(user)); if (pass) { s.push(':'); s.push(encodeURIComponent(pass)); } s.push('@'); } s.push(p.hostname); if (p.port) { s.push(':'); s.push(p.port); } server = s.join(''); ref2 = ((ref1 = p.pathname) != null ? ref1 : '').split('/'), _ = ref2[0], index = ref2[1], type = ref2[2]; query = p.query; return { server: server, index: index ? index : null, type: type ? type : null, query: query != null ? query : '' }; }; }).call(this); //# sourceMappingURL=parse.js.map