electron-is
Advanced tools
Comparing version 2.0.0 to 2.0.1
37
is.js
/* | ||
* Project: electron-is | ||
* Version: 2.0.0 | ||
* Version: 2.0.1 | ||
* Author: delvedor | ||
@@ -16,19 +16,2 @@ * Twitter: @delvedor | ||
const isDev = require('electron-is-dev') | ||
const macReleases = { | ||
// osx: darwin | ||
'10.5.0': '9.0', | ||
'10.5.8': '9.8', | ||
'10.6.0': '10.0', | ||
'10.6.8': '10.8', | ||
'10.7.0': '11.0.0', | ||
'10.7.5': '11.4.2', | ||
'10.8.0': '12.0.0', | ||
'10.8.5': '12.6.0', | ||
'10.9.0': '13.0.0', | ||
'10.9.5': '13.4.0', | ||
'10.10.0': '14.0.0', | ||
'10.10.5': '14.5.0', | ||
'10.11.0': '15.0.0', | ||
'10.11.4': '15.4.0' | ||
} | ||
@@ -112,4 +95,4 @@ // Constructor | ||
IsApi.prototype.release = function (requested) { | ||
if (this.osx() && macReleases[requested]) { | ||
return release() === macReleases[requested] | ||
if (this.osx()) { | ||
return requested === osxRelease() | ||
} else if (this.windows()) { | ||
@@ -130,4 +113,4 @@ let requested = requested.split('.') | ||
IsApi.prototype.gtRelease = function (requested) { | ||
if (this.osx() && macReleases[requested]) { | ||
return gt(macReleases[requested], release()) | ||
if (this.osx()) { | ||
return gt(requested, osxRelease()) | ||
} else if (this.windows()) { | ||
@@ -148,4 +131,4 @@ let requested = requested.split('.') | ||
IsApi.prototype.ltRelease = function (requested) { | ||
if (this.osx() && macReleases[requested]) { | ||
return lt(macReleases[requested], release()) | ||
if (this.osx()) { | ||
return lt(requested, osxRelease()) | ||
} else if (this.windows()) { | ||
@@ -164,2 +147,8 @@ let requested = requested.split('.') | ||
// returns the current osx release | ||
function osxRelease () { | ||
let actual = release().split('.') | ||
return `10.${actual[0] - 4}.${actual[1]}` | ||
} | ||
// new instace | ||
@@ -166,0 +155,0 @@ const is = new IsApi() |
{ | ||
"name": "electron-is", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "An 'is' utility for Electron which provides a set of handy functions, with a self-descriptive name.", | ||
@@ -5,0 +5,0 @@ "main": "is.js", |
@@ -44,11 +44,11 @@ # electron-is | ||
Returns `true` if all the 'is functions' passed as argument are true. | ||
example: `is.all(is.mac, is.x64)` | ||
example: `is.all(is.osx, is.x64)` | ||
- **is.none(args)** | ||
Returns `true` if all the 'is functions' passed as argument are false. | ||
example: `is.none(is.windows, is.is32, is.main)` | ||
example: `is.none(is.windows, is.x86, is.main)` | ||
- **is.one(args)** | ||
Returns `true` if one of the 'is functions' passed as argument is true. | ||
example: `is.one(is.mac, is.linux)` | ||
example: `is.one(is.osx, is.linux)` | ||
@@ -89,2 +89,4 @@ - **is.release(args)** | ||
``` | ||
## Acknowledgements | ||
`electron-is` makes use of [electron-is-dev](https://github.com/sindresorhus/electron-is-dev) package from @sindresorhus. | ||
@@ -91,0 +93,0 @@ ## Contributing |
@@ -60,7 +60,7 @@ 'use strict' | ||
assert.equal(is.gtRelease('10.11.4'), false, 'is.gtRelease() 1 not ok!') | ||
assert.equal(is.gtRelease('10.12.0'), null, 'is.gtRelease() 2 not ok!') | ||
assert.equal(is.gtRelease('10.12.0'), true, 'is.gtRelease() 2 not ok!') | ||
assert.equal(is.gtRelease('10.8.0'), false, 'is.gtRelease() 3 not ok!') | ||
assert.equal(is.ltRelease('10.11.4'), false, 'is.ltRelease() 1 not ok!') | ||
assert.equal(is.ltRelease('10.12.0'), null, 'is.ltRelease() 2 not ok!') | ||
assert.equal(is.ltRelease('10.12.0'), false, 'is.ltRelease() 2 not ok!') | ||
assert.equal(is.ltRelease('10.8.0'), true, 'is.ltRelease() 3 not ok!') | ||
@@ -72,3 +72,3 @@ } else if (is.windows()) { | ||
} else { | ||
assert.equal(is.release('1.2.3'), null, 'is.release() not ok!') | ||
assert.equal(is.release('1.2.3'), false, 'is.release() not ok!') | ||
} | ||
@@ -75,0 +75,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101
15710
195