normalizeRouteForWrite — @gj-kit/expo-workouts
A public function from @gj-kit/expo-workouts. The signature below is taken directly from the 0.1.1 release declaration.
Verified import example
Section titled “Verified import example”import { normalizeRouteForWrite } from '@gj-kit/expo-workouts';Signature, parameters, and return type
Section titled “Signature, parameters, and return type”/** * Apply the write-side hygiene the library performs, so you can see what will happen before you call * `saveWorkout`. Throws `invalidArgument` for out-of-range coordinates. The rules and their order * are §8.2's and are pinned by `tests/fixtures/route-vectors.json`, which also drives the Swift and * Kotlin tests. * * Order (do not reorder — the platforms disagree and this order is what makes them agree): * 1. an EMPTY array is `invalidArgument` — say `route: 'none'` instead; * 2. non-finite `t`/`lat`/`lon`, or `lat` outside ±90 / `lon` outside ±180, is `invalidArgument` * (rejected, NOT dropped — silently discarding hides a data-corruption signal); * 3. points with `hAccM < 0` or `hAccM > 50` are DROPPED (`hAccM === undefined` is kept); * 4. points outside `[window.startMs, window.endMs)` are DROPPED — deliberately not clamped: * clamping piles every out-of-window point onto one boundary instant and rule 5 then collapses * them into a single point, i.e. it fabricates timestamps AND destroys more data; * 5. sorted ascending by `t`, and for equal `t` the LAST point in input order wins — matching what * HealthKit silently does, so that both platforms agree instead of one throwing. * * Zero survivors is not an error here: `saveWorkout` reports it as `route: 'dropped'`. */declare function normalizeRouteForWrite(points: readonly RoutePoint[], window: Interval): readonly RoutePoint[];This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.
Release context
Section titled “Release context”- Package:
@gj-kit/expo-workouts - Version:
0.1.1 - Public entry:
. - Source: GitHub