1.2.0 • Published 10 years ago

jserator v1.2.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
10 years ago

How the object should be parsed

Given the schema for the generated object. Named as A string

{
  field1: '{{float().min(1).max(10).$}}' // random field value
  field2: [
    repeat(5): { // repeater builder
        field21: '{{random().float().min(0).max(1).$}}'
        city: '{{city()}}',
        address: {{address()}},
        full_address: function(gen){
            return [this.address, this.city].join(' ');
        }
    }
  ]
  first_name: '{{firstName()}}',
  last_name: '{{lastName()}}',
  hello: function(gen){ // dynamic value base on current object context
    return ['welcome', this.first_name, this.last_name].join(' ');
  }
}

Sketching solutions:

compose(
randomValueGenerator,
repeaterGenerator,
functionalGenerator
)(compile)(A)

should produce the js object as schema description.

1.2.0

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.5

10 years ago