- DynamicExt - pure haxe
- DynamicTools - pure haxe
- LambdaExt - pure haxe
- XmlExt - pure haxe
- UrlLoaderExt - for openfl
haxelib git zame-miscutils https://github.com/restorer/zame-haxe-miscutils.git
Allow use Dynamic values like Map.
var node = new DynamicExt();
node["foo"] = "bar";
trace(node["foo"]);
trace(node.exists("foo"));
trace(node.exists("bar"));
node["bar"] = "baz";
trace(node.keys());
node.remove("foo");
trace(node.keys());
Along with DynamicExt allows to parse json in a safe manner.
import org.zamedev.lib.DynamicExt;
using org.zamedev.lib.DynamicTools;
var node:DynamicExt = haxe.Json.parse('{"stringval":"haxe","arrayval":["haxe","cool"],"intval":42,"floatval":24.42,"boolval":true}');
trace(node["stringval"].asString());
trace(node["arrayval"].asArray());
trace(node["intval"].asInt());
trace(node["floatval"].asFloat());
trace(node["boolval"].asBool());
trace(node["nonexisting"].asString("defaultvalue"));
trace(node["nonexisting"].asNullInt());
trace(node["nonexisting"].asNullFloat());
trace(node["nonexisting"].asDynamic());
Can be used as drop-in replacement of Lambda
when you need to work with an Iterator
(you should still use original Lambda
for an Iterable
).
var map = new Map<String, String>();
map["foo"] = "bar";
map["bar"] = "baz";
var arrayval:Array<String> = map.keys().array();
trace(arrayval);
var listval:List<String> = map.keys().map(function(v) { return v.toUpperCase(); });
trace(listval);
Allows to get inner text from xml node in an easy way.
var root = Xml.parse("<root><node>inner value</node><node /></root>");
for (node in root.firstElement().elements()) {
trace(node.innerText("defaultvalue"));
}
Simplify work with json-based server API.
var loader = new UrlLoaderExt(function(loader:UrlLoaderExt) {
trace("success");
trace(loader.data);
}, function(_) {
trace("error happened");
});
loader.load(UrlLoaderExt.createJsonRequest("http://domain.tld", { foo:"bar" }));