We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0f704aa commit c872893Copy full SHA for c872893
1 file changed
src/javascript/lib/core/erlang_compat/binary.js
@@ -10,12 +10,16 @@ function copy(subject, n = 1) {
10
}
11
12
function first(subject) {
13
- //TODO: raise badarg on size 0
+ if (subject.length == 0) {
14
+ throw new Error(`Binary is of length 0`);
15
+ }
16
return at(subject, 0);
17
18
19
function last(subject) {
20
21
22
23
return subject.slice(-1);
24
25
0 commit comments