mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-12 11:15:14 +02:00
Merge pull request #70 from 3timeslazy/feature/values_object_get
change Object.Get(key values.String) (core.Value, bool) to Object.Get…
This commit is contained in:
commit
3a834d9a0e
@ -3,9 +3,10 @@ package values
|
||||
import (
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
"hash/fnv"
|
||||
"sort"
|
||||
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -161,14 +162,14 @@ func (t *Object) ForEach(predicate ObjectPredicate) {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Object) Get(key String) (core.Value, bool) {
|
||||
func (t *Object) Get(key String) (core.Value, Boolean) {
|
||||
val, found := t.value[string(key)]
|
||||
|
||||
if found {
|
||||
return val, found
|
||||
return val, NewBoolean(found)
|
||||
}
|
||||
|
||||
return None, found
|
||||
return None, NewBoolean(found)
|
||||
}
|
||||
|
||||
func (t *Object) GetIn(path []core.Value) (core.Value, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user