1"use strict";(self.webpackChunkhelm_www=self.webpackChunkhelm_www||[]).push([["23760"],{92445(e,n,i){i.r(n),i.d(n,{metadata:()=>s,default:()=>h,frontMatter:()=>t,contentTitle:()=>d,toc:()=>a,assets:()=>c});var s=JSON.parse('{"id":"chart_template_guide/function_list","title":"Template Function List","description":"A list of template functions available in Helm","source":"@site/versioned_docs/version-3/chart_template_guide/function_list.md","sourceDirName":"chart_template_guide","slug":"/chart_template_guide/function_list","permalink":"/docs/v3/chart_template_guide/function_list","draft":false,"unlisted":false,"editUrl":"https://github.com/helm/helm-www/blob/main/versioned_docs/version-3/chart_template_guide/function_list.md","tags":[],"version":"3","sidebarPosition":6,"frontMatter":{"title":"Template Function List","description":"A list of template functions available in Helm","sidebar_position":6},"sidebar":"tutorialSidebar","previous":{"title":"Template Functions and Pipelines","permalink":"/docs/v3/chart_template_guide/functions_and_pipelines"},"next":{"title":"Flow Control","permalink":"/docs/v3/chart_template_guide/control_structures"}}'),r=i(74848),l=i(28453);let t={title:"Template Function List",description:"A list of template functions available in Helm",sidebar_position:6},d,c={},a=[{value:"Logic and Flow Control Functions",id:"logic-and-flow-control-functions",level:2},{value:"and",id:"and",level:3},{value:"or",id:"or",level:3},{value:"not",id:"not",level:3},{value:"eq",id:"eq",level:3},{value:"ne",id:"ne",level:3},{value:"lt",id:"lt",level:3},{value:"le",id:"le",level:3},{value:"gt",id:"gt",level:3},{value:"ge",id:"ge",level:3},{value:"default",id:"default",level:3},{value:"required",id:"required",level:3},{value:"empty",id:"empty",level:3},{value:"fail",id:"fail",level:3},{value:"coalesce",id:"coalesce",level:3},{value:"ternary",id:"ternary",level:3},{value:"true test value",id:"true-test-value",level:4},{value:"false test value",id:"false-test-value",level:4},{value:"String Functions",id:"string-functions",level:2},{value:"print",id:"print",level:3},{value:"println",id:"println",level:3},{value:"printf",id:"printf",level:3},{value:"trim",id:"trim",level:3},{value:"trimAll",id:"trimall",level:3},{value:"trimPrefix",id:"trimprefix",level:3},{value:"trimSuffix",id:"trimsuffix",level:3},{value:"lower",id:"lower",level:3},{value:"upper",id:"upper",level:3},{value:"title",id:"title",level:3},{value:"untitle",id:"untitle",level:3},{value:"repeat",id:"repeat",level:3},{value:"substr",id:"substr",level:3},{value:"nospace",id:"nospace",level:3},{value:"trunc",id:"trunc",level:3},{value:"abbrev",id:"abbrev",level:3},{value:"abbrevboth",id:"abbrevboth",level:3},{value:"initials",id:"initials",level:3},{value:"randAlphaNum, randAlpha, randNumeric, and randAscii",id:"randalphanum-randalpha-randnumeric-and-randascii",level:3},{value:"wrap",id:"wrap",level:3},{value:"wrapWith",id:"wrapwith",level:3},{value:"contains",id:"contains",level:3},{value:"hasPrefix and hasSuffix",id:"hasprefix-and-hassuffix",level:3},{value:"quote and squote",id:"quote-and-squote",level:3},{value:"cat",id:"cat",level:3},{value:"indent",id:"indent",level:3},{value:"nindent",id:"nindent",level:3},{value:"replace",id:"replace",level:3},{value:"plural",id:"plural",level:3},{value:"snakecase",id:"snakecase",level:3},{value:"camelcase",id:"camelcase",level:3},{value:"kebabcase",id:"kebabcase",level:3},{value:"swapcase",id:"swapcase",level:3},{value:"shuffle",id:"shuffle",level:3},{value:"Type Conversion Functions",id:"type-conversion-functions",level:2},{value:"toStrings",id:"tostrings",level:3},{value:"toDecimal",id:"todecimal",level:3},{value:"toJson, mustToJson",id:"tojson-musttojson",level:3},{value:"toPrettyJson, mustToPrettyJson",id:"toprettyjson-musttoprettyjson",level:3},{value:"toRawJson, mustToRawJson",id:"torawjson-musttorawjson",level:3},{value:"fromYaml",id:"fromyaml",level:3},{value:"fromJson",id:"fromjson",level:3},{value:"fromJsonArray",id:"fromjsonarray",level:3},{value:"toYaml, toYamlPretty",id:"toyaml-toyamlpretty",level:3},{value:"toToml",id:"totoml",level:3},{value:"fromToml",id:"fromtoml",level:3},{value:"fromYamlArray",id:"fromyamlarray",level:3},{value:"Regular Expressions",id:"regular-expressions",level:2},{value:"regexMatch, mustRegexMatch",id:"regexmatch-mustregexmatch",level:3},{value:"regexFindAll, mustRegexFindAll",id:"regexfindall-mustregexfindall",level:3},{value:"regexFind, mustRegexFind",id:"regexfind-mustregexfind",level:3},{value:"regexReplaceAll, mustRegexReplaceAll",id:"regexreplaceall-mustregexreplaceall",level:3},{value:"regexReplaceAllLiteral, mustRegexReplaceAllLiteral",id:"regexreplaceallliteral-mustregexreplaceallliteral",level:3},{value:"regexSplit, mustRegexSplit",id:"regexsplit-mustregexsplit",level:3},{value:"Cryptographic and Security Functions",id:"cryptographic-and-security-functions",level:2},{value:"sha1sum",id:"sha1sum",level:3},{value:"sha256sum",id:"sha256sum",level:3},{value:"adler32sum",id:"adler32sum",level:3},{value:"htpasswd",id:"htpasswd",level:3},{value:"randBytes",id:"randbytes",level:3},{value:"derivePassword",id:"derivepassword",level:3},{value:"genPrivateKey",id:"genprivatekey",level:3},{value:"buildCustomCert",id:"buildcustomcert",level:3},{value:"genCA",id:"genca",level:3},{value:"genSelfSignedCert",id:"genselfsignedcert",level:3},{value:"genSignedCert",id:"gensignedcert",level:3},{value:"encryptAES",id:"encryptaes",level:3},{value:"decryptAES",id:"decryptaes",level:3},{value:"Date Functions",id:"date-functions",level:2},{value:"now",id:"now",level:3},{value:"ago",id:"ago",level:3},{value:"date",id:"date",level:3},{value:"dateInZone",id:"dateinzone",level:3},{value:"duration",id:"duration",level:3},{value:"durationRound",id:"durationround",level:3},{value:"unixEpoch",id:"unixepoch",level:3},{value:"dateModify, mustDateModify",id:"datemodify-mustdatemodify",level:3},{value:"htmlDate",id:"htmldate",level:3},{value:"htmlDateInZone",id:"htmldateinzone",level:3},{value:"toDate, mustToDate",id:"todate-musttodate",level:3},{value:"Dictionaries and Dict Functions",id:"dictionaries-and-dict-functions",level:2},{value:"dict",id:"dict",level:3},{value:"get",id:"get",level:3},{value:"set",id:"set",level:3},{value:"unset",id:"unset",level:3},{value:"hasKey",id:"haskey",level:3}
1,{value:"pluck",id:"pluck",level:3},{value:"dig",id:"dig",level:3},{value:"merge, mustMerge",id:"merge-mustmerge",level:3},{value:"mergeOverwrite, mustMergeOverwrite",id:"mergeoverwrite-mustmergeoverwrite",level:3},{value:"keys",id:"keys",level:3},{value:"pick",id:"pick",level:3},{value:"omit",id:"omit",level:3},{value:"values",id:"values",level:3},{value:"deepCopy, mustDeepCopy",id:"deepcopy-mustdeepcopy",level:3},{value:"A Note on Dict Internals",id:"a-note-on-dict-internals",level:3},{value:"Encoding Functions",id:"encoding-functions",level:2},{value:"Lists and List Functions",id:"lists-and-list-functions",level:2},{value:"first, mustFirst",id:"first-mustfirst",level:3},{value:"rest, mustRest",id:"rest-mustrest",level:3},{value:"last, mustLast",id:"last-mustlast",level:3},{value:"initial, mustInitial",id:"initial-mustinitial",level:3},{value:"append, mustAppend",id:"append-mustappend",level:3},{value:"prepend, mustPrepend",id:"prepend-mustprepend",level:3},{value:"concat",id:"concat",level:3},{value:"reverse, mustReverse",id:"reverse-mustreverse",level:3},{value:"uniq, mustUniq",id:"uniq-mustuniq",level:3},{value:"without, mustWithout",id:"without-mustwithout",level:3},{value:"has, mustHas",id:"has-musthas",level:3},{value:"compact, mustCompact",id:"compact-mustcompact",level:3},{value:"index",id:"index",level:3},{value:"slice, mustSlice",id:"slice-mustslice",level:3},{value:"until",id:"until",level:3},{value:"untilStep",id:"untilstep",level:3},{value:"seq",id:"seq",level:3},{value:"chunk",id:"chunk",level:3},{value:"Math Functions",id:"math-functions",level:2},{value:"add",id:"add",level:3},{value:"add1",id:"add1",level:3},{value:"sub",id:"sub",level:3},{value:"div",id:"div",level:3},{value:"mod",id:"mod",level:3},{value:"mul",id:"mul",level:3},{value:"max",id:"max",level:3},{value:"min",id:"min",level:3},{value:"len",id:"len",level:3},{value:"Float Math Functions",id:"float-math-functions",level:2},{value:"addf",id:"addf",level:3},{value:"add1f",id:"add1f",level:3},{value:"subf",id:"subf",level:3},{value:"divf",id:"divf",level:3},{value:"mulf",id:"mulf",level:3},{value:"maxf",id:"maxf",level:3},{value:"minf",id:"minf",level:3},{value:"floor",id:"floor",level:3},{value:"ceil",id:"ceil",level:3},{value:"round",id:"round",level:3},{value:"Network Functions",id:"network-functions",level:2},{value:"File Path Functions",id:"file-path-functions",level:2},{value:"base",id:"base",level:3},{value:"dir",id:"dir",level:3},{value:"clean",id:"clean",level:3},{value:"ext",id:"ext",level:3},{value:"isAbs",id:"isabs",level:3},{value:"Reflection Functions",id:"reflection-functions",level:2},{value:"Kind Functions",id:"kind-functions",level:3},{value:"Type Functions",id:"type-functions",level:3},{value:"deepEqual",id:"deepequal",level:3},{value:"Semantic Version Functions",id:"semantic-version-functions",level:2},{value:"semver",id:"semver",level:3},{value:"semverCompare",id:"semvercompare",level:3},{value:"Basic Comparisons",id:"basic-comparisons",level:3},{value:"Working With Prerelease Versions",id:"working-with-prerelease-versions",level:3},{value:"Hyphen Range Comparisons",id:"hyphen-range-comparisons",level:3},{value:"Wildcards In Comparisons",id:"wildcards-in-comparisons",level:3},{value:"Tilde Range Comparisons (Patch)",id:"tilde-range-comparisons-patch",level:3},{value:"Caret Range Comparisons (Major)",id:"caret-range-comparisons-major",level:3},{value:"URL Functions",id:"url-functions",level:2},{value:"urlParse",id:"urlparse",level:3},{value:"urlJoin",id:"urljoin",level:3},{value:"urlquery",id:"urlquery",level:3},{value:"UUID Functions",id:"uuid-functions",level:2},{value:"Kubernetes and Chart Functions",id:"kubernetes-and-chart-functions",level:2},{value:"lookup",id:"lookup",level:3},{value:".Capabilities.APIVersions.Has",id:"capabilitiesapiversionshas",level:3},{value:"File Functions",id:"file-functions",level:3}];function o(e){let n={a:"a",blockquote:"blockquote",code:"code",em:"em",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,l.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.p,{children:"Helm includes many template functions you can take advantage of in templates.\nThey are listed here and broken down by the following categories:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#cryptographic-and-security-functions",children:"Cryptographic and Security"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#date-functions",children:"Date"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#dictionaries-and-dict-functions",children:"Dictionaries"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#encoding-functions",children:"Encoding"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#file-path-functions",children:"File Path"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#kubernetes-and-chart-functions",children:"Kubernetes and Chart"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#logic-and-flow-control-functions",children:"Logic and Flow Control"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#lists-and-list-functions",children:"Lists"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#math-functions",children:"Math"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#float-math-functions",children:"Float Math"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#network-functions",children:"Network"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#reflection-functions",children:"Reflection"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#regular-expressions",children:"Regular Expressions"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#semantic-version-functions",children:"Semantic Versions"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#string-functions",children:"String"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#type-conversion-functions",children:"Type Conversion"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#url-functions",children:"URL"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#uuid-functions",children:"UUID"})}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"logic-and-flow-control-functions",children:"Logic and Flow Control Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm includes numerous logic and control flow functions including ",(0,r.jsx)(n.a,{href:"#and",children:"and"}),",\n",(0,r.jsx)(n.a,{href:"#coalesce",children:"coalesce"}),", ",(0,r.jsx)(n.a,{href:"#default",children:"default"}),", ",(0,r.jsx)(n.a,{href:"#empty",children:"empty"}),", ",(0,r.jsx)(n.a,{href:"#eq",children:"eq"}),",\n",(0,r.jsx)(n.a,{href:"#fail",children:"fail"}),", ",(0,r.jsx)(n.a,{href:"#ge",children:"ge"}),", ",(0,r.jsx)(n.a,{href:"#gt",children:"gt"}),", ",(0,r.jsx)(n.a,{href:"#le",children:"le"}),", ",(0,r.jsx)(n.a,{href:"#lt",children:"lt"}),", ",(0,r.jsx)(n.a,{href:"#ne",children:"ne"}),",\n",(0,r.jsx)(n.a,{href:"#not",children:"not"}),", ",(0,r.jsx)(n.a,{href:"#or",children:"or"}),", and ",(0,r.jsx)(n.a,{href:"#required",children:"required"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"and",children:"and"}),"\n",(0,r.jsx)(n.p,{children:"Returns the boolean AND of two or more arguments\n(the first empty argument, or the last argument)."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"and .Arg1 .Arg2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"or",children:"or"}),"\n",(0,r.jsx)(n.p,{children:"Returns the boolean OR of two or more arguments\n(the first non-empty argument, or the last argument)."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"or .Arg1 .Arg2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"not",children:"not"}),"\n",(0,r.jsx)(n.p,{children:"Returns the boolean negation of its argument."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"not .Arg\n"})}),"\n",(0,r.jsx)(n.h3,{id:"eq",children:"eq"}),"\n",(0,r.jsx)(n.p,{children:"Returns the boolean equality of the arguments (e.g., Arg1 == Arg2)."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"eq .Arg1 .Arg2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"ne",children:"ne"}),"\n",(0,r.jsx)(n.p,{children:"Returns the boolean inequality of the arguments (e.g., Arg1 != Arg2)"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"ne .Arg1 .Arg2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"lt",children:"lt"}),"\n",(0,r.jsx)(n.p,{children:"Returns a boolean true if the first argument is less than the second. False is\nreturned otherwise (e.g., Arg1 < Arg2)."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"lt .Arg1 .Arg2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"le",children:"le"}),"\n",(0,r.jsx)(n.p,{children:"Returns a boolean true if the first argument is less than or equal to the\nsecond. False is returned otherwise (e.g., Arg1 <= Arg2)."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"le .Arg1 .Arg2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"gt",children:"gt"}),"\n",(0,r.jsx)(n.p,{children:"Returns a boolean true if the first argument is greater than the second. False\nis returned otherwise (e.g., Arg1 > Arg2)."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"gt .Arg1 .Arg2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"ge",children:"ge"}),"\n",(0,r.jsx)(n.p,{children:"Returns a boolean true if the first argument is greater than or equal to the\nsecond. False is returned otherwise (e.g., Arg1 >= Arg2)."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"ge .Arg1 .Arg2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"default",children:"default"}),"\n",(0,r.jsxs)(n.p,{children:["To set a simple default value, use ",(0,r.jsx)(n.code,{children:"default"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'default "foo" .Bar\n'})}),"\n",(0,r.jsxs)(n.p,{children:["In the above, if ",(0,r.jsx)(n.code,{children:".Bar"})," evaluates to a non-empty value, it will be used. But if\nit is empty, ",(0,r.jsx)(n.code,{children:"foo"})," will be returned instead."]}),"\n",(0,r.jsx)(n.p,{children:'The definition of "empty" depends on type:'}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Numeric: 0"}),"\n",(0,r.jsx)(n.li,{children:'String: ""'}),"\n",(0,r.jsxs)(n.li,{children:["Lists: ",(0,r.jsx)(n.code,{children:"[]"})]}),"\n",(0,r.jsxs)(n.li,{children:["Dicts: ",(0,r.jsx)(n.code,{children:"{}"})]}),"\n",(0,r.jsxs)(n.li,{children:["Boolean: ",(0,r.jsx)(n.code,{children:"false"})]}),"\n",(0,r.jsxs)(n.li,{children:["And always ",(0,r.jsx)(n.code,{children:"nil"})," (aka null)"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"For structs, there is no definition of empty, so a struct will never return the\ndefault."}),"\n",(0,r.jsx)(n.h3,{id:"required",children:"required"}),"\n",(0,r.jsxs)(n.p,{children:["Specify values that must be set with ",(0,r.jsx)(n.code,{children:"required"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'required "A val
1id foo is required!" .Bar\n'})}),"\n",(0,r.jsxs)(n.p,{children:["If ",(0,r.jsx)(n.code,{children:".Bar"})," is empty or not defined (see ",(0,r.jsx)(n.a,{href:"#default",children:"default"})," on how this is\nevaluated), the template will not render and will return the error message\nsupplied instead."]}),"\n",(0,r.jsx)(n.h3,{id:"empty",children:"empty"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"empty"})," function returns ",(0,r.jsx)(n.code,{children:"true"})," if the given value is considered empty, and\n",(0,r.jsx)(n.code,{children:"false"})," otherwise. The empty values are listed in the ",(0,r.jsx)(n.code,{children:"default"})," section."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"empty .Foo\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Note that in Go template conditionals, emptiness is calculated for you. Thus,\nyou rarely need ",(0,r.jsx)(n.code,{children:"if not empty .Foo"}),". Instead, just use ",(0,r.jsx)(n.code,{children:"if .Foo"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"fail",children:"fail"}),"\n",(0,r.jsxs)(n.p,{children:["Unconditionally returns an empty ",(0,r.jsx)(n.code,{children:"string"})," and an ",(0,r.jsx)(n.code,{children:"error"})," with the specified\ntext. This is useful in scenarios where other conditionals have determined that\ntemplate rendering should fail."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'fail "Please accept the end user license agreement"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"coalesce",children:"coalesce"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"coalesce"})," function takes a list of values and returns the first non-empty\none."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"coalesce 0 1 2\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"1"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"This function is useful for scanning through multiple variables or values:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'coalesce .name .parent.name "Matt"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above will first check to see if ",(0,r.jsx)(n.code,{children:".name"})," is empty. If it is not, it will\nreturn that value. If it ",(0,r.jsx)(n.em,{children:"is"})," empty, ",(0,r.jsx)(n.code,{children:"coalesce"})," will evaluate ",(0,r.jsx)(n.code,{children:".parent.name"})," for\nemptiness. Finally, if both ",(0,r.jsx)(n.code,{children:".name"})," and ",(0,r.jsx)(n.code,{children:".parent.name"})," are empty, it will return\n",(0,r.jsx)(n.code,{children:"Matt"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"ternary",children:"ternary"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"ternary"})," function takes two values, and a test value. If the test value is\ntrue, the first value will be returned. If the test value is empty, the second\nvalue will be returned. This is similar to the ternary operator in C and other programming languages."]}),"\n",(0,r.jsx)(n.h4,{id:"true-test-value",children:"true test value"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'ternary "foo" "bar" true\n'})}),"\n",(0,r.jsx)(n.p,{children:"or"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'true | ternary "foo" "bar"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:'"foo"'}),"."]}),"\n",(0,r.jsx)(n.h4,{id:"false-test-value",children:"false test value"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'ternary "foo" "bar" false\n'})}),"\n",(0,r.jsx)(n.p,{children:"or"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'false | ternary "foo" "bar"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:'"bar"'}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"string-functions",children:"String Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm includes the following string functions: ",(0,r.jsx)(n.a,{href:"#abbrev",children:"abbrev"}),",\n",(0,r.jsx)(n.a,{href:"#abbrevboth",children:"abbrevboth"}),", ",(0,r.jsx)(n.a,{href:"#camelcase",children:"camelcase"}),", ",(0,r.jsx)(n.a,{href:"#cat",children:"cat"}),",\n",(0,r.jsx)(n.a,{href:"#contains",children:"contains"}),", ",(0,r.jsx)(n.a,{href:"#hasprefix-and-hassuffix",children:"hasPrefix"}),",\n",(0,r.jsx)(n.a,{href:"#hasprefix-and-hassuffix",children:"hasSuffix"}),", ",(0,r.jsx)(n.a,{href:"#indent",children:"indent"}),", ",(0,r.jsx)(n.a,{href:"#initials",children:"initials"}),",\n",(0,r.jsx)(n.a,{href:"#kebabcase",children:"kebabcase"}),", ",(0,r.jsx)(n.a,{href:"#lower",children:"lower"}),", ",(0,r.jsx)(n.a,{href:"#nindent",children:"nindent"}
1),",\n",(0,r.jsx)(n.a,{href:"#nospace",children:"nospace"}),", ",(0,r.jsx)(n.a,{href:"#plural",children:"plural"}),", ",(0,r.jsx)(n.a,{href:"#print",children:"print"}),", ",(0,r.jsx)(n.a,{href:"#printf",children:"printf"}),",\n",(0,r.jsx)(n.a,{href:"#println",children:"println"}),", ",(0,r.jsx)(n.a,{href:"#quote-and-squote",children:"quote"}),",\n",(0,r.jsx)(n.a,{href:"#randalphanum-randalpha-randnumeric-and-randascii",children:"randAlpha"}),",\n",(0,r.jsx)(n.a,{href:"#randalphanum-randalpha-randnumeric-and-randascii",children:"randAlphaNum"}),",\n",(0,r.jsx)(n.a,{href:"#randalphanum-randalpha-randnumeric-and-randascii",children:"randAscii"}),",\n",(0,r.jsx)(n.a,{href:"#randalphanum-randalpha-randnumeric-and-randascii",children:"randNumeric"}),",\n",(0,r.jsx)(n.a,{href:"#repeat",children:"repeat"}),", ",(0,r.jsx)(n.a,{href:"#replace",children:"replace"}),", ",(0,r.jsx)(n.a,{href:"#shuffle",children:"shuffle"}),",\n",(0,r.jsx)(n.a,{href:"#snakecase",children:"snakecase"}),", ",(0,r.jsx)(n.a,{href:"#quote-and-squote",children:"squote"}),", ",(0,r.jsx)(n.a,{href:"#substr",children:"substr"}),",\n",(0,r.jsx)(n.a,{href:"#swapcase",children:"swapcase"}),", ",(0,r.jsx)(n.a,{href:"#title",children:"title"}),", ",(0,r.jsx)(n.a,{href:"#trim",children:"trim"}),", ",(0,r.jsx)(n.a,{href:"#trimall",children:"trimAll"}),",\n",(0,r.jsx)(n.a,{href:"#trimprefix",children:"trimPrefix"}),", ",(0,r.jsx)(n.a,{href:"#trimsuffix",children:"trimSuffix"}),", ",(0,r.jsx)(n.a,{href:"#trunc",children:"trunc"}),",\n",(0,r.jsx)(n.a,{href:"#untitle",children:"untitle"}),", ",(0,r.jsx)(n.a,{href:"#upper",children:"upper"}),", ",(0,r.jsx)(n.a,{href:"#wrap",children:"wrap"}),", and ",(0,r.jsx)(n.a,{href:"#wrapwith",children:"wrapWith"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"print",children:"print"}),"\n",(0,r.jsx)(n.p,{children:"Returns a string from the combination of its parts."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'print "Matt has " .Dogs " dogs"\n'})}),"\n",(0,r.jsx)(n.p,{children:"Types that are not strings are converted to strings where possible."}),"\n",(0,r.jsx)(n.p,{children:"Note, when two arguments next to each other are not strings a space is added\nbetween them."}),"\n",(0,r.jsx)(n.h3,{id:"println",children:"println"}),"\n",(0,r.jsxs)(n.p,{children:["Works the same way as ",(0,r.jsx)(n.a,{href:"#print",children:"print"})," but adds a new line at the end."]}),"\n",(0,r.jsx)(n.h3,{id:"printf",children:"printf"}),"\n",(0,r.jsx)(n.p,{children:"Returns a string based on a formatting string and the arguments to pass to it in\norder."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'printf "%s has %d dogs." .Name .NumberDogs\n'})}),"\n",(0,r.jsx)(n.p,{children:"The placeholder to use depends on the type for the argument being passed in.\nThis includes:"}),"\n",(0,r.jsx)(n.p,{children:"General purpose:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%v"})," the value in a default format\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"when printing dicts, the plus flag (%+v) adds field names"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%%"})," a literal percent sign; consumes no value"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Boolean:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%t"})," the word true or false"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Integer:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%b"})," base 2"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%c"})," the character represented by the corresponding Unicode code point"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%d"})," base 10"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%o"})," base 8"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%O"})," base 8 with 0o prefix"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%q"})," a single-quoted character literal safely escaped"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%x"})," base 16, with lower-case letters for a-f"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%X"})," base 16, with upper-case letters for A-F"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%U"}),' Unicode format: U+1234; same as "U+%04X"']}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Floating-point and complex constituents:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%b"})," decimal less scientific notation with exponent a power of two, e.g.\n-123456p-78"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%e"})," scientific notation, e.g. -1.234456e+78"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%E"})," scientific notation, e.g. -1.234456E+78"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%f"}
1)," decimal point but no exponent, e.g. 123.456"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%F"})," synonym for %f"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%g"})," %e for large exponents, %f otherwise."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%G"})," %E for large exponents, %F otherwise"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%x"})," hexadecimal notation (with decimal power of two exponent), e.g.\n-0x1.23abcp+20"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%X"})," upper-case hexadecimal notation, e.g. -0X1.23ABCP+20"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"String and slice of bytes (treated equivalently with these verbs):"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%s"})," the uninterpreted bytes of the string or slice"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%q"})," a double-quoted string safely escaped"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%x"})," base 16, lower-case, two characters per byte"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%X"})," base 16, upper-case, two characters per byte"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Slice:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"%p"})," address of 0th element in base 16 notation, with leading 0x"]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"trim",children:"trim"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"trim"})," function removes white space from both sides of a string:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'trim " hello "\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"hello"})]}),"\n",(0,r.jsx)(n.h3,{id:"trimall",children:"trimAll"}),"\n",(0,r.jsx)(n.p,{children:"Removes the given characters from the front and back of a string:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'trimAll "$" "$5.00"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"5.00"})," (as a string)."]}),"\n",(0,r.jsx)(n.h3,{id:"trimprefix",children:"trimPrefix"}),"\n",(0,r.jsx)(n.p,{children:"Trim just the prefix from a string:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'trimPrefix "-" "-hello"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"hello"})]}),"\n",(0,r.jsx)(n.h3,{id:"trimsuffix",children:"trimSuffix"}),"\n",(0,r.jsx)(n.p,{children:"Trim just the suffix from a string:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'trimSuffix "-" "hello-"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"hello"})]}),"\n",(0,r.jsx)(n.h3,{id:"lower",children:"lower"}),"\n",(0,r.jsx)(n.p,{children:"Convert the entire string to lowercase:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'lower "HELLO"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"hello"})]}),"\n",(0,r.jsx)(n.h3,{id:"upper",children:"upper"}),"\n",(0,r.jsx)(n.p,{children:"Convert the entire string to uppercase:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'upper "hello"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"HELLO"})]}),"\n",(0,r.jsx)(n.h3,{id:"title",children:"title"}),"\n",(0,r.jsx)(n.p,{children:"Convert to title case:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'title "hello world"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"Hello World"})]}),"\n",(0,r.jsx)(n.h3,{id:"untitle",children:"untitle"}),"\n",(0,r.jsxs)(n.p,{children:["Remove title casing. ",(0,r.jsx)(n.code,{children:'untitle "Hello World"'})," produces ",(0,r.jsx)(n.code,{children:"hello world"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"repeat",children:"repeat"}),"\n",(0,r.jsx)(n.p,{children:"Repeat a string multiple times:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'repeat 3 "hello"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"hellohellohello"})]}),"\n",(0,r.jsx)(n.h3,{id:"substr",children:"substr"}),"\n",(0,r.jsx)(n.p,{children:"Get a substring from a string. It takes three parameters:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"start (int)"}),"\n",(0,r.jsx)(n.li,{children:"end (int)"}),"\n",(0,r.jsx)(n.li,{children:"string (string)"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'substr 0 5 "hello world"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"hello"})]}
1),"\n",(0,r.jsx)(n.h3,{id:"nospace",children:"nospace"}),"\n",(0,r.jsx)(n.p,{children:"Remove all whitespace from a string."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'nospace "hello w o r l d"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"helloworld"})]}),"\n",(0,r.jsx)(n.h3,{id:"trunc",children:"trunc"}),"\n",(0,r.jsx)(n.p,{children:"Truncate a string"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'trunc 5 "hello world"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"hello"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'trunc -5 "hello world"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"world"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"abbrev",children:"abbrev"}),"\n",(0,r.jsxs)(n.p,{children:["Truncate a string with ellipses (",(0,r.jsx)(n.code,{children:"..."}),")"]}),"\n",(0,r.jsx)(n.p,{children:"Parameters:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"max length"}),"\n",(0,r.jsx)(n.li,{children:"the string"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'abbrev 5 "hello world"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"he..."}),", since it counts the width of the ellipses against the\nmaximum length."]}),"\n",(0,r.jsx)(n.h3,{id:"abbrevboth",children:"abbrevboth"}),"\n",(0,r.jsx)(n.p,{children:"Abbreviate both sides:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'abbrevboth 5 10 "1234 5678 9123"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["the above produces ",(0,r.jsx)(n.code,{children:"...5678..."})]}),"\n",(0,r.jsx)(n.p,{children:"It takes:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"left offset"}),"\n",(0,r.jsx)(n.li,{children:"max length"}),"\n",(0,r.jsx)(n.li,{children:"the string"}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"initials",children:"initials"}),"\n",(0,r.jsx)(n.p,{children:"Given multiple words, take the first letter of each word and combine."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'initials "First Try"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"FT"})]}),"\n",(0,r.jsx)(n.h3,{id:"randalphanum-randalpha-randnumeric-and-randascii",children:"randAlphaNum, randAlpha, randNumeric, and randAscii"}),"\n",(0,r.jsxs)(n.p,{children:["These four functions generate cryptographically secure (uses ",(0,r.jsx)(n.code,{children:"crypto/rand"}),")\nrandom strings, but with different base character sets:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"randAlphaNum"})," uses ",(0,r.jsx)(n.code,{children:"0-9a-zA-Z"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"randAlpha"})," uses ",(0,r.jsx)(n.code,{children:"a-zA-Z"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"randNumeric"})," uses ",(0,r.jsx)(n.code,{children:"0-9"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"randAscii"})," uses all printable ASCII characters"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Each of them takes one parameter: the integer length of the string."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"randNumeric 3\n"})}),"\n",(0,r.jsx)(n.p,{children:"The above will produce a random string with three digits."}),"\n",(0,r.jsx)(n.h3,{id:"wrap",children:"wrap"}),"\n",(0,r.jsx)(n.p,{children:"Wrap text at a given column count:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"wrap 80 $someText\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above will wrap the string in ",(0,r.jsx)(n.code,{children:"$someText"})," at 80 columns."]}),"\n",(0,r.jsx)(n.h3,{id:"wrapwith",children:"wrapWith"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"wrapWith"})," works as ",(0,r.jsx)(n.code,{children:"wrap"}),", but lets you specify the string to wrap with.\n(",(0,r.jsx)(n.code,{children:"wrap"})," uses ",(0,r.jsx)(n.code,{children:"\\n"}),")"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'wrapWith 5 "\\t" "Hello World"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"Hello World"})," (where the whitespace is an ASCII tab\ncharacter)"]}),"\n",(0,r.jsx)(n.h3,{id:"contains",children:"contains"}),"\n",(0,r.jsx)(n.p,{children:"Test to see if one string is contained inside of another:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'contains "cat" "catch"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"true"}
1)," because ",(0,r.jsx)(n.code,{children:"catch"})," contains ",(0,r.jsx)(n.code,{children:"cat"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"hasprefix-and-hassuffix",children:"hasPrefix and hasSuffix"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"hasPrefix"})," and ",(0,r.jsx)(n.code,{children:"hasSuffix"})," functions test whether a string has a given\nprefix or suffix:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'hasPrefix "cat" "catch"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"true"})," because ",(0,r.jsx)(n.code,{children:"catch"})," has the prefix ",(0,r.jsx)(n.code,{children:"cat"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"quote-and-squote",children:"quote and squote"}),"\n",(0,r.jsxs)(n.p,{children:["These functions wrap a string in double quotes (",(0,r.jsx)(n.code,{children:"quote"}),") or single quotes\n(",(0,r.jsx)(n.code,{children:"squote"}),")."]}),"\n",(0,r.jsx)(n.h3,{id:"cat",children:"cat"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"cat"})," function concatenates multiple strings together into one, separating\nthem with spaces:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'cat "hello" "beautiful" "world"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"hello beautiful world"})]}),"\n",(0,r.jsx)(n.h3,{id:"indent",children:"indent"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"indent"})," function indents every line in a given string to the specified\nindent width. This is useful when aligning multi-line strings:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"indent 4 $lots_of_text\n"})}),"\n",(0,r.jsx)(n.p,{children:"The above will indent every line of text by 4 space characters."}),"\n",(0,r.jsx)(n.h3,{id:"nindent",children:"nindent"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"nindent"})," function is the same as the indent function, but prepends a new\nline to the beginning of the string."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"nindent 4 $lots_of_text\n"})}),"\n",(0,r.jsx)(n.p,{children:"The above will indent every line of text by 4 space characters and add a new\nline to the beginning."}),"\n",(0,r.jsx)(n.h3,{id:"replace",children:"replace"}),"\n",(0,r.jsx)(n.p,{children:"Perform simple string replacement."}),"\n",(0,r.jsx)(n.p,{children:"It takes three arguments:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"string to replace"}),"\n",(0,r.jsx)(n.li,{children:"string to replace with"}),"\n",(0,r.jsx)(n.li,{children:"source string"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'"I Am Henry VIII" | replace " " "-"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above will produce ",(0,r.jsx)(n.code,{children:"I-Am-Henry-VIII"})]}),"\n",(0,r.jsx)(n.h3,{id:"plural",children:"plural"}),"\n",(0,r.jsx)(n.p,{children:"Pluralize a string."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'len $fish | plural "one anchovy" "many anchovies"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["In the above, if the length of the string is 1, the first argument will be\nprinted (",(0,r.jsx)(n.code,{children:"one anchovy"}),"). Otherwise, the second argument will be printed (",(0,r.jsx)(n.code,{children:"many anchovies"}),")."]}),"\n",(0,r.jsx)(n.p,{children:"The arguments are:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"singular string"}),"\n",(0,r.jsx)(n.li,{children:"plural string"}),"\n",(0,r.jsx)(n.li,{children:"length integer"}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["NOTE: Helm does not currently support languages with more complex pluralization\nrules. And ",(0,r.jsx)(n.code,{children:"0"})," is considered a plural because the English language treats it as\nsuch (",(0,r.jsx)(n.code,{children:"zero anchovies"}),")."]}),"\n",(0,r.jsx)(n.h3,{id:"snakecase",children:"snakecase"}),"\n",(0,r.jsx)(n.p,{children:"Convert string from camelCase to snake_case."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'snakecase "FirstName"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["This above will produce ",(0,r.jsx)(n.code,{children:"first_name"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"camelcase",children:"camelcase"}),"\n",(0,r.jsx)(n.p,{children:"Convert string from snake_case to CamelCase"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'camelcase "http_server"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["This above will produce ",(0,r.jsx)(n.code,{children:"HttpServer"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"kebabcase",children:"kebabcase"}),"\n",(0,r.jsx)(n.p,{children:"Convert string from camelCase to kebab-case."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'kebabcase "FirstName"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["This above will produce ",(0,r.jsx)(n.code,{children:"first-name"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"swapcase",children:"swapcase"}),"\n",(0,r.jsx)(n.p,{children:"Swap the case of a string using a word based algorithm."}),"\n",(0,r.jsx)(n.p,{children:"Conversion algorithm:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Upper case character converts to Lower case"}),"\n",(0,r.jsx)(n.li,{children:"Title case character converts to Lower case"}),"\n",(0,r.jsx)(n.li,{children:"Lower case character after Whitespace or at start converts to Title c
1ase"}),"\n",(0,r.jsx)(n.li,{children:"Other Lower case character converts to Upper case"}),"\n",(0,r.jsx)(n.li,{children:"Whitespace is defined by unicode.IsSpace(char)"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'swapcase "This Is A.Test"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["This above will produce ",(0,r.jsx)(n.code,{children:"tHIS iS a.tEST"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"shuffle",children:"shuffle"}),"\n",(0,r.jsx)(n.p,{children:"Shuffle a string."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'shuffle "hello"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above will randomize the letters in ",(0,r.jsx)(n.code,{children:"hello"}),", perhaps producing ",(0,r.jsx)(n.code,{children:"oelhl"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"type-conversion-functions",children:"Type Conversion Functions"}),"\n",(0,r.jsx)(n.p,{children:"The following type conversion functions are provided by Helm:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"atoi"}),": Convert a string to an integer."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"float64"}),": Convert to a ",(0,r.jsx)(n.code,{children:"float64"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"int"}),": Convert to an ",(0,r.jsx)(n.code,{children:"int"})," at the system's width."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"int64"}),": Convert to an ",(0,r.jsx)(n.code,{children:"int64"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"toDecimal"}),": Convert a unix octal to a ",(0,r.jsx)(n.code,{children:"int64"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"toString"}),": Convert to a string."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"toStrings"}),": Convert a list, slice, or array to a list of strings."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"toJson"})," (",(0,r.jsx)(n.code,{children:"mustToJson"}),"): Convert list, slice, array, dict, or object to JSON."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"toPrettyJson"})," (",(0,r.jsx)(n.code,{children:"mustToPrettyJson"}),"): Convert list, slice, array, dict, or\nobject to indented JSON."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"toRawJson"})," (",(0,r.jsx)(n.code,{children:"mustToRawJson"}),"): Convert list, slice, array, dict, or object to\nJSON with HTML characters unescaped."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"fromYaml"}),": Convert a YAML string to an object."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"fromJson"}),": Convert a JSON string to an object."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"fromJsonArray"}),": Convert a JSON array to a list."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"toYaml"}),": Convert list, slice, array, dict, or object to indented yaml, can be used to copy chunks of yaml from any source. This function is equivalent to GoLang yaml.Marshal function, see docs here: ",(0,r.jsx)(n.a,{href:"https://pkg.go.dev/gopkg.in/yaml.v2#Marshal",children:"https://pkg.go.dev/gopkg.in/yaml.v2#Marshal"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"toYamlPretty"}),": Convert list, slice, array, dict, or object to indented yaml. Equivalent to ",(0,r.jsx)(n.code,{children:"toYaml"})," but will additionally indent lists by 2 spaces."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"toToml"}),": Convert list, slice, array, dict, or object to toml, can be used to copy chunks of toml from any source."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"fromToml"}
1),": Convert a TOML string to an object."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"fromYamlArray"}),": Convert a YAML array to a list."]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Only ",(0,r.jsx)(n.code,{children:"atoi"})," requires that the input be a specific type. The others will attempt\nto convert from any type to the destination type. For example, ",(0,r.jsx)(n.code,{children:"int64"})," can\nconvert floats to ints, and it can also convert strings to ints."]}),"\n",(0,r.jsx)(n.h3,{id:"tostrings",children:"toStrings"}),"\n",(0,r.jsx)(n.p,{children:"Given a list-like collection, produce a slice of strings."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"list 1 2 3 | toStrings\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above converts ",(0,r.jsx)(n.code,{children:"1"})," to ",(0,r.jsx)(n.code,{children:'"1"'}),", ",(0,r.jsx)(n.code,{children:"2"})," to ",(0,r.jsx)(n.code,{children:'"2"'}),", and so on, and then returns them\nas a list."]}),"\n",(0,r.jsx)(n.h3,{id:"todecimal",children:"toDecimal"}),"\n",(0,r.jsx)(n.p,{children:"Given a unix octal permission, produce a decimal."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'"0777" | toDecimal\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above converts ",(0,r.jsx)(n.code,{children:"0777"})," to ",(0,r.jsx)(n.code,{children:"511"})," and returns the value as an int64."]}),"\n",(0,r.jsx)(n.h3,{id:"tojson-musttojson",children:"toJson, mustToJson"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"toJson"})," function encodes an item into a JSON string. If the item cannot be\nconverted to JSON the function will return an empty string. ",(0,r.jsx)(n.code,{children:"mustToJson"})," will\nreturn an error in case the item cannot be encoded in JSON."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"toJson .Item\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns JSON string representation of ",(0,r.jsx)(n.code,{children:".Item"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"toprettyjson-musttoprettyjson",children:"toPrettyJson, mustToPrettyJson"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"toPrettyJson"})," function encodes an item into a pretty (indented) JSON\nstring."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"toPrettyJson .Item\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns indented JSON string representation of ",(0,r.jsx)(n.code,{children:".Item"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"torawjson-musttorawjson",children:"toRawJson, mustToRawJson"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"toRawJson"})," function encodes an item into JSON string with HTML characters\nunescaped."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"toRawJson .Item\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns unescaped JSON string representation of ",(0,r.jsx)(n.code,{children:".Item"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"fromyaml",children:"fromYaml"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"fromYaml"})," function takes a YAML string and returns an object that can be used in templates."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.code,{children:"File at: yamls/person.yaml"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"name: Bob\nage: 25\nhobbies:\n - hiking\n - fishing\n - cooking\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:'{{- $person := .Files.Get "yamls/person.yaml" | fromYaml }}\ngreeting: |\n Hi, my name is {{ $person.name }} and I am {{ $person.age }} years old.\n My hobbies are {{ range $person.hobbies }}{{ . }} {{ end }}.\n'})}),"\n",(0,r.jsx)(n.h3,{id:"fromjson",children:"fromJson"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"fromJson"})," function takes a JSON string and returns an object that can be used in templates."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.code,{children:"File at: jsons/person.json"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "name": "Bob",\n "age": 25,\n "hobbies": [\n "hiking",\n "fishing",\n "cooking"\n ]\n}\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:'{{- $person := .Files.Get "jsons/person.json" | fromJson }}\ngreeting: |\n Hi, my name is {{ $person.name }} and I am {{ $person.age }} years old.\n My hobbies are {{ range $person.hobbies }}{{ . }} {{ end }}.\n'})}),"\n",(0,r.jsx)(n.h3,{id:"fromjsonarray",children:"fromJsonArray"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"fromJsonArray"})," function takes a JSON Array and returns a list that can be used in templates."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.code,{children:"File at: jsons/people.json"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'[\n { "name": "Bob","age": 25 },\n { "name": "Ram","age": 16 }\n]\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:'{{- $people := .Files.Get "jsons/people.json" | fromJsonArray }}\n{{- range $person := $people }}\ngreeting: |\n Hi, my name is {{ $person.name }} and I am {{ $person.age }} years old.\n{{ end }}\n'})}),"\n",(0,r.jsx)(n.h3,{id:"toyaml-toyamlpretty",children:"toYaml, toYamlPretty"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"toYaml"})," and ",(0,r.jsx)(n.code,{children:"toYamlPretty"})," functions encode an object (list, slice, array, dict, or object) into an indented YAML string."]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:["Note that ",(0,r.jsx)(n.code,{children:"toYamlPretty"})," is functionally equivalent but will output YAML with additional indents for list elements"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"# toYaml\n- name: bob\n age: 25\n hobbies:\n - hiking\n - fishing\n - cooking\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"# toYamlPretty\n- name: bob\n age: 25\n hobbies:\n - hiking\n - fishing\n - cooking\n"})}),"\n",(0,r.jsx)(n.h3,{id:"totoml",children:"toToml"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"toToml"})," function encodes an item into a TOML string. If the item cannot be\nconverted to TOML, the function will return an error."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"config: {{ toToml .Values.config | nindent 2 }}\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns a TOML string representation of ",(0,r.jsx)(n.code,{children:".Values.config"}),"."]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:["Note: TOML does not support ",(0,r.jsx)(n.code,{children:"nil"}
1)," values. Passing a map or struct that\ncontains nil fields will cause ",(0,r.jsx)(n.code,{children:"toToml"})," to return an error."]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"fromtoml",children:"fromToml"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"fromToml"})," function takes a TOML string and returns an object that can be\nused in templates. If the input is not valid TOML, the function will return an\nerror."]}),"\n",(0,r.jsxs)(n.p,{children:["Given a file ",(0,r.jsx)(n.code,{children:"tomls/person.toml"})," with the following content:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-toml",children:'name = "Bob"\nage = 25\nhobbies = [ "hiking", "fishing", "cooking" ]\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:'{{- $person := .Files.Get "tomls/person.toml" | fromToml }}\ngreeting: |\n Hi, my name is {{ $person.name }} and I am {{ $person.age }} years old.\n My hobbies are {{ range $person.hobbies }}{{ . }} {{ end }}.\n'})}),"\n",(0,r.jsx)(n.h3,{id:"fromyamlarray",children:"fromYamlArray"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"fromYamlArray"})," function takes a YAML Array and returns a list that can be used in templates."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.code,{children:"File at: yamls/people.yml"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"- name: Bob\n age: 25\n- name: Ram\n age: 16\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:'{{- $people := .Files.Get "yamls/people.yml" | fromYamlArray }}\n{{- range $person := $people }}\ngreeting: |\n Hi, my name is {{ $person.name }} and I am {{ $person.age }} years old.\n{{ end }}\n'})}),"\n",(0,r.jsx)(n.h2,{id:"regular-expressions",children:"Regular Expressions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm includes the following regular expression functions: ",(0,r.jsx)(n.a,{href:"#regexfindall-mustregexfindall",children:"regexFind\n(mustRegexFind)"}),", ",(0,r.jsx)(n.a,{href:"#regexfind-mustregexfind",children:"regexFindAll\n(mustRegexFindAll)"}),", ",(0,r.jsx)(n.a,{href:"#regexmatch-mustregexmatch",children:"regexMatch\n(mustRegexMatch)"}),", ",(0,r.jsx)(n.a,{href:"#regexreplaceall-mustregexreplaceall",children:"regexReplaceAll\n(mustRegexReplaceAll)"}),",\n",(0,r.jsx)(n.a,{href:"#regexreplaceallliteral-mustregexreplaceallliteral",children:"regexReplaceAllLiteral\n(mustRegexReplaceAllLiteral)"}),",\n",(0,r.jsx)(n.a,{href:"#regexsplit-mustregexsplit",children:"regexSplit (mustRegexSplit)"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"regexmatch-mustregexmatch",children:"regexMatch, mustRegexMatch"}),"\n",(0,r.jsx)(n.p,{children:"Returns true if the input string contains any match of the regular expression."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'regexMatch "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Za-z]{2,}$" "[email protected]"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"true"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"regexMatch"})," panics if there is a problem and ",(0,r.jsx)(n.code,{children:"mustRegexMatch"})," returns an error\nto the template engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"regexfindall-mustregexfindall",children:"regexFindAll, mustRegexFindAll"}),"\n",(0,r.jsx)(n.p,{children:"Returns a slice of all matches of the regular expression in the input string.\nThe last parameter n determines the number of substrings to return, where -1\nmeans return all matches"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'regexFindAll "[2,4,6,8]" "123456789" -1\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"[2 4 6 8]"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"regexFindAll"})," panics if there is a problem and ",(0,r.jsx)(n.code,{children:"mustRegexFindAll"})," returns an\nerror to the template engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"regexfind-mustregexfind",children:"regexFind, mustRegexFind"}),"\n",(0,r.jsx)(n.p,{children:"Return the first (left most) match of the regular expression in the input string"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'regexFind "[a-zA-Z][1-9]" "abcd1234"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"d1"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"regexFind"})," panics if there is a problem and ",(0,r.jsx)(n.code,{children:"mustRegexFind"})," returns an error to\nthe template engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"regexreplaceall-mustregexreplaceall",children:"regexReplaceAll, mustRegexReplaceAll"}),"\n",(0,r.jsxs)(n.p,{children:["Returns a copy of the input string, replacing matches of the Regexp with the\nreplacement string replacement. Inside string replacement, $ signs are\ninterpreted as in Expand, so for instance $1 represents the text of the first\nsubmatch. The first argument is ",(0,r.jsx)(n.code,{children:"<pattern>"}),", second is ",(0,r.jsx)(n.code,{children:"<input>"}),",\nand third is ",(0,r.jsx)(n.code,{children:"<replacement>"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'regexReplaceAll "a(x*)b" "-ab-axxb-" "${1}W"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"-W-xxW-"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"regexReplaceAll"})," panics if there is a problem and ",(0,r.jsx)(n.code,{children:"mustRegexReplaceAll"})," returns\nan error to the template engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"regexreplaceallliteral-mustregexreplaceallliteral",children:"regexReplaceAllLiteral, mustRegexReplaceAllLiteral"}),"\n",(0,r.jsxs)(n.p,{children:["Returns a copy of the input string, replacing matches of the Regexp with the\nreplacement string replacement. The replacement string is substituted directly,\nwithout using Expand. The first argument is ",(0,r.jsx)(n.code,{children:"<pattern>"}),", second is ",(0,r.jsx)(n.code,{children:"<input>"}),",\nand third is ",(0,r.jsx)(n.code,{children:"<replacement>"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'regexReplaceAllLiteral "a(x*)b" "-ab-axxb-" "${1}"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"-${1}-${1}-"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"regexReplaceAllLiteral"})," panics if there is a problem and\n",(0,r.jsx)(n.code,{children:"mustRegexReplaceAllLiteral"})," returns an error to the template engine if there is\na problem."]}),"\n",(0,r.jsx)(n.h3,{id:"regexsplit-mustregexsplit",children:"regexSplit, mustRegexSplit"}),"\n",(0,r.jsxs)(n.p,{children:["Slices the input string into substrings separated by the expression and returns\na slice of the substrings between those expression matches. The last parameter\n",(0,r.jsx)(n.code,{children:"n"})," determines the number of substrings to return, where ",(0,r.jsx)(n.code,{children:"-1"})," means return all\nmatches"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'regexSplit "z+" "pizza" -1\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above produces ",(0,r.jsx)(n.code,{children:"[pi a]"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"regexSplit"})," panics if there is a problem and ",(0,r.jsx)(n.code,{children:"mustRegexSplit"})," returns an error\nto the template engine if there is a problem."]}),"\n",(0,r.jsx)(n.h2,{id:"cryptographic-and-security-functions",children:"Cryptographic and Security Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm provides some advanced cryptographic functions. They include\n",(0,r.jsx)(n.a,{href:"#adler32sum",children:"adler32sum"}),", ",(0,r.jsx)(n.a,{href:"#buildcustomcert",children:"buildCustomCert"}),",\n",(0,r.jsx)(n.a,{href:"#decryptaes",children:"decryptAES"}),", ",(0,r.jsx)(n.a,{href:"#derivepassword",children:"derivePassword"}),",\n",(0,r.jsx)(n.a,{href:"#encryptaes",children:"encryptAES"}),", ",(0,r.jsx)(n.a,{href:"#genca",children:"genCA"}),", ",(0,r.jsx)(n.a,{href:"#genprivatekey",children:"genPrivateKey"}),",\n",(0,r.jsx)(n.a,{href:"#genselfsignedcert",children:"genSelfSignedCert"}),", ",(0,r.jsx)(n.a,{href:"#gensignedcert",children:"genSignedCert"}),",\n",(0,r.jsx)(n.a,{href:"#htpasswd",children:"htpasswd"}),", ",(0,r.jsx)(n.a,{href:"#randbytes",children:"randBytes"}),", ",(0,r.jsx)(n.a,{href:"#sha1sum",children:"sha1sum"}),", and\n",(0,r.jsx)(n.a,{href:"#sha256sum",children:"sha256sum"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"sha1sum",children:"sha1sum"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"sha1sum"})," function receives a string, and computes it's SHA1 digest."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'sha1sum "Hello world!"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"sha256sum",children:"sha256sum"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"sha256sum"})," function receives a string, and computes it's SHA256 digest."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'sha256sum "Hello world!"\n'})}),"\n",(0,r.jsx)(n.p,{children:'The above will compute the SHA 256 sum in an "ASCII armored" format that is safe\nto print.'}),"\n",(0,r.jsx)(n.h3,{id:"adler32sum",children:"adler32sum"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"adler32sum"})," function receives a string, and computes its Adler-32 checksum."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'adler32sum "Hello world!"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"htpasswd",children:"htpasswd"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"htpasswd"})," function takes a ",(0,r.jsx)(n.code,{children:"username"})," and ",(0,r.jsx)(n.code,{children:"password"})," and generates a\n",(0,r.jsx)(n.code,{children:"bcrypt"})," hash of the password. The result can be used for basic authentication\non an ",(0,r.jsx)(n.a,{href:"https://httpd.apache.org/docs/2.4/misc/password_encryptions.html#basic",children:"Apache HTTP\nServer"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'htpasswd "myUser" "myPassword"\n'})}),"\n",(0,r.jsx)(n.p,{children:"Note that it is insecure to store the password directly in the template."}),"\n",(0,r.jsx)(n.h3,{id:"randbytes",children:"randBytes"}),"\n",(0,r.jsx)(n.p,{children:"The randBytes function accepts a count N and generates a cryptographically\nsecure (uses crypto/rand) random sequence of N bytes. The sequence is returned\nas a base64 encoded string."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"randBytes 24\n"})}),"\n",(0,r.jsx)(n.h3,{id:"derivepassword",children:"derivePassword"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"derivePassword"}),' function can be used to derive a specific password based on\nsome shared "master password" constraints. The algorithm for this is ',(0,r.jsx)(n.a,{href:"https://web.archive.org/web/20211019121301/https://masterpassword.app/masterpassword-algorithm.pdf",children:"well\nspecified"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'derivePassword 1 "long" "password" "user" "example.com"\n'})}),"\n",(0,r.jsx)(n.p,{children:"Note that it is considered insecure to store the parts directly in the template."}),"\n",(0,r.jsx)(n.h3,{id:"genprivatekey",children:"genPrivateKey"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"genPrivateKey"})," function generates a new private key encoded into a PEM\nblock."]}),"\n",(0,r.jsx)(n.p,{children:"It takes one of the values for its first param:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"ecdsa"}),": Generate an elliptic curve DSA key (P256)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"dsa"}),": Generate a DSA key (L2048N256)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"rsa"}),": Generate an RSA 4096 key"]}
1),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"buildcustomcert",children:"buildCustomCert"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"buildCustomCert"})," function allows customizing the certificate."]}),"\n",(0,r.jsx)(n.p,{children:"It takes the following string parameters:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"A base64 encoded PEM format certificate"}),"\n",(0,r.jsx)(n.li,{children:"A base64 encoded PEM format private key"}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"It returns a certificate object with the following attributes:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Cert"}),": A PEM-encoded certificate"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Key"}),": A PEM-encoded private key"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Example:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$ca := buildCustomCert "base64-encoded-ca-crt" "base64-encoded-ca-key"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Note that the returned object can be passed to the ",(0,r.jsx)(n.code,{children:"genSignedCert"})," function to\nsign a certificate using this CA."]}),"\n",(0,r.jsx)(n.h3,{id:"genca",children:"genCA"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"genCA"})," function generates a new, self-signed x509 certificate authority."]}),"\n",(0,r.jsx)(n.p,{children:"It takes the following parameters:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Subject's common name (cn)"}),"\n",(0,r.jsx)(n.li,{children:"Cert validity duration in days"}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"It returns an object with the following attributes:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Cert"}),": A PEM-encoded certificate"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Key"}),": A PEM-encoded private key"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Example:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$ca := genCA "foo-ca" 365\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Note that the returned object can be passed to the ",(0,r.jsx)(n.code,{children:"genSignedCert"})," function to\nsign a certificate using this CA."]}),"\n",(0,r.jsx)(n.h3,{id:"genselfsignedcert",children:"genSelfSignedCert"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"genSelfSignedCert"})," function generates a new, self-signed x509 certificate."]}),"\n",(0,r.jsx)(n.p,{children:"It takes the following parameters:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Subject's common name (cn)"}),"\n",(0,r.jsx)(n.li,{children:"Optional list of IPs; may be nil"}),"\n",(0,r.jsx)(n.li,{children:"Optional list of alternate DNS names; may be nil"}),"\n",(0,r.jsx)(n.li,{children:"Cert validity duration in days"}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"It returns an object with the following attributes:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Cert"}),": A PEM-encoded certificate"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Key"}),": A PEM-encoded private key"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Example:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$cert := genSelfSignedCert "foo.com" (list "10.0.0.1" "10.0.0.2") (list "bar.com" "bat.com") 365\n'})}),"\n",(0,r.jsx)(n.h3,{id:"gensignedcert",children:"genSignedCert"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"genSignedCert"})," function generates a new, x509 certificate signed by the\nspecified CA."]}),"\n",(0,r.jsx)(n.p,{children:"It takes the following parameters:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Subject's common name (cn)"}),"\n",(0,r.jsx)(n.li,{children:"Optional list of IPs; may be nil"}),"\n",(0,r.jsx)(n.li,{children:"Optional list of alternate DNS names; may be nil"}),"\n",(0,r.jsx)(n.li,{children:"Cert validity duration in days"}),"\n",(0,r.jsxs)(n.li,{children:["CA (see ",(0,r.jsx)(n.code,{children:"genCA"}),")"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Example:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$ca := genCA "foo-ca" 365\n$cert := genSignedCert "foo.com" (list "10.0.0.1" "10.0.0.2") (list "bar.com" "bat.com") 365 $ca\n'})}),"\n",(0,r.jsx)(n.h3,{id:"encryptaes",children:"encryptAES"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"encryptAES"})," function encrypts text with AES-256 CBC and returns a base64\nencoded string."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'encryptAES "secretkey" "plaintext"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"decryptaes",children:"decryptAES"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"decryptAES"})," function receives a base64 string encoded by the AES-256 CBC\nalgorithm and returns the decoded text."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'"30tEfhuJSVRhpG97XCuWgz2okj7L8vQ1s6V9zVUPeD
1Q=" | decryptAES "secretkey"\n'})}),"\n",(0,r.jsx)(n.h2,{id:"date-functions",children:"Date Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm includes the following date functions you can use in templates:\n",(0,r.jsx)(n.a,{href:"#ago",children:"ago"}),", ",(0,r.jsx)(n.a,{href:"#date",children:"date"}),", ",(0,r.jsx)(n.a,{href:"#dateinzone",children:"dateInZone"}),", ",(0,r.jsx)(n.a,{href:"#datemodify-mustdatemodify",children:"dateModify\n(mustDateModify)"}),", ",(0,r.jsx)(n.a,{href:"#duration",children:"duration"}),",\n",(0,r.jsx)(n.a,{href:"#durationround",children:"durationRound"}),", ",(0,r.jsx)(n.a,{href:"#htmldate",children:"htmlDate"}),",\n",(0,r.jsx)(n.a,{href:"#htmldateinzone",children:"htmlDateInZone"}),", ",(0,r.jsx)(n.a,{href:"#now",children:"now"}),", ",(0,r.jsx)(n.a,{href:"#todate-musttodate",children:"toDate\n(mustToDate)"}),", and ",(0,r.jsx)(n.a,{href:"#unixepoch",children:"unixEpoch"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"now",children:"now"}),"\n",(0,r.jsx)(n.p,{children:"The current date/time. Use this in conjunction with other date functions."}),"\n",(0,r.jsx)(n.h3,{id:"ago",children:"ago"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"ago"})," function returns duration from time. Now in seconds resolution."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"ago .CreatedAt\n"})}),"\n",(0,r.jsxs)(n.p,{children:["returns in ",(0,r.jsx)(n.code,{children:"time.Duration"})," String() format"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"2h34m7s\n"})}),"\n",(0,r.jsx)(n.h3,{id:"date",children:"date"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"date"})," function formats a date."]}),"\n",(0,r.jsx)(n.p,{children:"Format the date to YEAR-MONTH-DAY:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'now | date "2006-01-02"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Date formatting in Go is a ",(0,r.jsx)(n.a,{href:"https://pauladamsmith.com/blog/2011/05/go_time.html",children:"little bit\ndifferent"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"In short, take this as the base date:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"Mon Jan 2 15:04:05 MST 2006\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Write it in the format you want. Above, ",(0,r.jsx)(n.code,{children:"2006-01-02"})," is the same date, but in\nthe format we want."]}),"\n",(0,r.jsx)(n.h3,{id:"dateinzone",children:"dateInZone"}),"\n",(0,r.jsxs)(n.p,{children:["Same as ",(0,r.jsx)(n.code,{children:"date"}),", but with a timezone."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'dateInZone "2006-01-02" (now) "UTC"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"duration",children:"duration"}),"\n",(0,r.jsxs)(n.p,{children:["Formats a given amount of seconds as a ",(0,r.jsx)(n.code,{children:"time.Duration"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"This returns 1m35s"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'duration "95"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"durationround",children:"durationRound"}),"\n",(0,r.jsxs)(n.p,{children:["Rounds a given duration to the most significant unit. Strings and\n",(0,r.jsx)(n.code,{children:"time.Duration"})," gets parsed as a duration, while a ",(0,r.jsx)(n.code,{children:"time.Time"})," is calculated as\nthe duration since."]}),"\n",(0,r.jsx)(n.p,{children:"This return 2h"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'durationRound "2h10m5s"\n'})}),"\n",(0,r.jsx)(n.p,{children:"This returns 3mo"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'durationRound "2400h10m5s"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"unixepoch",children:"unixEpoch"}),"\n",(0,r.jsxs)(n.p,{children:["Returns the seconds since the unix epoch for a ",(0,r.jsx)(n.code,{children:"time.Time"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"now | unixEpoch\n"})}),"\n",(0,r.jsx)(n.h3,{id:"datemodify-mustdatemodify",children:"dateModify, mustDateModify"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"dateModify"})," takes a modification and a date and returns the timestamp."]}),"\n",(0,r.jsx)(n.p,{children:"Subtract an hour and thirty minutes from the current time:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'now | dateModify "-1.5h"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["If the modification format is wrong ",(0,r.jsx)(n.code,{children:"dateModify"})," will return the date\nunmodified. ",(0,r.jsx)(n.code,{children:"mustDateModify"})," will return an error otherwise."]}),"\n",(0,r.jsx)(n.h3,{id:"htmldate",children:"htmlDate"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"htmlDate"})," function formats a date for inserting into an HTML date picker\ninput field."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"now | htmlDate\n"})}),"\n",(0,r.jsx)(n.h3,{id:"htmldateinzone",children:"htmlDateInZone"}),"\n",(0,r.jsx)(n.p,{children:"Same as htmlDate, but with a timezone."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'htmlDateInZone (now) "UTC"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"todate-musttodate",children:"toDate, mustToDate"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"toDate"})," converts a string to a date. The first argument is the date layout and\nthe second the date string. If the string can't be convert it returns the zero\nvalue. ",(0,r.jsx)(n.code,{children:"mustToDate"})," will return an error in case the string cannot be converted."]}),"\n",(0,r.jsx)(n.p,{children:'This is useful when you want to convert a string date to another format (using\npipe). The example below converts "2017-12-31" to "31/12/2017".'}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'toDate "2006-01-02" "2017-12-31" | date "02/01/2006"\
1n'})}),"\n",(0,r.jsx)(n.h2,{id:"dictionaries-and-dict-functions",children:"Dictionaries and Dict Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm provides a key/value storage type called a ",(0,r.jsx)(n.code,{children:"dict"}),' (short for "dictionary",\nas in Python). A ',(0,r.jsx)(n.code,{children:"dict"})," is an ",(0,r.jsx)(n.em,{children:"unordered"})," type."]}),"\n",(0,r.jsxs)(n.p,{children:["The key to a dictionary ",(0,r.jsx)(n.strong,{children:"must be a string"}),". However, the value can be any\ntype, even another ",(0,r.jsx)(n.code,{children:"dict"})," or ",(0,r.jsx)(n.code,{children:"list"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Unlike ",(0,r.jsx)(n.code,{children:"list"}),"s, ",(0,r.jsx)(n.code,{children:"dict"}),"s are not immutable. The ",(0,r.jsx)(n.code,{children:"set"})," and ",(0,r.jsx)(n.code,{children:"unset"})," functions will\nmodify the contents of a dictionary."]}),"\n",(0,r.jsxs)(n.p,{children:["Helm provides the following functions to support working with dicts: ",(0,r.jsx)(n.a,{href:"#deepcopy-mustdeepcopy",children:"deepCopy\n(mustDeepCopy)"}),", ",(0,r.jsx)(n.a,{href:"#dict",children:"dict"}),", ",(0,r.jsx)(n.a,{href:"#dig",children:"dig"}),", ",(0,r.jsx)(n.a,{href:"#get",children:"get"}),",\n",(0,r.jsx)(n.a,{href:"#haskey",children:"hasKey"}),", ",(0,r.jsx)(n.a,{href:"#keys",children:"keys"}),", ",(0,r.jsx)(n.a,{href:"#merge-mustmerge",children:"merge (mustMerge)"}),",\n",(0,r.jsx)(n.a,{href:"#mergeoverwrite-mustmergeoverwrite",children:"mergeOverwrite (mustMergeOverwrite)"}),",\n",(0,r.jsx)(n.a,{href:"#omit",children:"omit"}),", ",(0,r.jsx)(n.a,{href:"#pick",children:"pick"}),", ",(0,r.jsx)(n.a,{href:"#pluck",children:"pluck"}),", ",(0,r.jsx)(n.a,{href:"#set",children:"set"}),", ",(0,r.jsx)(n.a,{href:"#unset",children:"unset"}),", and\n",(0,r.jsx)(n.a,{href:"#values",children:"values"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"dict",children:"dict"}),"\n",(0,r.jsxs)(n.p,{children:["Creating dictionaries is done by calling the ",(0,r.jsx)(n.code,{children:"dict"})," function and passing it a\nlist of pairs."]}),"\n",(0,r.jsx)(n.p,{children:"The following creates a dictionary with three items:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$myDict := dict "name1" "value1" "name2" "value2" "name3" "value 3"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"get",children:"get"}),"\n",(0,r.jsx)(n.p,{children:"Given a map and a key, get the value from the map."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'get $myDict "name1"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:'"value1"'})]}),"\n",(0,r.jsxs)(n.p,{children:["Note that if the key is not found, this operation will simply return ",(0,r.jsx)(n.code,{children:'""'}),". No\nerror will be generated."]}),"\n",(0,r.jsx)(n.h3,{id:"set",children:"set"}),"\n",(0,r.jsxs)(n.p,{children:["Use ",(0,r.jsx)(n.code,{children:"set"})," to add a new key/value pair to a dictionary."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$_ := set $myDict "name4" "value4"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Note that ",(0,r.jsx)(n.code,{children:"set"})," ",(0,r.jsx)(n.em,{children:"returns the dictionary"})," (a requirement of Go template\nfunctions), so you may need to trap the value as done above with the ",(0,r.jsx)(n.code,{children:"$_"}),"\nassignment."]}),"\n",(0,r.jsx)(n.h3,{id:"unset",children:"unset"}),"\n",(0,r.jsx)(n.p,{children:"Given a map and a key, delete the key from the map."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$_ := unset $myDict "name4"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["As with ",(0,r.jsx)(n.code,{children:"set"}),", this returns the dictionary."]}),"\n",(0,r.jsx)(n.p,{children:"Note that if the key is not found, this operation will simply return. No error\nwill be generated."}),"\n",(0,r.jsx)(n.h3,{id:"haskey",children:"hasKey"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"hasKey"})," function returns ",(0,r.jsx)(n.code,{children:"true"})," if the given dict contains the given key."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'hasKey $myDict "name1"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["If the key is not found, this returns ",(0,r.jsx)(n.code,{children:"false"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"pluck",children:"pluck"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"pluck"})," function makes it possible to give one key and multiple maps, and\nget a list of all of the matches:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'pluck "
1name1" $myDict $myOtherDict\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above will return a ",(0,r.jsx)(n.code,{children:"list"})," containing every found value (",(0,r.jsx)(n.code,{children:"[value1 otherValue1]"}),")."]}),"\n",(0,r.jsxs)(n.p,{children:["If the given key is ",(0,r.jsx)(n.em,{children:"not found"})," in a map, that map will not have an item in the\nlist (and the length of the returned list will be less than the number of dicts\nin the call to ",(0,r.jsx)(n.code,{children:"pluck"}),")."]}),"\n",(0,r.jsxs)(n.p,{children:["If the key is ",(0,r.jsx)(n.em,{children:"found"})," but the value is an empty value, that value will be\ninserted."]}),"\n",(0,r.jsxs)(n.p,{children:["A common idiom in Helm templates is to use ",(0,r.jsx)(n.code,{children:"pluck... | first"})," to get the first\nmatching key out of a collection of dictionaries."]}),"\n",(0,r.jsx)(n.h3,{id:"dig",children:"dig"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"dig"})," function traverses a nested set of dicts, selecting keys from a list\nof values. It returns a default value if any of the keys are not found at the\nassociated dict."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'dig "user" "role" "humanName" "guest" $dict\n'})}),"\n",(0,r.jsx)(n.p,{children:"Given a dict structured like"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'{\n user: {\n role: {\n humanName: "curator"\n }\n }\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["the above would return ",(0,r.jsx)(n.code,{children:'"curator"'}),". If the dict lacked even a ",(0,r.jsx)(n.code,{children:"user"})," field,\nthe result would be ",(0,r.jsx)(n.code,{children:'"guest"'}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Dig can be very useful in cases where you'd like to avoid guard clauses,\nespecially since Go's template package's ",(0,r.jsx)(n.code,{children:"and"})," doesn't shortcut. For instance\n",(0,r.jsx)(n.code,{children:"and a.maybeNil a.maybeNil.iNeedThis"})," will always evaluate\n",(0,r.jsx)(n.code,{children:"a.maybeNil.iNeedThis"}),", and panic if ",(0,r.jsx)(n.code,{children:"a"})," lacks a ",(0,r.jsx)(n.code,{children:"maybeNil"})," field.)"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"dig"})," accepts its dict argument last in order to support pipelining. For instance:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'merge a b c | dig "one" "two" "three" "<missing>"\n'})}),"\n",(0,r.jsx)(n.h3,{id:"merge-mustmerge",children:"merge, mustMerge"}),"\n",(0,r.jsx)(n.p,{children:"Merge two or more dictionaries into one. Earlier arguments have higher\nprecedence. For the data:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"source3:\n field1: source3\n field2: source3\n field3: source3\n\nsource2:\n field1: source2\n field2: source2\n\nsource1:\n field1: source1\n"})}),"\n",(0,r.jsx)(n.p,{children:"the template:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$output := merge $source1 $source2 $source3\n"})}),"\n",(0,r.jsx)(n.p,{children:"will result in the output:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"output:\n field1: source1\n field2: source2\n field3: source3\n"})}),"\n",(0,r.jsxs)(n.p,{children:["This is a deep merge operation but not a deep copy operation. Nested objects\nthat are merged are the same instance on both dicts. If you want a deep copy\nalong with the merge, then use the ",(0,r.jsx)(n.code,{children:"deepCopy"})," function along with merging. For\nexample:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"deepCopy $source | merge $dest\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"mustMerge"})," will return an error in case of unsuccessful merge."]}),"\n",(0,r.jsx)(n.h3,{id:"mergeoverwrite-mustmergeoverwrite",children:"mergeOverwrite, mustMergeOverwrite"}),"\n",(0,r.jsxs)(n.p,{children:["Merge two or more dictionaries into one, giving precedence from ",(0,r.jsx)(n.strong,{children:"right to\nleft"}),", effectively overwriting values in the dest dictionary:"]}),"\n",(0,r.jsx)(n.p,{children:"Given:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"dest:\n default: default\n overwrite: me\n key: true\n\nsrc:\n overwrite: overwritten\n key: false\n"})}),"\n",(0,r.jsx)(n.p,{children:"will result in:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"newdict:\n default: default\n overwrite: overwritten\n key: false\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$newdict := mergeOverwrite $dest $source1 $source2\n"})}),"\n",(0,r.jsxs)(n.p,{children:["This is a deep merge operation but not a deep copy operation. Nested objects\nthat are merged are the same instance on both dicts. If you want a deep copy\nalong with the merge then use the ",(0,r.jsx)(n.code,{children:"deepCopy"})," function along with merging. For\nexample,"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"deepCopy $source | mergeOverwrite $dest\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"mustMergeOverwrite"})," will return an error in case of unsuccessful merge."]}),"\n",(0,r.jsx)(n.h3,{id:"keys",children:"keys"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"keys"})," function will return a ",(0,r.jsx)(n.code,{children:"list"})," of all of the keys in one or more\n",(0,r.jsx)(n.code,{children:"dict"})," types. Since a dictionary is ",(0,r.jsx)(n.em,{children:"unordered"}),", the keys will not be in a\npredictable order. They can be sorted with ",(0,r.jsx)(n.code,{children:"sortAlpha"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"keys $myDict | sortAlpha\n"})}),"\n",(0,r.jsxs)(n.p,{children:["When supplying multiple dictionaries, the keys will be concatenated. Use the\n",(0,r.jsx)(n.code,{children:"uniq"})," function along with ",(0,r.jsx)(n.code,{children:"sortAlpha"})," to get a unique, sorted list of keys."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"keys $myDict $myOtherDict | uniq | sortAlpha\n"})}),"\n",(0,r.jsx)(n.h3,{id:"pick",children:"pick"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"pick"})," function selects just the given keys out of a dictionary, creating a\nnew ",(0,r.jsx)(n.code,{children:"dict"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$new := pick $myDict "name1" "name2"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"{name1: value1, name2: value2}"})]}),"\n",(0,r.jsx)(n.h3,{id:"omit",children:"omit"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"omit"})," function is similar to ",(0,r.jsx)(n.code,{children:"pick"}),", except it returns a new ",(0,r.jsx)(n.code,{children:"dict"})," with\nall the keys that ",(0,r.jsx)(n.em,{children:"do not"})," match the given keys."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$new := omit $myDict "name1" "name3"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:"{name2: value2}"})]}),"\n",(0,r.jsx)(n.h3,{id:"values",children:"values"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"values"})," function is similar to ",(0,r.jsx)(n.code,{children:"keys"}),", except it returns a new ",(0,r.jsx)(n.code,{children:"list"})," with\nall the values of the source ",(0,r.jsx)(n.code,{children:"dict"})," (only one dictionary is supported)."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$vals := values $myDict\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:'list["value1", "value2", "value 3"]'}),". Note that the ",(0,r.jsx)(n.code,{children:"values"}),"\nfunction gives no guarantees about the result ordering; if you care about this,\nthen use ",(0,r.jsx)(n.code,{children:"sortAlpha"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"deepcopy-mustdeepcopy",children:"deepCopy, mustDeepCopy"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"deepCopy"})," and ",(0,r.jsx)(n.code,{children:"mustDeepCopy"})," functions take a value and make a deep copy\nof the value. This includes dicts and other structures. ",(0,r.jsx)(n.code,{children:"deepCopy"})," panics when\nthere is a problem, while ",(0,r.jsx)(n.code,{children:"mustDeepCopy"})," returns an error to the template system\nwhen there is an error."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'dict "a" 1 "b" 2 | deepCopy\n'})}),"\n",(0,r.jsx)(n.h3,{id:"a-note-on-dict-internals",children:"A Note on Dict Internals"}),"\n",(0,r.jsxs)(n.p,{children:["A ",(0,r.jsx)(n.code,{children:"dict"}
1)," is implemented in Go as a ",(0,r.jsx)(n.code,{children:"map[string]interface{}"}),". Go developers can\npass ",(0,r.jsx)(n.code,{children:"map[string]interface{}"})," values into the context to make them available to\ntemplates as ",(0,r.jsx)(n.code,{children:"dict"}),"s."]}),"\n",(0,r.jsx)(n.h2,{id:"encoding-functions",children:"Encoding Functions"}),"\n",(0,r.jsx)(n.p,{children:"Helm has the following encoding and decoding functions:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"b64enc"}),"/",(0,r.jsx)(n.code,{children:"b64dec"}),": Encode or decode with Base64"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"b32enc"}),"/",(0,r.jsx)(n.code,{children:"b32dec"}),": Encode or decode with Base32"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"lists-and-list-functions",children:"Lists and List Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm provides a simple ",(0,r.jsx)(n.code,{children:"list"})," type that can contain arbitrary sequential lists\nof data. This is similar to arrays or slices, but lists are designed to be used\nas immutable data types."]}),"\n",(0,r.jsx)(n.p,{children:"Create a list of integers:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$myList := list 1 2 3 4 5\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above creates a list of ",(0,r.jsx)(n.code,{children:"[1 2 3 4 5]"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Helm provides the following list functions: ",(0,r.jsx)(n.a,{href:"#append-mustappend",children:"append\n(mustAppend)"}),", ",(0,r.jsx)(n.a,{href:"#chunk",children:"chunk"}),", ",(0,r.jsx)(n.a,{href:"#compact-mustcompact",children:"compact\n(mustCompact)"}),", ",(0,r.jsx)(n.a,{href:"#concat",children:"concat"}),", ",(0,r.jsx)(n.a,{href:"#first-mustfirst",children:"first\n(mustFirst)"}),", ",(0,r.jsx)(n.a,{href:"#has-musthas",children:"has (mustHas)"}),", ",(0,r.jsx)(n.a,{href:"#initial-mustinitial",children:"initial\n(mustInitial)"}),", ",(0,r.jsx)(n.a,{href:"#last-mustlast",children:"last (mustLast)"}),",\n",(0,r.jsx)(n.a,{href:"#prepend-mustprepend",children:"prepend (mustPrepend)"}),", ",(0,r.jsx)(n.a,{href:"#rest-mustrest",children:"rest\n(mustRest)"}),", ",(0,r.jsx)(n.a,{href:"#reverse-mustreverse",children:"reverse (mustReverse)"}),",\n",(0,r.jsx)(n.a,{href:"#seq",children:"seq"}),", ",(0,r.jsx)(n.a,{href:"#index",children:"index"}),", ",(0,r.jsx)(n.a,{href:"#slice-mustslice",children:"slice (mustSlice)"}),", ",(0,r.jsx)(n.a,{href:"#uniq-mustuniq",children:"uniq\n(mustUniq)"}),", ",(0,r.jsx)(n.a,{href:"#until",children:"until"}),", ",(0,r.jsx)(n.a,{href:"#untilstep",children:"untilStep"}),", and\n",(0,r.jsx)(n.a,{href:"#without-mustwithout",children:"without (mustWithout)"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"first-mustfirst",children:"first, mustFirst"}),"\n",(0,r.jsxs)(n.p,{children:["To get the head item on a list, use ",(0,r.jsx)(n.code,{children:"first"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"first $myList"})," returns ",(0,r.jsx)(n.code,{children:"1"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"first"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustFirst"})," returns an error to the\ntemplate engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"rest-mustrest",children:"rest, mustRest"}),"\n",(0,r.jsxs)(n.p,{children:["To get the tail of the list (everything but the first item), use ",(0,r.jsx)(n.code,{children:"rest"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"rest $myList"})," returns ",(0,r.jsx)(n.code,{children:"[2 3 4 5]"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"rest"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustRest"})," returns an error to the\ntemplate engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"last-mustlast",children:"last, mustLast"}),"\n",(0,r.jsxs)(n.p,{children:["To get the last item on a list, use ",(0,r.jsx)(n.code,{children:"last"}),":"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"last $myList"})," returns ",(0,r.jsx)(n.code,{children:"5"}),". This is roughly analogous to reversing a list and\nthen calling ",(0,r.jsx)(n.code,{children:"first"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"initial-mustinitial",children:"initial, mustInitial"}),"\n",(0,r.jsxs)(n.p,{children:["This compliments ",(0,r.jsx)(n.code,{children:"last"})," by returning all ",(0,r.jsx)(n.em,{children:"but"})," the last element. ",(0,r.jsx)(n.code,{children:"initial $myList"})," returns ",(0,r.jsx)(n.code,{children:"[1 2 3 4]"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"initial"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustInitial"})," returns an error to\nthe template engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"append-mustappend",children:"append, mustAppend"}),"\n",(0,r.jsx)(n.p,{children:"Append a new item to an existing list, creating a new list."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$new = append $myList 6\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above would set ",(0,r.jsx)(n.code,{children:"$new"})," to ",(0,r.jsx)(n.code,{children:"[1 2 3 4 5 6]"}),". ",(0,r.jsx)(n.code,{children:"$myList"})," would remain unaltered."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"append"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustAppend"})," returns an error to the\ntemplate engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"prepend-mustprepend",children:"prepend, mustPrepend"}),"\n",(0,r.jsx)(n.p,{children:"Push an element onto the front of a list, creating a new list."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"prepend $myList 0\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above would produce ",(0,r.jsx)(n.code,{children:"[0 1 2 3 4 5]"}),". ",(0,r.jsx)(n.code,{children:"$myList"})," would remain unaltered."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"prepend"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustPrepend"})," returns an error to\nthe template engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"concat",children:"concat"}),"\n",(0,r.jsx)(n.p,{children:"Concatenate arbitrary number of lists into one."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"concat $myList ( list 6 7 ) ( list 8 )\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above would produce ",(0,r.jsx)(n.code,{children:"[1 2 3 4 5 6 7 8]"}),". ",(0,r.jsx)(n.code,{children:"$myList"})," would remain unaltered."]}),"\n",(0,r.jsx)(n.h3,{id:"reverse-mustreverse",children:"reverse, mustReverse"}),"\n",(0,r.jsx)(n.p,{children:"Produce a new list with the reversed elements of the given list."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"reverse $myList\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above would generate the list ",(0,r.jsx)(n.code,{children:"[5 4 3 2 1]"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"reverse"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustReverse"})," returns an error to\nthe template engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"uniq-mustuniq",children:"uniq, mustUniq"}),"\n",(0,r.jsx)(n.p,{children:"Generate a list with all of the duplicates removed."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"list 1 1 1 2 | uniq\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above would produce ",(0,r.jsx)(n.code,{children:"[1 2]"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"uniq"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustUniq"})," returns an error to the\ntemplate engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"without-mustwithout",children:"without, mustWithout"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"without"})," function filters items out of a list."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"without $myList 3\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above would produce ",(0,r.jsx)(n.code,{children:"[1 2 4 5]"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"without"})," can take more than one filter:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"without $myList 1 3 5\n"})}),"\n",(0,r.jsxs)(n.p,{children:["That would produce ",(0,r.jsx)(n.code,{children:"[2 4]"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"without"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustWithout"})," returns an error to\nthe template engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"has-musthas",children:"has, mustHas"}),"\n",(0,r.jsx)(n.p,{children:"Test to see if a list has a particular element."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"has 4 $myList\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above would return ",(0,r.jsx)(n.code,{children:"true"}),", while ",(0,r.jsx)(n.code,{children:'has "hello" $myList'})," would return false."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"has"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustHas"})," returns an error to the\ntemplate engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"compact-mustcompact",children:"compact, mustCompact"}),"\n",(0,r.jsx)(n.p,{children:"Accepts a list and removes entries with empty values."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$list := list 1 "a" "foo" ""\n$copy := compact $list\n'})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"compact"}),' will return a new list with the empty (i.e., "") item removed.']}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"compact"})," panics if there is a problem and ",(0,r.jsx)(n.code,{children:"mustCompact"})," returns an error to the\ntemplate engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"index",children:"index"}),"\n",(0,r.jsxs)(n.p,{children:["To get the nth element of a list, use ",(0,r.jsx)(n.code,{children:"index list [n]"}),". To index into\nmulti-dimensional lists, use ",(0,r.jsx)(n.code,{children:"index list [n] [m] ..."})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"index $myList 0"})," returns ",(0,r.jsx)(n.code,{children:"1"}),". It is the same as ",(0,r.jsx)(n.code,{children:"myList[0]"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"index $myList 0 1"})," would be the same as ",(0,r.jsx)(n.code,{children:"myList[0][1]"})]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"slice-mustslice",children:"slice, mustSlice"}),"\n",(0,r.jsxs)(n.p,{children:["To get partial elements of a list, use ",(0,r.jsx)(n.code,{children:"slice list [n] [m]"}),". It is equivalent of\n",(0,r.jsx)(n.code,{children:"list[n:m]"}),"."]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"slice $myList"})," returns ",(0,r.jsx)(n.code,{children:"[1 2 3 4 5]"}),". It is same as ",(0,r.jsx)(n.code,{children:"myList[:]"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"slice $myList 3"})," returns ",(0,r.jsx)(n.code,{children:"[4 5]"}),". It is same as ",(0,r.jsx)(n.code,{children:"myList[3:]"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"slice $myList 1 3"})," returns ",(0,r.jsx)(n.code,{children:"[2 3]"}),". It is same as ",(0,r.jsx)(n.code,{children:"myList[1:3]"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"slice $myList 0 3"})," returns ",(0,r.jsx)(n.code,{children:"[1 2 3]"}),". It is same as ",(0,r.jsx)(n.code,{children:"myList[:3]"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"slice"})," panics if there is a problem, while ",(0,r.jsx)(n.code,{children:"mustSlice"})," returns an error to the\ntemplate engine if there is a problem."]}),"\n",(0,r.jsx)(n.h3,{id:"until",children:"until"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"until"})," function builds a range of integers."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"until 5\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above generates the list ",(0,r.jsx)(n.code,{children:"[0, 1, 2, 3, 4]"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["This is useful for looping with ",(0,r.jsx)(n.code,{children:"range $i, $e := until 5"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"untilstep",children:"untilStep"}),"\n",(0,r.jsxs)(n.p,{children:["Like ",(0,r.jsx)(n.code,{children:"until"}),", ",(0,r.jsx)(n.code,{children:"untilStep"})," generates a list of counting integers. But it allows\nyou to define a start, stop, and step:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"untilStep 3 6 2\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above will produce ",(0,r.jsx)(n.code,{children:"[3 5]"})," by starting with 3, and adding 2 until it is\nequal or greater than 6. This is similar to Python's ",(0,r.jsx)(n.code,{children:"range"})," function."]}),"\n",(0,r.jsx)(n.h3,{id:"seq",children:"seq"}),"\n",(0,r.jsxs)(n.p,{children:["Works like the bash ",(0,r.jsx)(n.code,{children:"seq"})," command."]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["1 parameter (end) - will generate all counting integers between 1 and ",(0,r.jsx)(n.code,{children:"end"}),"\ninclusive."]}),"\n",(0,r.jsxs)(n.li,{children:["2 parameters (start, end) - will generate all counting integers between\n",(0,r.jsx)(n.code,{children:"start"})," and ",(0,r.jsx)(n.code,{children:"end"})," inclusive incrementing or decrementing by 1."]}),"\n",(0,r.jsxs)(n.li,{children:["3 parameters (start, step, end) - will generate all counting integers between\n",(0,r.jsx)(n.code,{children:"start"})," and ",(0,r.jsx)(n.code,{children:"end"})," inclusive incrementing or decrementing by ",(0,r.jsx)(n.code,{children:"step"}),"."]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"seq 5 => 1 2 3 4 5\nseq -3 => 1 0 -1 -2 -3\nseq 0 2 => 0 1 2\nseq 2 -2 => 2 1 0 -1 -2\nseq 0 2 10 => 0 2 4 6 8 10\nseq 0 -2 -5 => 0 -2 -4\n"})}),"\n",(0,r.jsx)(n.h3,{id:"chunk",children:"chunk"}),"\n",(0,r.jsxs)(n.p,{children:["To split a list into chunks of given size, use ",(0,r.jsx)(n.code,{children:"chunk size list"}),". This is useful for pagination."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"chunk 3 (list 1 2 3 4 5 6 7 8)\n"})}),"\n",(0,r.jsxs)(n.p,{children:["This produces list of lists ",(0,r.jsx)(n.code,{children:"[ [ 1 2 3 ] [ 4 5 6 ] [ 7 8 ] ]"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"math-functions",children:"Math Functions"}),"\n",(0,r.jsxs)(n.p,{children:["All math functions operate on ",(0,r.jsx)(n.code,{children:"int64"})," values unless specified otherwise."]}),"\n",(0,r.jsxs)(n.p,{children:["The following math functions are available: ",(0,r.jsx)(n.a,{href:"#add",children:"add"}),", ",(0,r.jsx)(n.a,{href:"#add1",children:"add1"}),",\n",(0,r.jsx)(n.a,{href:"#ceil",children:"ceil"}),", ",(0,r.jsx)(n.a,{href:"#div",children:"div"}),", ",(0,r.jsx)(n.a,{href:"#floor",children:"floor"}),", ",(0,r.jsx)(n.a,{href:"#len",children:"len"}),", ",(0,r.jsx)(n.a,{href:"#max",children:"max"}),",\n",(0,r.jsx)(n.a,{href:"#min",children:"min"}),", ",(0,r.jsx)(n.a,{href:"#mod",children:"mod"}),", ",(0,r.jsx)(n.a,{href:"#mul",children:"mul"}),", ",(0,r.jsx)(n.a,{href:"#round",children:"round"}),", and ",(0,r.jsx)(n.a,{href:"#sub",children:"sub"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"add",children:"add"}),"\n",(0,r.jsxs)(n.p,{children:["Sum numbers with ",(0,r.jsx)(n.code,{children:"add"}),". Accepts two or more inputs."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"add 1 2 3\n"})}),"\n",(0,r.jsx)(n.h3,{id:"add1",children:"add1"}),"\n",(0,r.jsxs)(n.p,{children:["To increment by 1, use ",(0,r.jsx)(n.code,{children:"add1"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"sub",children:"sub"}),"\n",(0,r.jsxs)(n.p,{children:["To subtract, use ",(0,r.jsx)(n.code,{children:"sub"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"div",children:"div"}
1),"\n",(0,r.jsxs)(n.p,{children:["Perform integer division with ",(0,r.jsx)(n.code,{children:"div"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"mod",children:"mod"}),"\n",(0,r.jsxs)(n.p,{children:["Modulo with ",(0,r.jsx)(n.code,{children:"mod"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"mul",children:"mul"}),"\n",(0,r.jsxs)(n.p,{children:["Multiply with ",(0,r.jsx)(n.code,{children:"mul"}),". Accepts two or more inputs."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"mul 1 2 3\n"})}),"\n",(0,r.jsx)(n.h3,{id:"max",children:"max"}),"\n",(0,r.jsx)(n.p,{children:"Return the largest of a series of integers."}),"\n",(0,r.jsxs)(n.p,{children:["This will return ",(0,r.jsx)(n.code,{children:"3"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"max 1 2 3\n"})}),"\n",(0,r.jsx)(n.h3,{id:"min",children:"min"}),"\n",(0,r.jsx)(n.p,{children:"Return the smallest of a series of integers."}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"min 1 2 3"})," will return ",(0,r.jsx)(n.code,{children:"1"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"len",children:"len"}),"\n",(0,r.jsx)(n.p,{children:"Returns the length of the argument as an integer."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"len .Arg\n"})}),"\n",(0,r.jsx)(n.h2,{id:"float-math-functions",children:"Float Math Functions"}),"\n",(0,r.jsxs)(n.p,{children:["All math functions operate on ",(0,r.jsx)(n.code,{children:"float64"})," values."]}),"\n",(0,r.jsx)(n.h3,{id:"addf",children:"addf"}),"\n",(0,r.jsxs)(n.p,{children:["Sum numbers with ",(0,r.jsx)(n.code,{children:"addf"})]}),"\n",(0,r.jsxs)(n.p,{children:["This will return ",(0,r.jsx)(n.code,{children:"5.5"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"addf 1.5 2 2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"add1f",children:"add1f"}),"\n",(0,r.jsxs)(n.p,{children:["To increment by 1, use ",(0,r.jsx)(n.code,{children:"add1f"})]}),"\n",(0,r.jsx)(n.h3,{id:"subf",children:"subf"}),"\n",(0,r.jsxs)(n.p,{children:["To subtract, use ",(0,r.jsx)(n.code,{children:"subf"})]}),"\n",(0,r.jsxs)(n.p,{children:["This is equivalent to ",(0,r.jsx)(n.code,{children:"7.5 - 2 - 3"})," and will return ",(0,r.jsx)(n.code,{children:"2.5"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"subf 7.5 2 3\n"})}),"\n",(0,r.jsx)(n.h3,{id:"divf",children:"divf"}),"\n",(0,r.jsxs)(n.p,{children:["Perform integer division with ",(0,r.jsx)(n.code,{children:"divf"})]}),"\n",(0,r.jsxs)(n.p,{children:["This is equivalent to ",(0,r.jsx)(n.code,{children:"10 / 2 / 4"})," and will return ",(0,r.jsx)(n.code,{children:"1.25"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"divf 10 2 4\n"})}),"\n",(0,r.jsx)(n.h3,{id:"mulf",children:"mulf"}),"\n",(0,r.jsxs)(n.p,{children:["Multiply with ",(0,r.jsx)(n.code,{children:"mulf"})]}),"\n",(0,r.jsxs)(n.p,{children:["This will return ",(0,r.jsx)(n.code,{children:"6"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"mulf 1.5 2 2\n"})}),"\n",(0,r.jsx)(n.h3,{id:"maxf",children:"maxf"}),"\n",(0,r.jsx)(n.p,{children:"Return the largest of a series of floats:"}),"\n",(0,r.jsxs)(n.p,{children:["This will return ",(0,r.jsx)(n.code,{children:"3"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"maxf 1 2.5 3\n"})}),"\n",(0,r.jsx)(n.h3,{id:"minf",children:"minf"}),"\n",(0,r.jsx)(n.p,{children:"Return the smallest of a series of floats."}),"\n",(0,r.jsxs)(n.p,{children:["This will return ",(0,r.jsx)(n.code,{children:"1.5"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"minf 1.5 2 3\n"})}),"\n",(0,r.jsx)(n.h3,{id:"floor",children:"floor"}),"\n",(0,r.jsx)(n.p,{children:"Returns the greatest float value less than or equal to input value."}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"floor 123.9999"})," will return ",(0,r.jsx)(n.code,{children:"123.0"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"ceil",children:"ceil"}),"\n",(0,r.jsx)(n.p,{children:"Returns the greatest float value greater than or equal to input value."}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"ceil 123.001"})," will return ",(0,r.jsx)(n.code,{children:"124.0"}),"."]}
1),"\n",(0,r.jsx)(n.h3,{id:"round",children:"round"}),"\n",(0,r.jsx)(n.p,{children:"Returns a float value with the remainder rounded to the given number to digits\nafter the decimal point."}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"round 123.555555 3"})," will return ",(0,r.jsx)(n.code,{children:"123.556"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"network-functions",children:"Network Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm has a single network function, ",(0,r.jsx)(n.code,{children:"getHostByName"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"getHostByName"})," receives a domain name and returns the ip address."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:'getHostByName "www.google.com"'})," would return the corresponding ip address of ",(0,r.jsx)(n.code,{children:"www.google.com"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["This function requires the ",(0,r.jsx)(n.code,{children:"--enable-dns"})," option to be passed on the helm command line."]}),"\n",(0,r.jsx)(n.h2,{id:"file-path-functions",children:"File Path Functions"}),"\n",(0,r.jsxs)(n.p,{children:["While Helm template functions do not grant access to the filesystem, they do\nprovide functions for working with strings that follow file path conventions.\nThose include ",(0,r.jsx)(n.a,{href:"#base",children:"base"}),", ",(0,r.jsx)(n.a,{href:"#clean",children:"clean"}),", ",(0,r.jsx)(n.a,{href:"#dir",children:"dir"}),", ",(0,r.jsx)(n.a,{href:"#ext",children:"ext"}),", and\n",(0,r.jsx)(n.a,{href:"#isabs",children:"isAbs"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"base",children:"base"}),"\n",(0,r.jsx)(n.p,{children:"Return the last element of a path."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'base "foo/bar/baz"\n'})}),"\n",(0,r.jsx)(n.p,{children:'The above prints "baz".'}),"\n",(0,r.jsx)(n.h3,{id:"dir",children:"dir"}),"\n",(0,r.jsxs)(n.p,{children:["Return the directory, stripping the last part of the path. So ",(0,r.jsx)(n.code,{children:'dir "foo/bar/baz"'})," returns ",(0,r.jsx)(n.code,{children:"foo/bar"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"clean",children:"clean"}),"\n",(0,r.jsx)(n.p,{children:"Clean up a path."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'clean "foo/bar/../baz"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above resolves the ",(0,r.jsx)(n.code,{children:".."})," and returns ",(0,r.jsx)(n.code,{children:"foo/baz"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"ext",children:"ext"}),"\n",(0,r.jsx)(n.p,{children:"Return the file extension."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'ext "foo.bar"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above returns ",(0,r.jsx)(n.code,{children:".bar"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"isabs",children:"isAbs"}),"\n",(0,r.jsxs)(n.p,{children:["To check whether a file path is absolute, use ",(0,r.jsx)(n.code,{children:"isAbs"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"reflection-functions",children:"Reflection Functions"}),"\n",(0,r.jsx)(n.p,{children:"Helm provides rudimentary reflection tools. These help advanced template\ndevelopers understand the underlying Go type information for a particular value.\nHelm is written in Go and is strongly typed. The type system applies within\ntemplates."}),"\n",(0,r.jsxs)(n.p,{children:["Go has several primitive ",(0,r.jsx)(n.em,{children:"kinds"}),", like ",(0,r.jsx)(n.code,{children:"string"}),", ",(0,r.jsx)(n.code,{children:"slice"}),", ",(0,r.jsx)(n.code,{children:"int64"}),", and ",(0,r.jsx)(n.code,{children:"bool"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["Go has an open ",(0,r.jsx)(n.em,{children:"type"})," system that allows developers to create their own types."]}),"\n",(0,r.jsxs)(n.p,{children:["Helm provides a set of functions for each via ",(0,r.jsx)(n.a,{href:"#kind-functions",children:"kind functions"}),"\nand ",(0,r.jsx)(n.a,{href:"#type-functions",children:"type functions"}),". A ",(0,r.jsx)(n.a,{href:"#deepequal",children:"deepEqual"})," function is\nalso provided to compare to values."]}),"\n",(0,r.jsx)(n.h3,{id:"kind-functions",children:"Kind Functions"}),"\n",(0,r.jsxs)(n.p,{children:["There are two Kind functions: ",(0,r.jsx)(n.code,{children:"kindOf"})," returns the kind of an object."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'kindOf "hello"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above would return ",(0,r.jsx)(n.code,{children:"string"}),". For simple tests (like in ",(0,r.jsx)(n.code,{children:"if"})," blocks), the\n",(0,r.jsx)(n.code,{children:"kindIs"})," function will let you verify that a value is a particular kind:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'kindIs "int" 123\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above will return ",(0,r.jsx)(n.code,{children:"true"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"type-functions",children:"Type Functions"}),"\n",(0,r.jsx)(n.p,{children:"Types are slightly harder to work with, so there are three different functions:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"typeOf"})," returns the underlying type of a value: ",(0,r.jsx)(n.code,{children:"typeOf $foo"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"typeIs"})," is like ",(0,r.jsx)(n.code,{children:"kindIs"}),", but for types: ",(0,r.jsx)(n.code,{children:'typeIs "*io.Buffer" $myVal'})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"typeIsLike"})," works as ",(0,r.jsx)(n.code,{children:"typeIs"}),", except that it also dereferences pointers"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Note:"})," None of these can test whether or not something implements a given\ninterface, since doing so w
1ould require compiling the interface in ahead of\ntime."]}),"\n",(0,r.jsx)(n.h3,{id:"deepequal",children:"deepEqual"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"deepEqual"})," returns true if two values are ",(0,r.jsx)(n.a,{href:"https://golang.org/pkg/reflect/#DeepEqual",children:'"deeply\nequal"'})]}),"\n",(0,r.jsxs)(n.p,{children:["Works for non-primitive types as well (compared to the built-in ",(0,r.jsx)(n.code,{children:"eq"}),")."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"deepEqual (list 1 2 3) (list 1 2 3)\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The above will return ",(0,r.jsx)(n.code,{children:"true"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"semantic-version-functions",children:"Semantic Version Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Some version schemes are easily parseable and comparable. Helm provides\nfunctions for working with ",(0,r.jsx)(n.a,{href:"http://semver.org",children:"SemVer 2"})," versions. These include\n",(0,r.jsx)(n.a,{href:"#semver",children:"semver"})," and ",(0,r.jsx)(n.a,{href:"#semvercompare",children:"semverCompare"}),". Below you will also find\ndetails on using ranges for comparisons."]}),"\n",(0,r.jsx)(n.h3,{id:"semver",children:"semver"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"semver"})," function parses a string into a Semantic Version:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$version := semver "1.2.3-alpha.1+123"\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.em,{children:"If the parser fails, it will cause template execution to halt with an error."})}),"\n",(0,r.jsxs)(n.p,{children:["At this point, ",(0,r.jsx)(n.code,{children:"$version"})," is a pointer to a ",(0,r.jsx)(n.code,{children:"Version"})," object with the following\nproperties:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"$version.Major"}),": The major number (",(0,r.jsx)(n.code,{children:"1"})," above)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"$version.Minor"}),": The minor number (",(0,r.jsx)(n.code,{children:"2"})," above)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"$version.Patch"}),": The patch number (",(0,r.jsx)(n.code,{children:"3"})," above)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"$version.Prerelease"}),": The prerelease (",(0,r.jsx)(n.code,{children:"alpha.1"})," above)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"$version.Metadata"}),": The build metadata (",(0,r.jsx)(n.code,{children:"123"})," above)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"$version.Original"}),": The original version as a string"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Additionally, you can compare a ",(0,r.jsx)(n.code,{children:"Version"})," to another ",(0,r.jsx)(n.code,{children:"version"})," using the\n",(0,r.jsx)(n.code,{children:"Compare"})," function:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'semver "1.4.3" | (semver "1.2.3").Compare\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The above will return ",(0,r.jsx)(n.code,{children:"-1"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"The return values are:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"-1"})," if the given semver is greater than the semver whose ",(0,r.jsx)(n.code,{children:"Compare"})," method was\ncalled"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"1"})," if the version who's ",(0,r.jsx)(n.code,{children:"Compare"})," function was called is greater."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"0"})," if they are the same version"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["(Note that in SemVer, the ",(0,r.jsx)(n.code,{children:"Metadata"})," field is not compared during version\ncomparison operations.)"]}),"\n",(0,r.jsx)(n.h3,{id:"semvercompare",children:"semverCompare"}),"\n",(0,r.jsxs)(n.p,{children:["A more robust comparison function is provided as ",(0,r.jsx)(n.code,{children:"semverCompare"}),". This version\nsupports version ranges:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'semverCompare "1.2.3" "1.2.3"'})," checks for an exact match"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:'semverCompare "~1.2.0" "1.2.3"'})," checks that the major and minor versions\nmatch, and that the patch number of the second version is ",(0,r.jsx)(n.em,{children:"greater than or\nequal to"})," the first parameter."]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["The SemVer functions use the ",(0,r.jsx)(n.a,{href:"https://github.com/Masterminds/semver",children:"Masterminds semver\nlibrary"}),", from the creators of Sprig."]}),"\n",(0,r.jsx)(n.h3,{id:"basic-comparisons",children:"Basic Comparisons"}),"\n",(0,r.jsxs)(n.p,{children:["There are two elements to the comparisons. First, a comparison string is a list\nof space or comma separated AND comparisons. These are then separated by || (OR)\ncomparisons. For example, ",(0,r.jsx)(n.code,{children:'">= 1.2 < 3.0.0 || >= 4.2.3"'})," is looking for a\ncomparison that's greater than or equal to 1.2 and less than 3.0.0 or is greater\nthan or equal to 4.2.3."]}),"\n",(0,r.jsx)(n.p,{children:"The basic comparisons are:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"="}),": equal (aliased to no operator)"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"!="}),": not equal"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:">"}),": greater than"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"<"}),": less than"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:">="}),": greater than or equal to"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"<="}),": less than or equal to"]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"working-with-prerelease-versions",children:"Working With Prerelease Versions"}),"\n",(0,r.jsxs)(n.p,{children:["Pre-releases, for those not familiar with them, are used for software releases\nprior to stable or generally available releases. Examples of prereleases include\ndevelopment, alpha, beta, and release candidate releases. A prerelease may be a\nversion such as ",(0,r.jsx)(n.code,{children:"1.2.3-beta.1"}),", while the stable release would be ",(0,r.jsx)(n.code,{children:"1.2.3"}),". In the\norder of precedence, prereleases come before their associated releases. In this\nexample ",(0,r.jsx)(n.code,{children:"1.2.3-beta.1 < 1.2.3"}),"."]}),"\n",(0,r.jsx)(n.p,{children:"According to the Semantic Version specification prereleases may not be API\ncompliant with their release counterpart. It says,"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:"A pre-release version indicates that the version is unstable and might not\nsatisfy the intended compatibility requirements as denoted by its associated\nnormal version."}),"\n"]}
1),"\n",(0,r.jsxs)(n.p,{children:["SemVer comparisons using constraints without a prerelease comparator will skip\nprerelease versions. For example, ",(0,r.jsx)(n.code,{children:">=1.2.3"})," will skip prereleases when looking\nat a list of releases, while ",(0,r.jsx)(n.code,{children:">=1.2.3-0"})," will evaluate and find prereleases."]}),"\n",(0,r.jsxs)(n.p,{children:["The reason for the ",(0,r.jsx)(n.code,{children:"0"})," as a pre-release version in the example comparison is\nbecause pre-releases can only contain ASCII alphanumerics and hyphens (along\nwith ",(0,r.jsx)(n.code,{children:"."})," separators), per the spec. Sorting happens in ASCII sort order, again\nper the spec. The lowest character is a ",(0,r.jsx)(n.code,{children:"0"})," in ASCII sort order (see an ",(0,r.jsx)(n.a,{href:"http://www.asciitable.com/",children:"ASCII\nTable"}),")"]}),"\n",(0,r.jsxs)(n.p,{children:["Understanding ASCII sort ordering is important because A-Z comes before a-z.\nThat means ",(0,r.jsx)(n.code,{children:">=1.2.3-BETA"})," will return ",(0,r.jsx)(n.code,{children:"1.2.3-alpha"}),". What you might expect from\ncase sensitivity doesn't apply here. This is due to ASCII sort ordering which is\nwhat the spec specifies."]}),"\n",(0,r.jsx)(n.h3,{id:"hyphen-range-comparisons",children:"Hyphen Range Comparisons"}),"\n",(0,r.jsx)(n.p,{children:"There are multiple methods to handle ranges and the first is hyphens ranges.\nThese look like:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"1.2 - 1.4.5"})," which is equivalent to ",(0,r.jsx)(n.code,{children:">= 1.2 <= 1.4.5"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"2.3.4 - 4.5"})," which is equivalent to ",(0,r.jsx)(n.code,{children:">= 2.3.4 <= 4.5"})]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"wildcards-in-comparisons",children:"Wildcards In Comparisons"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"x"}),", ",(0,r.jsx)(n.code,{children:"X"}),", and ",(0,r.jsx)(n.code,{children:"*"})," characters can be used as a wildcard character. This works\nfor all comparison operators. When used on the ",(0,r.jsx)(n.code,{children:"="})," operator it falls back to the\npatch level comparison (see tilde below). For example,"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"1.2.x"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 1.2.0, < 1.3.0"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:">= 1.2.x"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 1.2.0"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"<= 2.x"})," is equivalent to ",(0,r.jsx)(n.code,{children:"< 3"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"*"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 0.0.0"})]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"tilde-range-comparisons-patch",children:"Tilde Range Comparisons (Patch)"}),"\n",(0,r.jsxs)(n.p,{children:["The tilde (",(0,r.jsx)(n.code,{children:"~"}),") comparison operator is for patch level ranges when a minor\nversion is specified and major level changes when the minor number is missing.\nFor example,"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"~1.2.3"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 1.2.3, < 1.3.0"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"~1"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 1, < 2"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"~2.3"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 2.3, < 2.4"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"~1.2.x"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 1.2.0, < 1.3.0"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"~1.x"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 1, < 2"})]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"caret-range-comparisons-major",children:"Caret Range Comparisons (Major)"}),"\n",(0,r.jsxs)(n.p,{children:["The caret (",(0,r.jsx)(n.code,{children:"^"}),") comparison operator is for major level changes once a stable\n(1.0.0) release has occurred. Prior to a 1.0.0 release the minor versions acts\nas the API stability level. This is useful when comparisons of API versions as a\nmajor change is API breaking. For example,"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"^1.2.3"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 1.2.3, < 2.0.0"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"^1.2.x"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 1.2.0, < 2.0.0"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"^2.3"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 2.3, < 3"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"^2.x"})," is equivalent to ",(0,r.jsx)(n.code,{children:">= 2.0.0, < 3"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"^0.2.3"})," is equivalent to ",(0,r.jsx)(n.code,{children:">=0.2.3 <0.3.0"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"^0.2"})," is equivalent to ",(0,r.jsx)(n.code,{children:">=0.2.0 <0.3.0"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"^0.0.3"})," is equivalent to ",(0,r.jsx)(n.code,{children:">
1=0.0.3 <0.0.4"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"^0.0"})," is equivalent to ",(0,r.jsx)(n.code,{children:">=0.0.0 <0.1.0"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"^0"})," is equivalent to ",(0,r.jsx)(n.code,{children:">=0.0.0 <1.0.0"})]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"url-functions",children:"URL Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm includes the ",(0,r.jsx)(n.a,{href:"#urlparse",children:"urlParse"}),", ",(0,r.jsx)(n.a,{href:"#urljoin",children:"urlJoin"}),", and\n",(0,r.jsx)(n.a,{href:"#urlquery",children:"urlquery"})," functions enabling you to work with URL parts."]}),"\n",(0,r.jsx)(n.h3,{id:"urlparse",children:"urlParse"}),"\n",(0,r.jsx)(n.p,{children:"Parses string for URL and produces dict with URL parts"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'urlParse "http://admin:[email protected]:8080/api?list=false#anchor"\n'})}),"\n",(0,r.jsx)(n.p,{children:"The above returns a dict, containing URL object:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",children:"scheme: 'http'\nhost: 'server.com:8080'\npath: '/api'\nquery: 'list=false'\nopaque: nil\nfragment: 'anchor'\nuserinfo: 'admin:secret'\n"})}),"\n",(0,r.jsxs)(n.p,{children:["This is implemented used the URL packages from the Go standard library. For more\ninfo, check ",(0,r.jsx)(n.a,{href:"https://golang.org/pkg/net/url/#URL",children:"https://golang.org/pkg/net/url/#URL"})]}),"\n",(0,r.jsx)(n.h3,{id:"urljoin",children:"urlJoin"}),"\n",(0,r.jsxs)(n.p,{children:["Joins map (produced by ",(0,r.jsx)(n.code,{children:"urlParse"}),") to produce URL string"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'urlJoin (dict "fragment" "fragment" "host" "host:80" "path" "/path" "query" "query" "scheme" "http")\n'})}),"\n",(0,r.jsx)(n.p,{children:"The above returns the following string:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"http://host:80/path?query#fragment\n"})}),"\n",(0,r.jsx)(n.h3,{id:"urlquery",children:"urlquery"}),"\n",(0,r.jsx)(n.p,{children:"Returns the escaped version of the value passed in as an argument so that it is\nsuitable for embedding in the query portion of a URL."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$var := urlquery "string for query"\n'})}),"\n",(0,r.jsx)(n.h2,{id:"uuid-functions",children:"UUID Functions"}),"\n",(0,r.jsx)(n.p,{children:"Helm can generate UUID v4 universally unique IDs."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"uuidv4\n"})}),"\n",(0,r.jsx)(n.p,{children:"The above returns a new UUID of the v4 (randomly generated) type."}),"\n",(0,r.jsx)(n.h2,{id:"kubernetes-and-chart-functions",children:"Kubernetes and Chart Functions"}),"\n",(0,r.jsxs)(n.p,{children:["Helm includes functions for working with Kubernetes including\n",(0,r.jsx)(n.a,{href:"#capabilitiesapiversionshas",children:".Capabilities.APIVersions.Has"}),",\n",(0,r.jsx)(n.a,{href:"#file-functions",children:"Files"}),", and ",(0,r.jsx)(n.a,{href:"#lookup",children:"lookup"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"lookup",children:"lookup"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"lookup"})," is used to look up resource in a running cluster. When used with the\n",(0,r.jsx)(n.code,{children:"helm template"})," command it always returns an empty response."]}),"\n",(0,r.jsxs)(n.p,{children:["You can find more detail in the ",(0,r.jsx)(n.a,{href:"/docs/v3/chart_template_guide/functions_and_pipelines#using-the-lookup-function",children:"documentation on the lookup\nfunction"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"capabilitiesapiversionshas",children:".Capabilities.APIVersions.Has"}),"\n",(0,r.jsx)(n.p,{children:"Returns if an API version or resource is available in a cluster."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'.Capabilities.APIVersions.Has "apps/v1"\n.Capabilities.APIVersions.Has "apps/v1/Deployment"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["More information is available on the ",(0,r.jsx)(n.a,{href:"/docs/v3/chart_template_guide/builtin_objects",children:"built-in object\ndocumentation"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"file-functions",children:"File Functions"}),"\n",(0,r.jsxs)(n.p,{children:["There are several functions that enable you to get to non-special files within a\nchart. For example, to access application configuration files. These are\
1ndocumented in ",(0,r.jsx)(n.a,{href:"/docs/v3/chart_template_guide/accessing_files",children:"Accessing Files Inside Templates"}),"."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.em,{children:["Note, the documentation for many of these functions come from\n",(0,r.jsx)(n.a,{href:"https://github.com/Masterminds/sprig",children:"Sprig"}),". Sprig is a template function\nlibrary available to Go applications."]})})]})}function h(e={}){let{wrapper:n}={...(0,l.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(o,{...e})}):o(e)}},28453(e,n,i){i.d(n,{R:()=>t,x:()=>d});var s=i(96540);let r={},l=s.createContext(r);function t(e){let n=s.useContext(l);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:t(e.components),s.createElement(l.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.