go-adaptive-functions is a library of adaptive Go functions used by gotmpl, go-dfl and railgun.
Go
You can import go-adaptive-functions as a library with:
import (
"github.com/spatialcurrent/go-adaptive-functions/pkg/af"
)
See af in GoDoc for API documentation and examples.
Node
AF is built as a module. In modern JavaScript, the module can be imported using destructuring assignment.
const { sum, min, max } = require('./dist/af.mod.min.js');
In legacy JavaScript, you can use the af.global.js
file that simply adds af
to the global scope.
go-adaptive-functions is currently in alpha. See releases at https://github.com/spatialcurrent/go-adaptive-functions/releases. See the Building section below to build from scratch.
JavaScript
af.global.js
,af.global.js.map
- JavaScript global build with source mapaf.global.min.js
,af.global.min.js.map
- Minified JavaScript global build with source mapaf.mod.js
,af.mod.js.map
- JavaScript module build with source mapaf.mod.min.js
,af.mod.min.js.map
- Minified JavaScript module with source map
Go
See the examples in GoDoc.
JavaScript
See the examples/js/index.js
file. You can run the example with make run_example_javascript
.
Use make help
to see help information for each target.
JavaScript
You can compile go-adaptive-functions to pure JavaScript with the make build_javascript
script.
Go
To run Go tests use make test_go
(or bash scripts/test.sh
), which runs unit tests, go vet
, go vet with shadow
, errcheck, ineffassign, staticcheck, and misspell.
JavaScript
To run JavaScript tests, first install Jest using make deps_javascript
, use Yarn, or another method. Then, build the JavaScript module with make build_javascript
. To run tests, use make test_javascript
. You can also use the scripts in the package.json
.
Spatial Current, Inc. is currently accepting pull requests for this repository. We'd love to have your contributions! Please see Contributing.md for how to get started.
This work is distributed under the MIT License. See LICENSE file.