mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
✨ Feat: add new partial function format-number
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
{{- /* How to use */ -}}
|
||||
{{- /* partial "function/format-number" (dict "PRECISION" 2 "NUMBER" 5201314 */ -}}
|
||||
{{- $number := .NUMBER -}}
|
||||
{{- $precision := .PRECISION | default 1 -}}
|
||||
{{- with $number -}}
|
||||
{{- if ge . 1000 -}}
|
||||
{{- $number = printf "%vk" (lang.FormatNumberCustom $precision (div . 1000.0) "- .") -}}
|
||||
{{ printf "%v" $number }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $number -}}
|
||||
Reference in New Issue
Block a user