Skip to content

Commit

Permalink
Updated syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
electerious committed Apr 22, 2018
1 parent fb8b6e4 commit 4dc620a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ const envify = require('loose-envify/custom')
*/
module.exports = async function(filePath, opts) {

const env = (opts!=null && opts.optimize===true) ? { NODE_ENV: 'production' } : {}
const env = (opts != null && opts.optimize === true) ? { NODE_ENV: 'production' } : {}

// Use custom options when available or default options as a fallback
const babelOpts = (opts!=null && typeof opts.babel==='object') ? opts.babel : {
const babelOpts = (opts != null && typeof opts.babel === 'object') ? opts.babel : {
presets: [ 'env', 'react' ],
babelrc: false
}

// Use custom options when available or default options as a fallback
const browserifyOpts = (opts!=null && typeof opts.browserify==='object') ? opts.browserify : {
const browserifyOpts = (opts != null && typeof opts.browserify === 'object') ? opts.browserify : {
debug: true
}

Expand All @@ -35,7 +35,7 @@ module.exports = async function(filePath, opts) {

const next = (err, result) => {

if (err!=null) return reject(err)
if (err != null) return reject(err)

resolve(result.toString())

Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const uglify = require('./uglify')
*/
module.exports = async function(filePath, opts) {

if (typeof filePath!=='string') throw new Error(`'filePath' must be a string`)
if (typeof opts!=='object' && opts!=null) throw new Error(`'opts' must be undefined, null or an object`)
if (typeof filePath !== 'string') throw new Error(`'filePath' must be a string`)
if (typeof opts !== 'object' && opts != null) throw new Error(`'opts' must be undefined, null or an object`)

let output = null

Expand All @@ -32,7 +32,7 @@ module.exports = async function(filePath, opts) {
*/
module.exports.in = function(opts) {

return (opts!=null && opts.in!=null) ? opts.in : '.js'
return (opts != null && opts.in != null) ? opts.in : '.js'

}

Expand All @@ -44,7 +44,7 @@ module.exports.in = function(opts) {
*/
module.exports.out = function(opts) {

return (opts!=null && opts.out!=null) ? opts.out : '.js'
return (opts != null && opts.out != null) ? opts.out : '.js'

}

Expand Down
6 changes: 3 additions & 3 deletions src/uglify.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const uglify = require('uglify-js')
*/
module.exports = async function(str, opts) {

if (str==null || str==='') return ''
if (str == null || str === '') return ''

// Skip task when output should not be optimized
if (opts!=null && opts.optimize===false) return str
if (opts != null && opts.optimize === false) return str

const result = uglify.minify(str)

if (result.error!=null) throw result.error
if (result.error != null) throw result.error

return result.code

Expand Down

0 comments on commit 4dc620a

Please sign in to comment.