Various utilities. Some of them are used by ceramic itself or its backends.

Static methods

staticrealPath(path:String):String

staticinlinegetRtti<T>(c:Class<T>):Classdef

staticuniqueId():String

Provides an identifier which is garanteed to be unique on this local device. It however doesn't garantee that this identifier is not predictable.

@:value({ size : 32 })staticrandomId(size:Int = 32):String

Provides a random identifier which should be fairly unpredictable and should have an extremely low chance to provide the same identifier twice.

@:value({ size : 32, slot : 0 })staticpersistentId(slot:Int = 0, size:Int = 32):String

Return a persistent identifier for this device. The identifier is expected to stay the same as long as the user keeps the app installed. Multiple identifiers can be generated/retrieved by using different slots (default 0). Size of the persistent identifier can be provided, but will only have effect when generating a new identifier.

@:value({ slot : 0 })staticresetPersistentId(slot:Int = 0):Void

staticinlinebase62Id(?val:Int):String

@:has_untypedstaticprintln(data:String):Void

@:has_untyped@:value({ returnOnly : false })staticprintStackTrace(returnOnly:Bool = false):String

staticinlineradToDeg(rad:Float):Float

staticinlinedegToRad(deg:Float):Float

@:value({ decimals : 0 })staticinlineround(value:Float, decimals:Int = 0):Float

staticinlinehashCode(s:String):Int

Java's String.hashCode() method implemented in Haxe. source: https://github.com/rjanicek/janicek-core-haxe/blob/master/src/co/janicek/core/math/HashCore.hx

staticuniformFrequencyList(values:Array<Int>, frequencies:Array<Float>, size:Int):Array<Int>

Generate an uniform list of the requested size, containing values uniformly repartited from frequencies.

Parameters:

values

the values to put in list

probabilities

the corresponding probability for each value

size

the size of the final list

@:value({ firstLetterUppercase : true })staticupperCaseToCamelCase(input:String, firstLetterUppercase:Bool = true):String

Transforms SOME_IDENTIFIER to SomeIdentifier

@:value({ firstLetterUppercase : true })staticcamelCaseToUpperCase(input:String, firstLetterUppercase:Bool = true):String

Transforms SomeIdentifier/someIdentifier/some identifier to SOME_IDENTIFIER

staticinlinefunctionEquals(functionA:Dynamic, functionB:Dynamic):Bool

staticsinRatio(value:Float):Float

Transforms a value between 0 and 1 to another value between 0 and 1 following a sinusoidal curve

Parameters:

value

a value between 0 and 1. If giving a value > 1, its modulo 1 will be used.

Returns:

Float

staticcosRatio(value:Float):Float

Transforms a value between 0 and 1 to another value between 0 and 1 following a cosinusoidal curve

Parameters:

value

a value between 0 and 1. If giving a value > 1, its modulo 1 will be used.

Returns:

Float

staticvalueFromInterpolatedKey(keys:Array<Float>, values:Array<Float>, interpolatedKey:Float):Float

Given an array of keys and an array of matching values, interpolate a new value from interpolatedKey

Parameters:

keys

A list of keys

values

A list of values

interpolatedKey

The interpolated key, used to find a matching interpolated value

Returns:

Interpolated value

staticyFromInterpolatedX(points:Array<Float>, interpolatedX:Float):Float

Given an array of X and Y values, interpolate a new Y value from interpolated X

Parameters:

points

A list of X and Y values

interpolatedX

The interpolated X key, used to find a matching interpolated Y

Returns:

Interpolated Y value

staticcommand(cmd:String, ?args:Array<String>, ?options:{detached:Null<Bool>, cwd:Null<String>}, result:(code:Int, out:String, err:String) ‑> Void):Void

staticreplaceIdentifier(str:String, word:String, replacement:String):String

staticinlinelerp(a:Float, b:Float, t:Float):Float