| 50 | } |
| 51 | |
| 52 | Value CheckString(const CallbackInfo& info) { |
| 53 | String value = info[0].As<String>(); |
| 54 | String encoding = info[1].As<String>(); |
| 55 | Value length = info[2]; |
| 56 | |
| 57 | if (encoding.Utf8Value() == "utf8") { |
| 58 | std::string testValue = testValueUtf8; |
| 59 | if (!length.IsUndefined()) { |
| 60 | testValue = testValue.substr(0, length.As<Number>().Uint32Value()); |
| 61 | } |
| 62 | |
| 63 | std::string stringValue = value; |
| 64 | return Boolean::New(info.Env(), stringValue == testValue); |
| 65 | } else if (encoding.Utf8Value() == "utf16") { |
| 66 | std::u16string testValue = testValueUtf16; |
| 67 | if (!length.IsUndefined()) { |
| 68 | testValue = testValue.substr(0, length.As<Number>().Uint32Value()); |
| 69 | } |
| 70 | |
| 71 | std::u16string stringValue = value; |
| 72 | return Boolean::New(info.Env(), stringValue == testValue); |
| 73 | } else { |
| 74 | Error::New(info.Env(), "Invalid encoding.").ThrowAsJavaScriptException(); |
| 75 | return Value(); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | Value CreateSymbol(const CallbackInfo& info) { |
| 80 | Value description = info[0]; |
nothing calls this directly
no test coverage detected