parental-rating
v0.1.0
Published
Utilities to work with parental ratings
Downloads
9
Maintainers
Readme
Parental Rating Utils
Installation
npm install parental-ratingUsage
compare(ratingA, ratingB)
Compare two profile ratings together.
- Returns
<0if a is a lower rating then b. - Returns
0if a is equal to b. - Returns
>0if a is a greater rating then b.
import {compare} from 'parental-rating';
compare('G', 'PG') < 0 // true
compare('M', 'M') == 0 // true
compare('R', 'PG') > 0 // truecanWatch(profileRating, contentRating)
Returns true when
profileRatingis allow to watchcontentRating. Returns false otherwise.
import {canWatch} from 'parental-rating';
canWatch('G', 'PG') // false
canWatch('M', 'M') // true
canWatch('R', 'PG') // truegetHighestRating(ratings)
Returns the highest rating given an array of ratings.
getHighestRating(['PG', 'G', 'M', 'G']) // 'M'License
MIT
