Awee

Modifiers

Tiny functions that power the Sintax module.

Modifiers are functions that shorten the path of data transformation.

Boolean

Compare values and return true or false. Combine with conditionals to branch template output.

ModifierDescription
eqEq returns true if the value equals the given parameter.
gtGt returns true if the numeric value is greater than the threshold.
gteGte returns true if the numeric value is greater than or equal to the threshold.
notNot inverts the truthiness of the value.

Collections

Work with arrays and maps — sort, filter, find, extract keys, and reshape data.

ModifierDescription
filterFilter returns a subset of a slice where a nested field matches a value.
findFind returns the first element in a slice or map where a field equals the given value.
firstFirst returns the first character of a string or the first element of a slice.
hasHas returns true if the slice or map contains the given value.
isIs returns true if the value equals any of the given parameters.
keyKey extracts a value from a map or slice by key path or index.
lastLast returns the last character of a string or the last element of a slice.
mapMap converts a slice of maps into a map keyed by the given field's string value.
mergeMerge converts a slice of maps into a map keyed by the given field's string value.
sortSort sorts a slice in ascending or descending order.
wrapWrap wraps the value in a map under the given key.

Convert

Serialize and deserialize between Go values, JSON, and YAML.

ModifierDescription
fromFrom parses the string value as the given format and returns the parsed result.
jsonJSON serializes the value to a JSON string.
markdownMarkdown converts an HTML string to Markdown.
yamlYAML serializes or parses a value as YAML.

File System

Extract and manipulate path components — directory, filename, and extension.

ModifierDescription
dirnameDirname returns the directory portion of a file path.
extFilenameExt returns the file extension without the leading dot.
ext-dotFilenameExtDot returns the file extension including the leading dot.
ext-prependFilenamePrependExt inserts an additional extension before the existing file extension.
ext-trimFilenameTrimExt returns the file path without its extension.
filenameFilename returns the base file name from a path, including the extension.

Money

Convert between currency units and denominations.

ModifierDescription
currencyCurrency converts a numeric value between currency units by applying a unit multiplier ratio.

Text

Manipulate strings — trim whitespace, change case, split, join, slugify, and more.

ModifierDescription
concatConcat appends one or more strings to the value.
joinJoin combines an array of strings into a single string with a separator.
linesLines splits a string or byte slice into an array of lines.
lowerToLower converts a string to lowercase.
replaceReplace replaces all occurrences of a substring within the string value.
replace_patternReplacePattern replaces all regex matches within the string value.
reverseReverse reverses the characters in a string.
sexySexy returns a bear ASCII art.
shortenShorten truncates a string to the given maximum character length.
slugSlug converts a string to a URL-friendly slug.
splitSplit splits a string into an array using a separator.
titleTitle converts a hyphen-separated slug into a title-cased string.
title_modelModelTitle formats an AI model identifier into a human-readable title.
trimTrim removes leading and trailing whitespace, or the given character set.
trim-prefixTrimPrefix removes a leading prefix string or leading whitespace from the value.
trim-suffixTrimSuffix removes a trailing suffix string or trailing whitespace from the value.
upperToUpper converts a string to uppercase.

Utilities

General-purpose modifiers — defaults, lengths, line numbers, and date formatting.

ModifierDescription
defaultDefault returns the fallback value if the input is nil or an empty string.
formatFormat formats a time.
lengthLength returns the number of characters in a string or bytes in a byte slice.
line-numbersLineNumbers prepends each line of the string with its zero-based line number.

How is this guide?

On this page