Packages will work by returning a value that can be used when you import a
package.
For example,
Will create a local variable x containing the value returned by package "x".
You can change the name of the imported package using the syntax below:
The value returned from the package could be anything. See examples below:
Ex.:
# package strings
# returns a map of functions
fn join(lst, sep) {}
fn trimleft(str) {}
fn trimright(str) {}
fn trim() {}
return {
"join": $join,
"trimleft": $trimleft,
"trimright": $trimright,
"trim": $trim,
}
You can use the package above with code below:
import "strings"
str <= strings["trim"](" test ")
echo $str # Output: test
Packages will work by returning a value that can be used when you import a
package.
For example,
Will create a local variable
xcontaining the value returned by package "x".You can change the name of the imported package using the syntax below:
The value returned from the package could be anything. See examples below:
Ex.:
You can use the package above with code below: