silfverorg / duns.js

Javascript schema validator
5 stars 2 forks source link

Duns transform works badly with objects #60

Open br0r opened 9 years ago

br0r commented 9 years ago

All data that has not been specified in a schema will be removed. This should be moddable. Perhaps .allowAllKeys should fix this.

var data = {
  test: 'foo',
  test2: 'bar'
};
Duns.objects().keys({
  test: Duns.string().returns((val) => val + '!')
}).init(data).format() // Removes test2