Пример #1
0
        public static EcmaValue FromEntries(EcmaValue iterator)
        {
            EcmaObject obj = new EcmaObject();

            foreach (EcmaValue entry in iterator.ForOf())
            {
                if (entry.Type != EcmaValueType.Object)
                {
                    throw new EcmaTypeErrorException(InternalString.Error.EntryNotObject);
                }
                EcmaValue key   = entry[0];
                EcmaValue value = entry[1];
                obj.CreateDataProperty(EcmaPropertyKey.FromValue(key), value);
            }
            return(obj);
        }