Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
b65f29f8
Commit
b65f29f8
authored
Sep 22, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added JavaScript JSON helper
parent
65a802c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
list.go
ethutil/list.go
+16
-1
No files found.
ethutil/list.go
View file @
b65f29f8
package
ethutil
import
"reflect"
import
(
"encoding/json"
"reflect"
)
// The list type is an anonymous slice handler which can be used
// for containing any slice type to use in an environment which
...
...
@@ -44,3 +47,15 @@ func (self *List) Append(v interface{}) {
func
(
self
*
List
)
Interface
()
interface
{}
{
return
self
.
list
.
Interface
()
}
// For JavaScript <3
func
(
self
*
List
)
ToJSON
()
string
{
var
list
[]
interface
{}
for
i
:=
0
;
i
<
self
.
Length
;
i
++
{
list
=
append
(
list
,
self
.
Get
(
i
))
}
data
,
_
:=
json
.
Marshal
(
list
)
return
string
(
data
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment