Example #1
0
        // Create JSValueObject as a shallow copy of 'other'.
        public static JSValueObject CopyFrom(IReadOnlyDictionary <string, JSValue> other)
        {
            JSValueObject obj = new JSValueObject();

            foreach (var keyValue in other)
            {
                obj.Add(keyValue.Key, keyValue.Value);
            }

            return(obj);
        }
Example #2
0
        private static JSValueObject InternalReadObjectFrom(IJSValueReader reader)
        {
            var jsObject = new JSValueObject();

            while (reader.GetNextObjectProperty(out string propertyName))
            {
                jsObject.Add(propertyName, InternalReadFrom(reader));
            }

            return(jsObject);
        }