package yaml
Parse and generate YAML 1.1/1.2 files
Install
dune-project
Dependency
Authors
Maintainers
Sources
yaml-3.2.0.tbz
sha256=c50d2aca28b9f966792b71e1603351e5d24eda4dfd3e4453fbd50366a3a08227
sha512=e87ae73f3e376800a09e4359d5c7090ef5107807f540b51fbdee9017bcbacb2414ec12255b37caead115ea1562303436cac2c91c60814c2ba44bdd3d677fc0d1
doc/src/yaml/util.ml.html
Source file util.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
exception Value_error of string let keys = function | `O assoc -> Ok (List.map fst assoc) | _ -> Error (`Msg "Failed to get keys from non-object value") let keys_exn = function | `O assoc -> List.map fst assoc | _ -> raise (Value_error "Failed to get keys from non-object value") let values = function | `O assoc -> Ok (List.map snd assoc) | _ -> Error (`Msg "Failed to get values from non-object value") let values_exn = function | `O assoc -> List.map snd assoc | _ -> raise (Value_error "Failed to get values from non-object value") let combine a b = match (a, b) with | `O a, `O b -> Ok (`O (a @ b)) | _ -> Error (`Msg "Expected two objects") let combine_exn a b = match (a, b) with | `O a, `O b -> `O (a @ b) | _ -> raise (Value_error "Expected two objects") let find s = function | `O assoc -> Ok (List.assoc_opt s assoc) | _ -> Error (`Msg "Expected an object") let find_exn s = function | `O assoc -> List.assoc_opt s assoc | _ -> raise (Value_error "Expected an object") let map f = function | `A lst -> Ok (`A (List.map f lst)) | _ -> Error (`Msg "Expected a value array") let map_exn f = function | `A lst -> `A (List.map f lst) | _ -> raise (Value_error "Expected a value array") let filter p = function | `A lst -> Ok (`A (List.filter p lst)) | _ -> Error (`Msg "Expected a value array") let filter_exn p = function | `A lst -> `A (List.filter p lst) | _ -> raise (Value_error "Expected a value array") let to_string = function | `String s -> Ok s | _ -> Error (`Msg "Expected a string value") let to_string_exn = function | `String s -> s | _ -> raise (Value_error "Expected a string value") let to_bool = function | `Bool b -> Ok b | _ -> Error (`Msg "Expected a bool value") let to_bool_exn = function | `Bool b -> b | _ -> raise (Value_error "Expected a bool value") let to_float = function | `Float f -> Ok f | _ -> Error (`Msg "Expected a float value") let to_float_exn = function | `Float f -> f | _ -> raise (Value_error "Expected a float value") let string s = `String s let bool b = `Bool b let float f = `Float f let list f lst = `A (List.map f lst) let obj assoc = `O assoc
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>