pub(crate) fn some(this: &Value, args: &[Value], context: &mut Context) -> Result<Value> {
        // 1. Let O be ? ToObject(this value).
        let o = this.to_object(context)?;
        // 2. Let len be ? LengthOfArrayLike(O).
        let len = o.length_of_array_like(context)?;
        // 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
        let callback = if let Some(arg) = args
            .get(0)
            .and_then(Value::as_object)
            .filter(GcObject::is_callable)
        {
            arg
        } else {
            return context.throw_type_error("Array.prototype.some: callback is not callable");
        };

        // 4. Let k be 0.
        // 5. Repeat, while k < len,
        for k in 0..len {
            // a. Let Pk be ! ToString(𝔽(k)).
            // b. Let kPresent be ? HasProperty(O, Pk).
            let k_present = o.has_property(k, context)?;
            // c. If kPresent is true, then
            if k_present {
                // i. Let kValue be ? Get(O, Pk).
                let k_value = o.get(k, context)?;
                // ii. Let testResult be ! ToBoolean(? Call(callbackfn, thisArg, « kValue, 𝔽(k), O »)).
                let this_arg = args.get(1).cloned().unwrap_or_default();
                let test_result = callback
                    .call(&this_arg, &[k_value, k.into(), o.clone().into()], context)?
                    .to_boolean();
                // iii. If testResult is true, return true.
                if test_result {
                    return Ok(Value::from(true));
                }
            }
            // d. Set k to k + 1.
        }
        // 6. Return false.
        Ok(Value::from(false))
    }
/// Array.prototype.some ( callbackfn [ , thisArg ] )
///
/// The some method tests whether at least one element in the array passes
/// the test implemented by the provided callback function. It returns a Boolean value,
/// true if the callback function returns a truthy value for at least one element
/// in the array. Otherwise, false.
///
/// Caution: Calling this method on an empty array returns false for any condition!
///
/// More information:
///  - [ECMAScript reference][spec]
///  - [MDN documentation][mdn]
///
/// [spec]: https://tc39.es/ecma262/#sec-array.prototype.some
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
Array.prototype.some ( callbackfn [ , thisArg ] )
The some method tests whether at least one element in the array passes
the test implemented by the provided callback function. It returns a Boolean value,
true if the callback function returns a truthy value for at least one element
in the array. Otherwise, false.

Calling this method on an empty array returns false for any condition!

More information:
[ECMAScript reference][spec]
[MDN documentation][mdn]


Array . prototype . some ( callbackfn [ thisArg ] ) The some method tests whether at least one element in the array passes the test implemented by the provided callback function . It returns a Boolean value true if the callback function returns a truthy value for at least one element in the array . Otherwise false . Calling this method on an empty array returns false for any condition! More information : [ ECMAScript reference ] [ spec ] [ MDN documentation ] [ mdn ]
pub(crate) fn some(this: &Value, args: &[Value], context: &mut Context) -> Result<Value> {
        // 1. Let O be ? ToObject(this value).
        let o = this.to_object(context)?;
        // 2. Let len be ? LengthOfArrayLike(O).
        let len = o.length_of_array_like(context)?;
        // 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
        let callback = if let Some(arg) = args
            .get(0)
            .and_then(Value::as_object)
            .filter(GcObject::is_callable)
        {
            arg
        } else {
            return context.throw_type_error("Array.prototype.some: callback is not callable");
        };
        // 4. Let k be 0.
        // 5. Repeat, while k < len,
        for k in 0..len {
            // a. Let Pk be ! ToString(𝔽(k)).
            // b. Let kPresent be ? HasProperty(O, Pk).
            let k_present = o.has_property(k, context)?;
            // c. If kPresent is true, then
            if k_present {
                // i. Let kValue be ? Get(O, Pk).
                let k_value = o.get(k, context)?;
                // ii. Let testResult be ! ToBoolean(? Call(callbackfn, thisArg, « kValue, 𝔽(k), O »)).
                let this_arg = args.get(1).cloned().unwrap_or_default();
                let test_result = callback
                    .call(&this_arg, &[k_value, k.into(), o.clone().into()], context)?
                    .to_boolean();
                // iii. If testResult is true, return true.
                if test_result {
                    return Ok(Value::from(true));
                }
            }
            // d. Set k to k + 1.
        }
        // 6. Return false.
        Ok(Value::from(false))
    }
pub ( crate ) fn some ( this : & Value , args : & [ Value ] , context : & mut Context ) -> Result < Value > { // 1. Let O be ? ToObject(this value). let o = this . to_object ( context ) ? ; // 2. Let len be ? LengthOfArrayLike(O). let len = o . length_of_array_like ( context ) ? ; // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. let callback = if let Some ( arg ) = args . get ( 0 ) . and_then ( Value :: as_object ) . filter ( GcObject :: is_callable ) { arg } else { return context . throw_type_error ( " " ) ; } ; // 4. Let k be 0. // 5. Repeat, while k < len, for k in 0 .. len { // a. Let Pk be ! ToString(𝔽(k)). // b. Let kPresent be ? HasProperty(O, Pk). let k_present = o . has_property ( k , context ) ? ; // c. If kPresent is true, then if k_present { // i. Let kValue be ? Get(O, Pk). let k_value = o . get ( k , context ) ? ; // ii. Let testResult be ! ToBoolean(? Call(callbackfn, thisArg, « kValue, 𝔽(k), O »)). let this_arg = args . get ( 1 ) . cloned ( ) . unwrap_or_default ( ) ; let test_result = callback . call ( & this_arg , & [ k_value , k . into ( ) , o . clone ( ) . into ( ) ] , context ) ? . to_boolean ( ) ; // iii. If testResult is true, return true. if test_result { return Ok ( Value :: from ( true ) ) ; } } // d. Set k to k + 1. } // 6. Return false. Ok ( Value :: from ( false ) ) }
Array.prototype.some ( callbackfn [ , thisArg ] )
The some method tests whether at least one element in the array passes
the test implemented by the provided callback function.
Array . prototype . some ( callbackfn [ thisArg ] ) The some method tests whether at least one element in the array passes the test implemented by the provided callback function .
this
&Value
args
&[Value]
context
&mut Context
this
&Value
args
&[Value]
context
&mut Context