Skip to content
/ oadsl Public

业务代码中的领域特定语言。A Series DSL in Action with examples and JavaScript

License

Notifications You must be signed in to change notification settings

phodal/oadsl

Repository files navigation

业务代码中的领域特定语言: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

Phodal's Idea

© 2018 A Phodal Huang's Idea. This code is distributed under the MIT license. See LICENSE in this directory.

About

业务代码中的领域特定语言。A Series DSL in Action with examples and JavaScript

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published