oadsl
业务代码中的领域特定语言。A Series DSL in Action with examples and JavaScript
业务代码中的领域特定语言:OADSL
A Series DSL in Action with examples and JavaScript
With
- Regex DSL
- Language DSL
- Template DSL
- Data Structure DSL
Examples
Workflow
let data = {
transact: {
name: 'Transact',
status: 'success'
},
approve: {
name: 'Approve',
status: 'processing'
},
bank: {
name: 'Bank',
status: 'todo'
}
}
let results = workflowParser(data)
Form Validate
const LoginFormValidateMap = {
phone: {
require: true,
regular: RegexMap.phone
},
country: {
requiredBy: 'phone'
},
email: {
requiredByNot: {
country: 'CN'
}
}
}
const data = {
phone: '1234567980',
country: 'US',
email: ''
}
let result = FormValidator(LoginFormValidateMap, data)
Resources
License
© 2018 A Phodal Huang’s Idea. This code is distributed under the MIT license. See LICENSE
in this directory.