Comments (5)
guessing strategy might be to change code to import the helpers and create a code generator that replaces the p-expression with nested helpers.
eg.
const notNil = p`!(null|undefined)`;
de-sugars to:
import {not, or} from 'pdsl/helpers';
const notNil = not(or(null,undefined));
from pdsl.
This could create a new file format. .pdsl
export predicate isUser = {
name: String & { length: > 5 },
password: String & { length: > 5 }
}
export predicate isNotNil = !(null|undefined)
Could de-sugar to:
const {not, or, and, obj} = require('pdsl/helpers');
module.exports = {
isUser = obj(
['name', and(String, obj('length',gt(5))),
'password': and(String, obj('length', gt(5)))
),
isNotNil: not(or(null, undefined))
}
from pdsl.
Might be better to work through a way to generate inline predicate expressions:
const isUser = o > o && typeof o.name === 'string' && o.name.length > 5 && o.password // etc...
from pdsl.
First cut will be functional using a similar functional style generator to the JS one and second one can create inline predicates.
from pdsl.
This is now available via https://github.com/ryardley/babel-plugin-pdsl
from pdsl.
Related Issues (20)
- Convert to Typescript
- Interpolation function for validation
- Allow nested schemas
- Appears as though deprecation warnings are firing regardless as to whether or not deprecated regex is used
- Create validation docs
- Array includes syntax
- Loose matching by default and can be configured
- Add formik example
- Dot syntax for accessing deeply nested properties. HOT 1
- Convert to typescript
- Schema API changes
- Bug: TypeScript types don't match up for new schema import
- Bug: String quoting error
- TypeScript type compilation HOT 1
- Assemble npm readme from docs files
- Language server for autocomplete
- Misplaced comma should throw
- "OR"ing number expressions in str length calls is not working correctly
- Refactor to allow context to helpers
- Thoughts on the future direction for pdsl
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdsl.