diff options
author | bptato <nincsnevem662@gmail.com> | 2023-10-21 23:55:55 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-10-21 23:55:55 +0200 |
commit | 2ee13b361e84d1f21f3cd4864d18b0fc2751f75d (patch) | |
tree | 3e4efcd8071a687f328a572a96f6b3f09757380e /src/js/fromjs.nim | |
parent | 28473c9e9a44567642785901f6fe198968a99db9 (diff) | |
download | chawan-2ee13b361e84d1f21f3cd4864d18b0fc2751f75d.tar.gz |
fromjs: remove IsNumber check from float, remove unused functions
Diffstat (limited to 'src/js/fromjs.nim')
-rw-r--r-- | src/js/fromjs.nim | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/js/fromjs.nim b/src/js/fromjs.nim index eb03af40..00aea78b 100644 --- a/src/js/fromjs.nim +++ b/src/js/fromjs.nim @@ -94,8 +94,6 @@ func fromJSInt[T: SomeInteger](ctx: JSContext, val: JSValue): proc fromJSFloat[T: SomeFloat](ctx: JSContext, val: JSValue): JSResult[T] = - if not JS_IsNumber(val): - return err() var f64: float64 if JS_ToFloat64(ctx, addr f64, val) < 0: return err() @@ -324,21 +322,6 @@ proc fromJSFunction[T](ctx: JSContext, val: JSValue): typeof(unpackArg0(T)) ](ctx, val)) -proc fromJSChar(ctx: JSContext, val: JSValue): Opt[char] = - let s = ?toString(ctx, val) - if s.len > 1: - return err() - return ok(s[0]) - -proc fromJSRune(ctx: JSContext, val: JSValue): Opt[Rune] = - let s = ?toString(ctx, val) - var i = 0 - var r: Rune - fastRuneAt(s, i, r) - if i < s.len: - return err() - return ok(r) - template optionType[T](o: type Option[T]): auto = T @@ -452,10 +435,6 @@ proc fromJS*[T](ctx: JSContext, val: JSValue): JSResult[T] = return fromJSString(ctx, val) elif T is JSString: return fromJSString2(ctx, val) - elif T is char: - return fromJSChar(ctx, val) - elif T is Rune: - return fromJSRune(ctx, val) elif T is (proc): return fromJSFunction[T](ctx, val) elif T is Option: |