@apility/rule-builder
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

Rule Builder PHP

Installation

yarn add @apility/rule-builder

Example rule

Validates true all of 2021, except on the 17th of may, 24th of december and all of june.

{
  "type": "group",
  "count": "all",
  "children": [
    {
      "type": "group",
      "count": "any",
      "children": [
        {
          "type": "dateRange",
          "from": "2021-01-01",
          "to": "2022-01-01"
        }
      ]
    },
    {
      "type": "not",
      "child": {
        "type": "group",
        "count": "any",
        "children": [
          {
            "type": "dateRange",
            "from": "2021-05-17",
            "to": "2021-05-18"
          },
          {
            "type": "dateRange",
            "from": "2021-12-24",
            "to": "2021-12-25"
          },
          {
            "type": "dateRange",
            "from": "2021-06-01",
            "to": "2021-07-01"
          }
        ]
      }
    }
  ]
}

Simple example matching weekends in september 2021

{
  "type": "group",
  "count": "all",
  "children": [
    {
      "type": "dayOfWeek,",
      "days": [
        6,
        0
      ]
    },
    {
      "type": "dateRange",
      "from": "2021-09-01",
      "to": "2021-10-01"
    }
  ]
}

Package Sidebar

Install

npm i @apility/rule-builder

Weekly Downloads

22

Version

1.0.7

License

MIT

Unpacked Size

258 kB

Total Files

50

Last publish

Collaborators

  • joadpility
  • sleskeleske
  • olavoyen
  • thomas-alrek
  • erikdju
  • cathrinevaage
  • tommysolsen
  • jarjarbinks1985