can-play-type-to-number
v1.0.1
Published
'probably' => 2, 'maybe' => 1, '' => 0
Maintainers
Readme
can-play-type-to-number
Convert a string which .canPlayType() may returns into a number (0 - 2)
canPlayTypeToNumber('probably'); //=> 2
canPlayTypeToNumber('maybe'); //=> 1
canPlayTypeToNumber(''); //=> 0
canPlayTypeToNumber('perhaps'); //=> throws an errorInstallation
Package managers
npm
npm install can-play-type-to-numberBower
bower install can-play-type-to-numberStandalone
Download the script file directly.
API
canPlayTypeToNumber(playability)
playability: String ('probably', 'maybe', or '')
Return: Number (0 - 2)
| argument | return |
| ------------ | ------ |
| 'probably' | 2 |
| 'maybe' | 1 |
| '' | 0 |
It throws an error when the argument isn't included in the list above.
License
Copyright (c) 2014 - 2015 Shinnosuke Watanabe
Licensed under the MIT License.
