1
0
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:
Tim Voronov 2018-10-07 17:03:42 -04:00 committed by GitHub
commit 3a834d9a0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {