IsRef
IsRef( value )
Description
The IsRef
function returns true
only if value
is a
Reference, otherwise it returns false
.
Examples
The following query uses Map
to iterate over an array of all of
the types of values that can be tested by a type-check function, passing
each item into a Lambda
function that returns an object, which
contains the value and the result of calling IsRef
with that
value:
[
{ value: [ 'array' ], IsRef: false },
{ value: true, IsRef: false },
{ value: false, IsRef: false },
{ value: { '0': 1, '1': 2, '2': 3, '3': 4 }, IsRef: false },
{ value: [ 1, 2, 3, 4 ], IsRef: false },
{ value: Collection("Letters"), IsRef: true },
{ value: Ref(Credentials(), "302043979982045696"), IsRef: true },
{ value: Database("child_db"), IsRef: true },
{ value: Date("2019-11-12"), IsRef: false },
{ value: Ref(Collection("Letters"), "123"), IsRef: true },
{ value: 10.1, IsRef: false },
{ value: Function("double"), IsRef: true },
{ value: Index("letters"), IsRef: true },
{ value: 10, IsRef: false },
{ value: Ref(Keys(), "1"), IsRef: true },
{ value: Query(Lambda("x", Var("x"))), IsRef: false },
{ value: null, IsRef: false },
{ value: { x: 10 }, IsRef: false },
{ value: Role("employees"), IsRef: true },
{ value: Match(Index("letters")), IsRef: false },
{ value: 'ten', IsRef: false },
{ value: '10', IsRef: false },
{ value: Time("2020-07-06T12:34:56.789Z"), IsRef: false },
{ value: Ref(Tokens(), "1"), IsRef: true }
]
This query operates on a pre-existing schema, which is not provided here. Also, the query is executed via a client connection, that uses a secret
acquired by calling the |
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!