Esempio n. 1
0
        public static SObject Includes(ScriptProcessor processor, SObject instance, SObject This, SObject[] parameters)
        {
            if (parameters.Length == 1)
            {
                var arr     = (SArray)instance;
                var compare = parameters[0];

                return(processor.CreateBool(arr.ArrayMembers.Any(m => ObjectComparer.LooseEquals(processor, m, compare))));
            }

            if (parameters.Length >= 2)
            {
                var arr      = (SArray)instance;
                var compare  = parameters[0];
                var comparer = (SFunction)Unbox(parameters[1]);

                return(processor.CreateBool(arr.ArrayMembers.Any(m => ((SBool)comparer.Call(processor, This, This, new[] { m, compare })).Value)));
            }

            return(processor.Undefined);
        }