Dasel
v2
v2
  • Introduction
  • GitHub
  • Supported file formats
  • Memory usage
  • Installation
  • Commands
    • Select
    • Put
    • Delete
  • Functions
    • Selector Overview
    • All
    • And
    • Append
    • Count
    • Equal
    • Filter
    • FilterOr
    • First
    • Index
    • Join
    • Key
    • Keys
    • Last
    • Len
    • LessThan
    • MapOf
    • Merge
    • MoreThan
    • Not
    • Or
    • OrDefault
    • Parent
    • Property
    • String
    • Null
    • This
    • Type
  • Examples
    • Using dasel as a go package
    • Basics
    • Change file format
    • Filtering objects based on present/missing key
Powered by GitBook
On this page
Edit on GitHub
  1. Functions

FilterOr

Expects 1 or more arguments.

Each argument should be a selector.

FilterOr runs the given selectors against each value from the previous function, and if any selectors return a truthy value, the element is allowed through.

Examples

$ echo '[
  {"label":"x","allow":true},
  {"label":"y","allow":false},
  {"label":"z","allow":false}
  ]' | dasel -r json 'all().filterOr(allow,equal(label,y))'
{
  "allow": true,
  "label": "x"
}
{
  "allow": false,
  "label": "y"
}
PreviousFilterNextFirst

Last updated 2 years ago