mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00
Fix documentation
This commit is contained in:
parent
9d7eadf70f
commit
ba4c8b0769
|
@ -108,6 +108,8 @@ Parse and return an AST
|
|||
// Parse some JavaScript, yielding a *ast.Program and/or an ErrorList
|
||||
program, err := parser.ParseFile(nil, filename, src, 0)
|
||||
|
||||
### otto
|
||||
|
||||
You can run (Go) JavaScript from the commandline with:
|
||||
http://github.com/robertkrimen/otto/tree/master/otto
|
||||
|
||||
|
@ -117,6 +119,8 @@ Run JavaScript by entering some source on stdin or by giving otto a filename:
|
|||
|
||||
$ otto example.js
|
||||
|
||||
### underscore
|
||||
|
||||
Optionally include the JavaScript utility-belt library, underscore, with this
|
||||
import:
|
||||
|
||||
|
@ -360,9 +364,6 @@ allocated runtime, and return the runtime, resulting value, and error (if any).
|
|||
src may be a string, a byte slice, a bytes.Buffer, or an io.Reader, but it MUST
|
||||
always be in UTF-8.
|
||||
|
||||
If src is a Node, then runtime behavior is undefined if the AST has been
|
||||
modified.
|
||||
|
||||
src may also be a node, but if the AST has been modified, then runtime behavior
|
||||
is undefined.
|
||||
|
||||
|
|
6
otto.go
6
otto.go
|
@ -103,6 +103,8 @@ Parse and return an AST
|
|||
// Parse some JavaScript, yielding a *ast.Program and/or an ErrorList
|
||||
program, err := parser.ParseFile(nil, filename, src, 0)
|
||||
|
||||
otto
|
||||
|
||||
You can run (Go) JavaScript from the commandline with: http://github.com/robertkrimen/otto/tree/master/otto
|
||||
|
||||
$ go get -v github.com/robertkrimen/otto/otto
|
||||
|
@ -111,6 +113,8 @@ Run JavaScript by entering some source on stdin or by giving otto a filename:
|
|||
|
||||
$ otto example.js
|
||||
|
||||
underscore
|
||||
|
||||
Optionally include the JavaScript utility-belt library, underscore, with this import:
|
||||
|
||||
import (
|
||||
|
@ -259,8 +263,6 @@ func (otto *Otto) clone() *Otto {
|
|||
//
|
||||
// src may be a string, a byte slice, a bytes.Buffer, or an io.Reader, but it MUST always be in UTF-8.
|
||||
//
|
||||
// If src is a Node, then runtime behavior is undefined if the AST has been modified.
|
||||
//
|
||||
// src may also be a node, but if the AST has been modified, then runtime behavior is undefined.
|
||||
//
|
||||
func Run(src interface{}) (*Otto, Value, error) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user