oss-wec / wisdm

Wildlife information system for data management
1 stars 1 forks source link

refactor blankObject in all models #3

Closed kissmygritts closed 7 years ago

kissmygritts commented 7 years ago
export function emptyModel (obj) {
  obj = Object.assign({}, obj)

  for (let k in obj) {
    obj[k] = null
  }

  return obj
}
kissmygritts commented 7 years ago

I may change this to only return the obj without assign obj[k] = null.

kissmygritts commented 7 years ago

Right now I have a blank (empty) model in data and I am cloning it to create the dynamically added model.

In the future I can replace the obj[k] = null to obj[k]='' as this will preserve the proper select inputs initial option.