Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
27 lines (23 loc) · 727 Bytes

File metadata and controls

27 lines (23 loc) · 727 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "devs_internal.h"
// ignore UTF8 decoding for now
value_t prop_String_length(devs_ctx_t *ctx, value_t self) {
unsigned sz;
if (devs_string_get_utf8(ctx, self, &sz))
return devs_value_from_int(sz);
else
return devs_undefined;
}
void meth1_String_charCodeAt(devs_ctx_t *ctx) {
unsigned sz;
const char *data = devs_string_get_utf8(ctx, devs_arg_self(ctx), &sz);
if (data) {
unsigned idx = devs_arg_int(ctx, 0);
if (idx >= sz)
devs_ret(ctx, devs_nan);
else
devs_ret_int(ctx, (uint8_t)data[idx]);
}
}
void meth1_String_charAt(devs_ctx_t *ctx) {
devs_ret(ctx, devs_seq_get(ctx, devs_arg_self(ctx), devs_arg_int(ctx, 0)));
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.