Module valid

Module valid 

Source
Expand description

Data validation and soul reference detection

This module validates data values according to Gun’s rules and detects soul references. Based on Gun.js valid.js - matches the exact validation logic.

§Valid Data Types

  • null - Valid (represents deletion)
  • string - Always valid
  • boolean - Always valid
  • number - Valid if not Infinity or NaN
  • Soul reference - Object with only {"#": "soul_id"} key
  • Objects - Not directly valid (must be stored as nodes)
  • Arrays - Not directly supported

Functions§

is_valid_data
Check if data is valid for storage in Gun
valid
Validate a value according to Gun’s rules and detect soul references
valid_soul
Check if a value is a valid soul reference