Skip to content

Booléens ​

boolean applique la véracité JSONata (les chaînes vides, 0, les tableaux/objets vides sont faux) ; not la nie ; exists est vrai pour toute valeur autre que undefined (y compris null).

boolean ​

boolean(value: unknown): boolean

Véracité JSONata : "", 0, [] et {} sont faux.

typeflow
hasBio: boolean(user.bio)

not ​

not(value: unknown): boolean

Véracité JSONata niée.

typeflow
isBlank: not(user.bio)

exists ​

exists(value: unknown): boolean

Vrai sauf si la valeur est undefined (null existe).

typeflow
wasDeleted: exists(user.deletedAt)

Playground ​

Mapping✔Playground ↗
JSON d'entrée
Sortie
{
  "hasBio": false,
  "hasTags": true,
  "isBlank": true,
  "wasDeleted": true
}
type inféré{ hasBio: boolean; hasTags: boolean; isBlank: boolean; wasDeleted: boolean; }

Publié sous licence MIT.