Norm.build_usage_result: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/usage/norm.bend as Norm Lines 201-209 of cswap-bend-cli@0.1.0.0/usage/norm.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/usage/norm.bend&start_line=201&end_line=209 import Base import cswap-bend-cli@0.1.0.0/json.bend as Json # The normalised usage (five_hour, seven_day, spend, scoped), or JNull when # the data carries nothing: build_usage_result. `now` is unix seconds, `off` # the local UTC offset biased by 86400. def build_usage_result(+data: Json.Json, +now: U32, +off: U32) -> Json.Json: result.keep(scoped.put( scoped.go(Json.to_list(Maybe.default(&2, Json.Json, Json.get("limits", data), Json.JNull{})), now, off), spend.add( put("seven_day", window("seven_day", data, now, off), put("five_hour", window("five_hour", data, now, off), Json.of_pairs([]))), Json.get("extra_usage", data), now, off))) Uses (13): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe.default https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=Json https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=get https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=of_pairs https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=to_list https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/usage/norm.bend&name=put https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/usage/norm.bend&name=result.keep https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/usage/norm.bend&name=scoped.go https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/usage/norm.bend&name=scoped.put https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/usage/norm.bend&name=spend.add https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/usage/norm.bend&name=window