Skip to content

Commit

Permalink
Improved isSupported() implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
syranide committed Oct 6, 2015
1 parent f01e43c commit 48b5ad1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ if (SWFPlayerVersion.isSupported('10.0')) {

```
get()
returns {?string} 'X.Y.Z' or null.
returns {?string} '#.#.#' or null.
Get available SWF Player version. Result is cached.
```
```
isSupported(requiredString)
requiredString {string} 'X.Y.Z', 'X.Y' or 'X'.
requiredString {string} '#.#.#', '#.#', '#' or ''.
returns {boolean} true if supported.
Determine if available SWF Player meets version requirement.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swf-player-version",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",
"description": "Shockwave Flash Player version utility",
"authors": ["Andreas Svensson <[email protected]>"],
Expand Down
4 changes: 2 additions & 2 deletions npm-swf-player-version/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ if (SWFPlayerVersion.isSupported('10.0')) {

```
get()
returns {?string} 'X.Y.Z' or null.
returns {?string} '#.#.#' or null.
Get available SWF Player version. Result is cached.
```
```
isSupported(requiredString)
requiredString {string} 'X.Y.Z', 'X.Y' or 'X'.
requiredString {string} '#.#.#', '#.#', '#' or ''.
returns {boolean} true if supported.
Determine if available SWF Player meets version requirement.
Expand Down
2 changes: 1 addition & 1 deletion npm-swf-player-version/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swf-player-version",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",
"description": "Shockwave Flash Player version utility",
"author": "Andreas Svensson <[email protected]>",
Expand Down
12 changes: 6 additions & 6 deletions npm-swf-player-version/swf-player-version.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! swf-player-version v1.1.0 | @syranide | MIT license */
/*! swf-player-version v1.1.1 | @syranide | MIT license */

'use strict';

Expand Down Expand Up @@ -48,7 +48,7 @@ function detectAvailableVersion() {
/**
* Get available SWF Player version. Result is cached.
*
* @return {?string} 'X.Y.Z' or null.
* @return {?string} '#.#.#' or null.
*/
function getVersion() {
if (detectedVersion === undefined) {
Expand All @@ -61,7 +61,7 @@ function getVersion() {
/**
* Determine if available SWF Player meets version requirement.
*
* @param {string} requiredString 'X.Y.Z', 'X.Y' or 'X'.
* @param {string} requiredString '#.#.#', '#.#', '#' or ''.
* @return {boolean} true if supported.
*/
function isVersionSupported(requiredString) {
Expand All @@ -74,9 +74,9 @@ function isVersionSupported(requiredString) {
var availableFields = availableString.split('.');
var requiredFields = requiredString.split('.');

for (var i = 0; i < 3; i++) {
var availableField = availableFields[i];
var requiredField = requiredFields[i] || '0';
for (var i = 0; i < requiredFields.length; i++) {
var availableField = availableFields[i] || '0';
var requiredField = requiredFields[i];

if (availableField !== requiredField) {
return +availableField > +requiredField;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swf-player-version",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",
"description": "Shockwave Flash Player version utility",
"author": "Andreas Svensson <[email protected]>",
Expand Down
12 changes: 6 additions & 6 deletions swf-player-version.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! swf-player-version v1.1.0 | @syranide | MIT license */
/*! swf-player-version v1.1.1 | @syranide | MIT license */

(function(root, factory) {
if (typeof define === 'function' && define.amd) {
Expand Down Expand Up @@ -57,7 +57,7 @@
/**
* Get available SWF Player version. Result is cached.
*
* @return {?string} 'X.Y.Z' or null.
* @return {?string} '#.#.#' or null.
*/
function getVersion() {
if (detectedVersion === undefined) {
Expand All @@ -70,7 +70,7 @@
/**
* Determine if available SWF Player meets version requirement.
*
* @param {string} requiredString 'X.Y.Z', 'X.Y' or 'X'.
* @param {string} requiredString '#.#.#', '#.#', '#' or ''.
* @return {boolean} true if supported.
*/
function isVersionSupported(requiredString) {
Expand All @@ -83,9 +83,9 @@
var availableFields = availableString.split('.');
var requiredFields = requiredString.split('.');

for (var i = 0; i < 3; i++) {
var availableField = availableFields[i];
var requiredField = requiredFields[i] || '0';
for (var i = 0; i < requiredFields.length; i++) {
var availableField = availableFields[i] || '0';
var requiredField = requiredFields[i];

if (availableField !== requiredField) {
return +availableField > +requiredField;
Expand Down
4 changes: 2 additions & 2 deletions swf-player-version.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 48b5ad1

Please sign in to comment.