Skip to content

Commit

Permalink
Fix error introduced when moving to map
Browse files Browse the repository at this point in the history
  • Loading branch information
hansl committed Dec 18, 2024
1 parent f762b11 commit f2156f5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/engine/src/builtins/typed_array/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,17 @@ impl BuiltinTypedArray {
}
};

let mapping = match args.first().map(JsValue::variant) {
let mapping = match args.get(1).map(JsValue::variant) {
// 3. If mapfn is undefined, let mapping be false.
None => None,
None | Some(JsVariant::Undefined) => None,
// 4. Else,
// b. Let mapping be true.
Some(JsVariant::Object(obj)) if obj.is_callable() => Some(obj),
// a. If IsCallable(mapfn) is false, throw a TypeError exception.
_ => {
return Err(JsNativeError::typ()
.with_message("TypedArray.from called with non-callable mapfn")
.into())
.into());
}
};

Expand Down Expand Up @@ -2219,7 +2219,7 @@ impl BuiltinTypedArray {
) -> JsResult<JsValue> {
// 1. If comparefn is not undefined and IsCallable(comparefn) is false, throw a TypeError exception.
let compare_fn = match args.first().map(JsValue::variant) {
None => None,
None | Some(JsVariant::Undefined) => None,
Some(JsVariant::Object(obj)) if obj.is_callable() => Some(obj),
_ => {
return Err(JsNativeError::typ()
Expand Down Expand Up @@ -2271,7 +2271,7 @@ impl BuiltinTypedArray {
) -> JsResult<JsValue> {
// 1. If comparefn is not undefined and IsCallable(comparefn) is false, throw a TypeError exception.
let compare_fn = match args.first().map(JsValue::variant) {
None => None,
None | Some(JsVariant::Undefined) => None,
Some(JsVariant::Object(obj)) if obj.is_callable() => Some(obj),
_ => {
return Err(JsNativeError::typ()
Expand Down

0 comments on commit f2156f5

Please sign in to comment.