1.0.1 • Published 9 years ago
can-play-type-to-number v1.0.1
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 error
Installation
Package managers
npm
npm install can-play-type-to-number
Bower
bower install can-play-type-to-number
Standalone
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.