/

Taxi StdLib

Reference documentation on functions provided in Taxi's StdLib packages


Taxi ships with a collections of functions for basic operations on data.

These operations are performed locally on data received from services - it does not instruct remote services to perform these changes.

Taxi does not provide implementations of these functions, that's left to runtimes, such as Orbital.

Strings

A collection of functions for manipulating strings

left

taxi.stdlib.left

declare function left(source:String,count:Int):String

Returns the left most characters from the source string

taxi.stdlib.right

declare function right(source:String,count:Int):String

mid

taxi.stdlib.mid

declare function mid(source: String,startIndex: Int,endIndex: Int):String

Returns the middle of a string, starting at the startIndex, and ending right before the endIndex.

  • startIndex - the start index (inclusive)
  • endIndex - the end index (exclusive)

concat

taxi.stdlib.concat

declare function concat(String...):String

upperCase

taxi.stdlib.upperCase

declare function upperCase(String):String

lowerCase

taxi.stdlib.lowerCase

declare function lowerCase(String):String

trim

taxi.stdlib.trim

declare function trim(String):String

length

taxi.stdlib.length

declare function length(String):Int

indexOf

taxi.stdlib.indexOf

declare function indexOf(source:String, valueToSearchFor:String):Int

Returns the index of valueToSearchFor within source

replace

taxi.stdlib.replace

declare function replace(source: String, searchValue:String, replacement: String):String

Replaces the contents of the provided String, returning a new String Accepts three args:

  • source: String: The string to search
  • searchValue: String: The string to search for
  • replacement: String: The string to use as a replacement

containsString

taxi.stdlib.containsString

declare function containsString(source:String, valueToSearchFor:String):Boolean

Returns true if valueToSearchFor within source

Collections

A collection of functions for operating on collections

contains

taxi.stdlib.contains

declare function <T> contains(collection: T[], searchTarget:T): Boolean

allOf

taxi.stdlib.allOf

declare function allOf(values:Boolean...): Boolean

anyOf

taxi.stdlib.anyOf

declare function anyOf(values:Boolean...): Boolean

noneOf

taxi.stdlib.noneOf

declare function noneOf(values:Boolean...): Boolean

single

taxi.stdlib.single

declare function <T> single(collection:T[], callback: (T) -> Boolean):T

filterAll

taxi.stdlib.filterAll

declare function <T> filterAll(collection:T[], callback: (T) -> Boolean):T[]

singleBy

taxi.stdlib.singleBy

declare function <T,A> singleBy(collection:T[], groupingFunction: (T) -> A, searchValue: A):T

Similar to Single, where the collection is searched for a single matching value. However, results are first grouped by selector. The results of this are cached to improve future performance

first

taxi.stdlib.first

declare function <T> first(collection: T[]):T

Returns the first item within the collection

last

taxi.stdlib.last

declare function <T> last(collection: T[]):T

Returns the last item within the collection

getAtIndex

taxi.stdlib.getAtIndex

declare function <T> getAtIndex(collection: T[], index: Int):T

Returns the item at the provided index

Dates

Mess about with time. Flux capacitor not included

addMinutes

taxi.stdlib.dates.addMinutes

declare function addMinutes(DateTime, Int):DateTime
declare function addMinutes(Instant, Int): Instant

addDays

taxi.stdlib.dates.addDays

declare function addDays(DateTime, Int):DateTime
declare function addDays(Instant, Int): Instant

addSeconds

taxi.stdlib.dates.addSeconds

declare function addSeconds(DateTime, Int):DateTime
declare function addSeconds(Instant, Int): Instant

now

taxi.stdlib.dates.now

declare function <T> now():T

parseDate

taxi.stdlib.dates.parseDate

declare function <T> parseDate(String):T

Objects

Utilities for dealing with equality, etc

equals

taxi.stdlib.equals

declare function <A,B> equals(a:A, b:B): Boolean

Aggregations

Functions for aggregating data within transformations.

sumOver

vyne.aggregations.sumOver

declare query function sumOver(Any...):Decimal

Functional

Functions that are functionally functions. Funky

reduce

taxi.stdlib.reduce

declare function <T,A> reduce(collection: T[], callback: (T,A) -> A):A

fold

taxi.stdlib.fold

declare function <T,A> fold(collection: T[], initial: A, callback: (T,A) -> A):A

sum

taxi.stdlib.sum

declare function <T,A> sum(collection: T[], callback: (T) -> A):A

max

taxi.stdlib.max

declare function <T,A> max(collection: T[], callback: (T) -> A):A

min

taxi.stdlib.min

declare function <T,A> min(collection: T[], callback: (T) -> A):A

Transformations

Functions for converting between types

convert

taxi.stdlib.convert

declare function <T> convert(source: Any, targetType: lang.taxi.Type<T>): T

Converts the provided source into the target type reference. Conversions are performed locally, using only the data provided in source - ie., no services or graph searches are performed.

This method is less powerful than using a standard projection (eg., A as B), because:

  • Only the exact facts passed in the source are considered

  • No graph searches or remote invocations are performed

    As a result, it's also more performant.

Edit on Github