Add logic helpers for sanity
This commit is contained in:
parent
c95a09aa6e
commit
f974f260b3
2 changed files with 16 additions and 2 deletions
|
|
@ -5,11 +5,25 @@ import { objectValue } from "./objectValue.mjs";
|
|||
import { toFriendlyDuration } from "./toFriendlyDuration.mjs";
|
||||
|
||||
export default {
|
||||
|
||||
// Complex helpers
|
||||
"dd-schemaOptions": schemaOptions,
|
||||
"dd-array": createArray,
|
||||
"dd-toFriendlyDuration": toFriendlyDuration,
|
||||
"dd-objectValue": objectValue,
|
||||
"dd-expanded": detailsExpanded,
|
||||
|
||||
// Simple helpers
|
||||
"dd-stringify": v => JSON.stringify(v, null, ` `),
|
||||
"dd-negate": v => !v,
|
||||
|
||||
// Logic helpers
|
||||
"eq": (a, b) => a == b,
|
||||
"neq": (a, b) => a != b,
|
||||
"not": v => !v,
|
||||
"or": (a, b) => a || b,
|
||||
"and": (a, b) => a && b,
|
||||
"nor": (a, b) => !(a || b),
|
||||
"nand": (a, b) => !(a && b),
|
||||
"xor": (a, b) => (a || b) && !(a && b),
|
||||
"xnor": (a, b) => !((a || b) && !(a && b))
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue