Debian Codegraph @

underscore/underscore.go

raw symbols SCIP
1 // Package underscore contains the source for the JavaScript utility-belt library.
2 //
3 // import (
4 // _ "github.com/robertkrimen/otto/underscore"
5 // )
6 //
7 // Every Otto runtime will now include [underscore] for more information see the [underscore docs]
8 //
9 // By importing this package, you'll automatically load underscore every time you create a new Otto runtime.
10 //
11 // To prevent this behavior, you can do the following:
12 //
13 // import (
14 // "github.com/robertkrimen/otto/underscore"
15 // )
16 //
17 // func init() {
18 // underscore.Disable()
19 // }
20 //
21 // [underscore]: http://underscorejs.org
22 // [underscore docs]: https://github.com/documentcloud/underscore
23 package underscore
24
25 import (
26 _ "embed" // Embed underscore.
27
28 "github.com/robertkrimen/otto/registry"
29 )
30
31 //go:embed underscore-min.js
32 var underscore string
33 var entry *registry.Entry = registry.Register(Source)
34
35 // Enable underscore runtime inclusion.
36 func Enable() {
37 entry.Enable()
38 }
39
40 // Disable underscore runtime inclusion.
41 func Disable() {
42 entry.Disable()
43 }
44
45 // Source returns the underscore source.
46 func Source() string {
47 return underscore
48 }