Opal-Estate-Pro/node_modules/browser-sync/dist/cli/transforms/handlePortsOption.js

27 lines
850 B
JavaScript
Raw Normal View History

2019-09-13 06:27:52 +02:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var immutable_1 = require("immutable");
function handlePortsOption(incoming) {
var value = incoming.get('ports');
if (!value)
return [incoming, []];
var obj = { min: null, max: null };
if (typeof value === "string") {
if (~value.indexOf(",")) {
var segs = value.split(",");
obj.min = parseInt(segs[0], 10);
obj.max = parseInt(segs[1], 10);
}
else {
obj.min = parseInt(value, 10);
obj.max = null;
}
}
else {
obj.min = value.get("min");
obj.max = value.get("max") || null;
}
return [incoming.set('ports', immutable_1.Map(obj)), []];
}
exports.handlePortsOption = handlePortsOption;
//# sourceMappingURL=handlePortsOption.js.map