Skip to content

Commit 4a9c7d7

Browse files
committed
removed extra method
1 parent dbd30a5 commit 4a9c7d7

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

echo/util/JSON.hx

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,6 @@ class JSON {
1919
if (into == null) into = Reflect.copy(from);
2020
else for (f in Reflect.fields(from)) Reflect.setField(into, f, Reflect.field(from, f));
2121

22-
return into;
23-
}
24-
/**
25-
* Copy All Fields AND translates colors. Overwrites the target object's fields.
26-
*
27-
* - If a field starts with "color" it will automatically convert it to proper INT
28-
* e.g. "0xffffff" or "blue" => (int)0x0000FF
29-
*
30-
* Adapted from the DJFlixel Library: https://github.com/johndimi/djFlixel
31-
*
32-
* @param from The Source Object to copy fields from
33-
* @param into The Destination object, if null it will be created. It is altered in place
34-
* @return The resulting object
35-
*/
36-
public static function copy_fields_c(from:Dynamic, ?into:Dynamic):Dynamic {
37-
if (into == null) into = {};
38-
if (from != null) for (f in Reflect.fields(from)) {
39-
var d:Dynamic = Reflect.field(from, f);
40-
41-
// f is the name of the field
42-
// d is the field data
43-
44-
// Convert COLOR string and array of strings to INT
45-
if (f.indexOf("color") == 0) {
46-
if (Std.is(d, String)) {
47-
Reflect.setField(into, f, ghost.Color.fromString(d));
48-
continue;
49-
}
50-
}
51-
52-
// Process any object nodes
53-
if (Reflect.isObject(d) && !Std.is(d, Array) && !Std.is(d, String)) {
54-
if (!Reflect.hasField(into, f)) Reflect.setField(into, f, {});
55-
copy_fields(d, Reflect.field(into, f));
56-
continue;
57-
}
58-
59-
// Just copy everything else.
60-
Reflect.setField(into, f, Reflect.field(from, f));
61-
}
62-
6322
return into;
6423
}
6524
}

0 commit comments

Comments
 (0)