decord/source/7637_parseSampleRate.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 7637
// Function ID: 7638
2026-07-20 16:05:17 +00:00
// Name: parseSampleRate
2026-08-25 06:04:03 +00:00
// Dependencies: [7625, 7597]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 7637 (parseSampleRate)
import consoleSandbox from "consoleSandbox" /* 7597 */;
import __SENTRY_DEBUG__ from "__SENTRY_DEBUG__" /* 7625 */;
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-23 10:11:24 +00:00
const dependencyMap = arg6;
2026-08-04 21:03:28 +00:00
arg5.parseSampleRate = function parseSampleRate(flag) {
if (typeof flag === "boolean") {
2026-07-20 16:05:17 +00:00
const _Number = Number;
2026-08-04 21:03:28 +00:00
return Number(flag);
2026-07-20 16:05:17 +00:00
} else {
2026-08-04 21:03:28 +00:00
let parsed = flag;
if (typeof flag === "string") {
2026-07-20 16:05:17 +00:00
const _parseFloat = parseFloat;
2026-08-04 21:03:28 +00:00
parsed = parseFloat(flag);
2026-07-20 16:05:17 +00:00
}
2026-08-04 21:03:28 +00:00
if (typeof parsed === "number") {
2026-07-20 16:05:17 +00:00
const _isNaN = isNaN;
if (!isNaN(parsed)) {
if (parsed >= 0) {
if (parsed <= 1) {
return parsed;
}
}
}
}
2026-08-24 06:08:38 +00:00
if (__SENTRY_DEBUG__.DEBUG_BUILD) {
const logger = consoleSandbox.logger;
2026-07-20 16:05:17 +00:00
const _JSON = JSON;
2026-08-04 21:03:28 +00:00
const json = JSON.stringify(flag);
2026-07-20 16:05:17 +00:00
const _JSON2 = JSON;
const _HermesInternal = HermesInternal;
2026-08-04 21:03:28 +00:00
logger.warn("[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got " + json + " of type " + JSON.stringify(typeof flag) + ".");
2026-07-20 16:05:17 +00:00
}
}
};