[refactored] startWith to have shorthand signature
ClosedPublic

Authored by appsforartists on Oct 8 2017, 11:41 PM.

Diff Detail

Repository
R13 material-motion/material-motion-js
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
appsforartists created this revision.Oct 8 2017, 11:41 PM
Restricted Application completed building Restricted Buildable.Oct 8 2017, 11:41 PM
Restricted Application added a reviewer: O2: Material Motion. · View Herald TranscriptOct 8 2017, 11:41 PM
Restricted Application added a project: Material Motion. · View Herald Transcript
Restricted Application added a reviewer: O3: Material JavaScript platform reviewers. · View Herald Transcript
Restricted Application added a reviewer: Material Motion. · View Herald Transcript
Restricted Application completed building Restricted Buildable.Oct 8 2017, 11:46 PM
vietanh accepted this revision.Oct 11 2017, 12:20 AM
vietanh added a subscriber: vietanh.
vietanh added inline comments.
packages/core/src/interactions/Tossable.ts
233

Could there ever be cases where the library mistakes between named args and shorthand? For example, over here we both pass in objects for startWith. Do we need validation to check if the object has the right structure (has the 'value' key)?

This revision is now accepted and ready to land.Oct 11 2017, 12:20 AM
appsforartists added inline comments.Oct 11 2017, 5:33 PM
packages/core/src/interactions/Tossable.ts
233

Yes. That's part of the implementation and the tests.

If {value: … } is passed, the is used as the value. If an object with too many keys is passed, or if a non-object is passed, the whole passed object is treated as the value.

This revision was automatically updated to reflect the committed changes.