can-play-type-to-number

1.0.1 • Public • Published

can-play-type-to-number

NPM version Bower version Build Status Coverage Status devDependency Status

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.

Package Sidebar

Install

npm i can-play-type-to-number

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • shinnn