one
Version:
One is a React framework for web, iOS, and Android apps.
1 lines • 3.56 kB
Source Map (JSON)
{"version":3,"file":"validation.js","names":[],"sources":["esm/platform/location/validation.js"],"sourcesContent":["function isFiniteNumber(value) {\n return typeof value === \"number\" && Number.isFinite(value);\n}\nfunction assertCenter(center, verb) {\n if (!center || typeof center !== \"object\") {\n throw new TypeError(`Location.${verb}: region center must be an object`);\n }\n const candidate = center;\n if (!isFiniteNumber(candidate.latitude) || Math.abs(candidate.latitude) > 90) {\n throw new TypeError(\n `Location.${verb}: region center latitude must be a number from -90 to 90`\n );\n }\n if (!isFiniteNumber(candidate.longitude) || Math.abs(candidate.longitude) > 180) {\n throw new TypeError(\n `Location.${verb}: region center longitude must be a number from -180 to 180`\n );\n }\n}\nfunction assertRegion(region, verb) {\n if (!region || typeof region !== \"object\") {\n throw new TypeError(`Location.${verb}: region must be an object`);\n }\n const candidate = region;\n if (typeof candidate.identifier !== \"string\" || candidate.identifier.trim() === \"\") {\n throw new TypeError(\n `Location.${verb}: region identifier must be a non-empty string`\n );\n }\n assertCenter(candidate.center, verb);\n if (!isFiniteNumber(candidate.radius) || candidate.radius <= 0) {\n throw new TypeError(\n `Location.${verb}: region radius must be a number greater than 0`\n );\n }\n if (candidate.notifyOnEntry !== void 0 && typeof candidate.notifyOnEntry !== \"boolean\") {\n throw new TypeError(\n `Location.${verb}: region notifyOnEntry must be a boolean`\n );\n }\n if (candidate.notifyOnExit !== void 0 && typeof candidate.notifyOnExit !== \"boolean\") {\n throw new TypeError(`Location.${verb}: region notifyOnExit must be a boolean`);\n }\n}\nfunction assertIdentifier(identifier, verb) {\n if (typeof identifier !== \"string\" || identifier.trim() === \"\") {\n throw new TypeError(\n `Location.${verb}: region identifier must be a non-empty string`\n );\n }\n}\nfunction assertRegionListener(listener, verb) {\n if (typeof listener !== \"function\") {\n throw new TypeError(`Location.${verb}: listener must be a function`);\n }\n}\nexport {\n assertIdentifier,\n assertRegion,\n assertRegionListener\n};\n//# sourceMappingURL=validation.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