Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clip: Work on single value #75

Closed
m-mohr opened this issue Sep 3, 2019 · 0 comments
Closed

clip: Work on single value #75

m-mohr opened this issue Sep 3, 2019 · 0 comments
Milestone

Comments

@m-mohr
Copy link
Member

m-mohr commented Sep 3, 2019

The clip function works on arrays and not on a single value, which is strange as all other similar functions work on a single value.

Therefore I'd propose to change the definition to:

{
  "id": "clip",
  "summary": "Clips a value between a minimum and a maximum value.",
  "description": "Clips a number between specified minimum and maximum values. A value larger than the maximal value will have the maximal value, a value lower than minimal value will have the minimal value.",
  "categories": [
    "math"
  ],
  "parameter_order": [
    "x",
    "min",
    "max"
  ],
  "parameters": {
    "x": {
      "description": "A number.",
      "schema": {
        "type": [
          "number",
          "null"
        ]
      },
      "required": true
    },
    "min": {
      "description": "Minimum value. If the value is lower than this value, the process will return the value of this parameter.",
      "schema": {
        "type": "number"
      },
      "required": true
    },
    "max": {
      "description": "Maximum value. If the value is greater than this value, the process will return the value of this parameter.",
      "schema": {
        "type": "number"
      },
      "required": true
    }
  },
  "returns": {
    "description": "The value clipped to the specified range.",
    "schema": {
      "type": [
        "number",
        "null"
      ]
    }
  },
  "examples": [
    {
      "arguments": {
        "x": -5,
        "min": -1,
        "max": 1
      },
      "returns": -1
    },
    {
      "arguments": {
        "x": 10.001,
        "min": 1,
        "max": 10
      },
      "returns": 10
    },
    {
      "arguments": {
        "x": 0.000001,
        "min": 0,
        "max": 0.02
      },
      "returns": 0.000001
    },
    {
      "arguments": {
        "x": null,
        "min": 0,
        "max": 1
      },
      "returns": null
    }
  ]
}
@m-mohr m-mohr added this to the v1.0 milestone Sep 3, 2019
@m-mohr m-mohr changed the title clip clip: Work on single value Sep 3, 2019
m-mohr added a commit that referenced this issue Oct 30, 2019
@m-mohr m-mohr closed this as completed Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant