MCPcopy Create free account
hub / github.com/NativeScript/android / ToMaybePositiveValue

Function ToMaybePositiveValue

test-app/runtime/src/main/cpp/Timers.cpp:25–40  ·  view source on GitHub ↗

Takes a value and transform into a positive number returns a negative number if the number is negative or invalid

Source from the content-addressed store, hash-verified

23// Takes a value and transform into a positive number
24// returns a negative number if the number is negative or invalid
25inline static double
26ToMaybePositiveValue(const v8::Local<v8::Value> &v, const v8::Local<v8::Context> &ctx) {
27 double value = -1;
28 if (v->IsNullOrUndefined()) {
29 return -1;
30 }
31 Local<Number> numberValue;
32 auto success = v->ToNumber(ctx).ToLocal(&numberValue);
33 if (success) {
34 value = numberValue->Value();
35 if (isnan(value)) {
36 value = -1;
37 }
38 }
39 return value;
40}
41
42static double now_ms() {
43 struct timespec res;

Callers 2

ClearTimerMethod · 0.85
SetTimerMethod · 0.85

Calls 3

IsNullOrUndefinedMethod · 0.80
ToLocalMethod · 0.80
ValueMethod · 0.45

Tested by

no test coverage detected