File: underscore.go

package info (click to toggle)
golang-github-robertkrimen-otto 0.0~git20200922.ef014fd-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,840 kB
  • sloc: perl: 1,227; makefile: 79
file content (49 lines) | stat: -rw-r--r-- 932 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
Package underscore contains the source for the JavaScript utility-belt library.

	import (
		_ "github.com/robertkrimen/otto/underscore"
	)
	// Every Otto runtime will now include underscore

http://underscorejs.org

https://github.com/documentcloud/underscore

By importing this package, you'll automatically load underscore every time you create a new Otto runtime.

To prevent this behavior, you can do the following:

	import (
		"github.com/robertkrimen/otto/underscore"
	)

	func init() {
		underscore.Disable()
	}

*/
package underscore

import (
	"github.com/robertkrimen/otto/registry"
)

var entry *registry.Entry = registry.Register(func() string {
	return Source()
})

// Enable underscore runtime inclusion.
func Enable() {
	entry.Enable()
}

// Disable underscore runtime inclusion.
func Disable() {
	entry.Disable()
}

// Source returns the underscore source.
func Source() string {
	return string(underscore())
}