Noor
Noor brings the best parts of working in C# to Haxe. The roadmap includes:
- LINQ-like lambdas for collections
- Common string methods:
StartsWith
,EndsWith
, and more - Container methods that return
true/false
instead ofindexOf(x) > -1
- And more!
Noor is currently under active development. To consume it as a libray, use haxlib git noor http://github.com/ashes999/noor
.
Exceptions/Errors
Noor provides a basic Exception
class with a configurable message. Throw it, or extend it to expose more specific exceptions (eg. NotImplementedException
).
public function divide(a:Int, b:Int) {
if (b == 0) {
throw new Exception("Can't divide by zero.");
}
}
Alternatively:
class DivideByZeroException extends noor.Exception
{
public function new() { super("Can't divide by zero."); }
}
throw new DivideByZeroException();
FileSystem extensions
Noor extends sys.FileSystem
with several helpers. To use them, specify using noor.io.FileSystemExtensions
, then call them from FileSystem
as normal.
FileSystem.copyDirectoryRecursively(source, destination)
: Creates thedestination
directory and copiessource
into it recursively.FileSystem.deleteDirectoryRecursively(directory)
: Deletesdirectory
and all files/subfolders recursivelyFileSystem.ensureDirectoryExists(directory)
: Throws an exception ifdirectory
doesn't existFileSystem.getFiles(directory)
: Get all files (not directories) on a given path. Not recursive.FileSystem.getFiles(directory)
: Get all files (not directories) on a given path, recursively.FileSystem.recreateDirectory(directory)
: Deletes and re-createsdirectory
if it exists; creates it if it doesn't exist
Math extensions
using noor.MathExtensions;
var n:Int = Math.randomBetween(10, 20); // 10 <= n < 20
noor.web.Request
Noor exposes a getUrlParameters
method that returns a map of key/value pairs (Map<String, Dynamic>
). This provides a way to access URL parameters across Neko, Flash, and Javascript.
eg. with a URL like index.html?a=true&b=hello%20there!&c=71
, getUrlParameters
returns { a => true, b => "hello there!", c => 71 }