Skip to content

jsl/ensure

Package name: jsl/ensure

Summary

General Definitions

Function Description
ensure-divisible! Check for multi-sided components to ensure proper number of pins.
ensure-even-positive! Check if the passed value is both positive and even
ensure-maybe-greater-eq!
ensure-less-eq!
ensure-greater-eq!
ensure-maybe-less!
ensure-maybe-less-eq!
ensure-greater!
ensure-in-set!
ensure-positive! (+ 1)
ensure-less!
ensure-maybe-greater!
ensure-non-negative! (+ 1) Check if the value is non-negative (ie, zero or greater)
ensure-not-empty!

Definitions

General Definitions

ensure-divisible!

Check for multi-sided components to ensure proper number of pins.

public defn ensure-divisible! (value:Int, divisor:Int, name:String)

  • value: Int - Number to check, typically the number of pins for a particular package.
  • divisor: Int - Typically used for the number of sides of a package. Example: 4 for QFN.
  • name: String - Name of the package we are checking
  • Throws ValueError - when the passed value is not divisible.

ensure-even-positive!

Check if the passed value is both positive and even

public defn ensure-even-positive! (field:String, value:Int)

  • field: String - Name of the package we are checking
  • value: Int - Number to check, typically the number of pins for a particular package.
  • Throws ValueError - when the passed value is not even or positive

ensure-maybe-greater-eq!

public defn ensure-maybe-greater-eq! (min-value:Int|Long|Double|Float|Dims)

ensure-less-eq!

public defn ensure-less-eq! (min-v:Int|Long|Double|Float|Dims)

ensure-greater-eq!

public defn ensure-greater-eq! (min-v:Int|Long|Double|Float|Dims)

ensure-maybe-less!

public defn ensure-maybe-less! (min-value:Int|Long|Double|Float|Dims)

ensure-maybe-less-eq!

public defn ensure-maybe-less-eq! (min-value:Int|Long|Double|Float|Dims)

ensure-greater!

public defn ensure-greater! (min-v:Int|Long|Double|Float|Dims)

ensure-in-set!

public defn ensure-in-set! (accepted:Tuple<Int>)

ensure-positive!

public defn ensure-positive! (field:String, value:Int|Long|Double|Float|Toleranced|Dims|Percentage)

ensure-positive!

public defn ensure-positive! (field:String, value?:Maybe<Int|Long|Double|Float|Toleranced|Dims|Percentage>)

ensure-less!

public defn ensure-less! (min-v:Int|Long|Double|Float|Dims)

ensure-maybe-greater!

public defn ensure-maybe-greater! (min-value:Int|Long|Double|Float|Dims)

ensure-non-negative!

Check if the value is non-negative (ie, zero or greater)

public defn ensure-non-negative! (field:String, value:Int|Long|Double|Float|Toleranced|Dims|Percentage)

ensure-non-negative!

public defn ensure-non-negative! (field:String, value?:Maybe<Int|Long|Double|Float|Toleranced|Dims|Percentage>)

ensure-not-empty!

public defn ensure-not-empty! (field:String, value:Collection)