mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-14 11:23:02 +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 (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
|
||||||
"hash/fnv"
|
"hash/fnv"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
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)]
|
val, found := t.value[string(key)]
|
||||||
|
|
||||||
if found {
|
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) {
|
func (t *Object) GetIn(path []core.Value) (core.Value, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user