-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Interface #48
Update Interface #48
Conversation
@danielgtaylor This will definitely need a look from you, as these are some big changes. |
|
||
```javascript | ||
var objectElement = new minim.ObjectElement({ foo: 'bar' }); | ||
var value = objectElement.getValue('foo') // returns 'bar' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems just objectElement.value(0)
would be sufficient. As a rubyist my pull is to keep get
and set
out of method names, so I am biased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an issues to discuss this.
@fosrias I've addressed all comments. |
expect(el.meta.class.toValue()).to.deep.equal(['a', 'b']); | ||
expect(el.meta.title.toValue()).to.equal('Title'); | ||
expect(el.meta.description.toValue()).to.equal('Description'); | ||
expect(el.meta.get('id').toValue()).to.equal('foobar'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I cannot do: el.meta.id.toValue()
now? This seems extra verbose (shock me).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do element.id
, but currently not element.meta.id
. It's the same interface now for any object with helper methods on element
.
@smizell Fine by me. Leave to @danielgtaylor to clarify anything. |
This PR does several things.
obj.set({ foo: 'bar' })
to work for objectsgetValue
method which is short forobj.get('foo').toValue()
. Now you can doobj.getValue('foo')
.