Skip to content

Commit

Permalink
make suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
neeldug committed Jul 21, 2021
1 parent 11a346c commit c254485
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions boa/src/builtins/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,22 +281,21 @@ impl Array {
/// Returns a Boolean valued property that if `true` indicates that
/// an object should be flattened to its array elements
/// by `Array.prototype.concat`.

pub(crate) fn is_concat_spreadable(this: &Value, context: &mut Context) -> bool {
pub(crate) fn is_concat_spreadable(this: &Value, context: &mut Context) -> Result<bool> {
if !this.is_object() {
return false;
return Ok(false);
}
let spreadable = this
.get_field(WellKnownSymbols::is_concat_spreadable(), context)
.unwrap_or(Value::undefined());

if !spreadable.is_undefined() {
return spreadable.to_boolean();
return Ok(spreadable.to_boolean());
}

match this.as_object() {
Some(obj) => obj.is_array(),
_ => false,
Some(obj) => Ok(obj.is_array()),
_ => Ok(false),
}
}

Expand Down

0 comments on commit c254485

Please sign in to comment.