@rksan/mock-media-devices
Version:
WebAPI window.navigator.mediaDevices のモック
92 lines (91 loc) • 2.25 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConstrainDoubleValue = exports.getConstrainULongValue = exports.getConstrainBooleanValue = exports.getConstrainDOMStringValue = void 0;
const getConstrainDOMStringValue = (def, val) => {
const v = val;
if (typeof v === "undefined") {
return def;
}
if (typeof v === "string") {
return v;
}
else if (typeof v.exact === "string") {
return v.exact;
}
else if (typeof v.ideal === "string") {
return v.ideal;
}
else {
return def;
}
};
exports.getConstrainDOMStringValue = getConstrainDOMStringValue;
const getConstrainBooleanValue = (def, val) => {
const v = val;
if (typeof v === "undefined") {
return def;
}
if (typeof v === "boolean") {
return v;
}
else if (typeof v.exact === "boolean") {
return v.exact;
}
else if (typeof v.ideal === "boolean") {
return v.ideal;
}
else {
return def;
}
};
exports.getConstrainBooleanValue = getConstrainBooleanValue;
const getConstrainULongValue = (def, val) => {
const v = val;
if (typeof v === "undefined") {
return def;
}
if (typeof v === "number") {
return v;
}
else if (typeof v.exact === "number") {
return v.exact;
}
else if (typeof v.ideal === "number") {
return v.ideal;
}
else if (typeof v.max === "number") {
return v.max;
}
else if (typeof v.min === "number") {
return v.min;
}
else {
return def;
}
};
exports.getConstrainULongValue = getConstrainULongValue;
const getConstrainDoubleValue = (def, val) => {
const v = val;
if (typeof v === "undefined") {
return def;
}
if (typeof v === "number") {
return v;
}
else if (typeof v.exact === "number") {
return v.exact;
}
else if (typeof v.ideal === "number") {
return v.ideal;
}
else if (typeof v.max === "number") {
return v.max;
}
else if (typeof v.min === "number") {
return v.min;
}
else {
return def;
}
};
exports.getConstrainDoubleValue = getConstrainDoubleValue;