From 610e54366421d1238ea18956228a26851aa600a9 Mon Sep 17 00:00:00 2001 From: Dominik Honnef Date: Mon, 21 Oct 2013 20:49:56 +0200 Subject: [PATCH] implement strings.IndexByte --- translator/natives.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/translator/natives.go b/translator/natives.go index 41d583d6b..3c28406d9 100644 --- a/translator/natives.go +++ b/translator/natives.go @@ -591,6 +591,17 @@ var natives = map[string]string{ } `, + "strings": ` + IndexByte = function(s, c) { + for (var i = 0; i < s.length; i++) { + if (s.charCodeAt(i) === c) { + return i; + } + } + return -1; + }; + `, + "math": ` Go$pkg.MaxFloat32 = 3.40282346638528859811704183484516925440e+38; Go$pkg.SmallestNonzeroFloat32 = 1.401298464324817070923729583289916131280e-45;