Pfarah


ParaValue

Namespace: Pfarah

Functions and values

Function or valueDescription
asArray _arg1
Signature: _arg1:ParaValue -> ParaResult<ParaValue []>

Extracts inner array or reports an error

asBool _arg1
Signature: _arg1:ParaValue -> ParaResult<bool>

Extracts inner boolean or reports an error. A boolean value is sometimes written as a number, so if a number is non-zero, it is considered true (think C)

asDate _arg1
Signature: _arg1:ParaValue -> ParaResult<DateTime>

Extracts inner date or reports an error

asHsv _arg1
Signature: _arg1:ParaValue -> ParaResult<float * float * float>

Extracts inner hsv or reports an error

asInteger
Signature: ParaValue -> ParaResult<int>

Extracts the inner number and truncates any possible decimals

asNumber _arg1
Signature: _arg1:ParaValue -> ParaResult<float>

Extracts inner number or reports an error

asRecord _arg1
Signature: _arg1:ParaValue -> ParaResult<(string * ParaValue) []>

Extracts inner key value array or reports an error

asRgb _arg1
Signature: _arg1:ParaValue -> ParaResult<byte * byte * byte>

Extracts inner rgb or reports an error

asString _arg1
Signature: _arg1:ParaValue -> ParaResult<string>

Extracts inner string or reports an error

collect prop obj
Signature: prop:string -> obj:ParaValue -> ParaValue

Finds all the properties of the object with a given key and aggregates all the values under a single array. If a given object is an array all sub-objects are aggregated. If not an array or object, an empty array is returned.

collectAll prop obj
Signature: prop:string -> obj:ParaValue -> ParaValue

Finds all the properties of the object and sub-objects with a given key and aggregates all the values under a single array. If a given object is an array all sub-objects are aggregated. If not an array or object, an empty array is returned.

flatMap fn o
Signature: fn:(ParaValue -> ParaResult<'a>) -> o:ParaValue -> ParaResult<'a []>
Type parameters: 'a

Given a function to map a value to a result, apply this function on every value of a record, or array, or any other element (and the result would be an a single element array)

get key o
Signature: key:string -> o:ParaValue -> ParaResult<ParaValue>

Assumes the passed in value is a record and attempts to search the record's properties for the given key. If a single value exists return the value else there is an error

getAll key o
Signature: key:string -> o:ParaValue -> ParaResult<ParaValue []>

Assumes the passed in value is a record and collects all properties with a given key.

map fn obj
Signature: fn:(ParaValue -> ParaValue) -> obj:ParaValue -> ParaValue

Return a new ParaValue resulting from applying the given function to each value in the data. Adapted from json4s.

reduce fn arr
Signature: fn:(ParaValue -> ParaResult<'a>) -> arr:ParaValue [] -> ParaResult<'a []>
Type parameters: 'a

Run each element of the given array through the function and if all elements result in ok, then reduce the array of results into a single result of an array. If an element is an error, the first error is returned.

tryGet key o
Signature: key:string -> o:ParaValue -> ParaResult<ParaValue option>

Assumes the passed in value is a record and attempts to search the record's properties for the given key. If a single value exists return some value, if no properties were found, return None

unfold fn _arg1
Signature: fn:(ParaValue -> '?7282) -> _arg1:ParaValue -> '?7282
Type parameters: '?7282

When given an array/record that contains only a single instance. Run the deserialization function against that single element.

Fork me on GitHub