https://github.com/plotdb/pdt
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/plotdb/pdt
- Owner: plotdb
- Created: 2019-12-30T15:55:03.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-04T23:14:11.000Z (over 5 years ago)
- Last Synced: 2025-09-10T16:57:31.779Z (7 months ago)
- Language: LiveScript
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pdType
Common data types for data visualization. Types are named in "pdXXXX" style, e.g., "pdString", "pdNumber"
## Basic Type Structure
All types are designed as a JavaScript object with proper constructor, with following interface:
* name: string. name of type
* default: default value
* test: (v) -> # return true or false
- test if v is compatible with this type.
* parse: (v) ->
- parse v into internal format of this type.
* order:
* sort: (a, b) -> # comparator function for sorting.
## Common Types
* string
* numstring
* number
* order
* boolean
* date
### Advanced Types
* strings with constraint
- choice
* orderable
* weekday
* month
## Type Polymorphism
Value in one type could be also in another type.
## pdType common function.
pdType, as an object, exposes following interface:
* identify: (input)
- input either a value or an array.
## LICENSE
MIT