public static EcmaValue GetOwnPropertyDescriptor(EcmaValue target, EcmaValue property) { EcmaPropertyDescriptor descriptor = target.ToObject().GetOwnProperty(EcmaPropertyKey.FromValue(property)); if (descriptor == null) { return(default);
public static EcmaValue DefineProperty(EcmaValue target, EcmaValue property, EcmaValue attributes) { Guard.ArgumentIsObject(target); RuntimeObject obj = target.ToObject(); obj.DefinePropertyOrThrow(EcmaPropertyKey.FromValue(property), EcmaPropertyDescriptor.FromValue(attributes)); return(target); }
public EcmaObject(Hashtable properties) : this() { foreach (DictionaryEntry entry in properties) { this.CreateDataProperty(EcmaPropertyKey.FromValue(new EcmaValue(entry.Key)), new EcmaValue(entry.Value)); } }
public static bool In(this EcmaValue thisValue, EcmaValue other) { if (other.Type != EcmaValueType.Object) { throw new EcmaTypeErrorException(InternalString.Error.NotObject); } return(other.HasProperty(EcmaPropertyKey.FromValue(thisValue))); }
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); }