diff --git a/index.js b/index.js index ba74d55..9615572 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -module.exports = require('./lib/') \ No newline at end of file +module.exports = require('./lib/') diff --git a/lib/index.js b/lib/index.js index 477e633..3df1d31 100644 --- a/lib/index.js +++ b/lib/index.js @@ -4,8 +4,8 @@ const random = require('./random') const utils = require('./utils') module.exports = { - logger, - random, - make, - utils + logger, + random, + make, + utils } diff --git a/lib/logging/console.js b/lib/logging/console.js index a8f56fe..cda8e0e 100644 --- a/lib/logging/console.js +++ b/lib/logging/console.js @@ -19,7 +19,6 @@ if (utils.platform.name.isWindows) { } class logger { - static console (msg) { if (websocket) { websocket.send(msg) @@ -31,7 +30,7 @@ class logger { console.log(msg) } } else if (window.dump) { - dump(msg) + dump(msg) // eslint-disable-line no-undef } else if (window.console && window.console.log) { console.log(msg) } else { @@ -85,4 +84,4 @@ class logger { } } -module.exports = logger \ No newline at end of file +module.exports = logger diff --git a/lib/logging/index.js b/lib/logging/index.js index 05ab01b..3468436 100644 --- a/lib/logging/index.js +++ b/lib/logging/index.js @@ -3,13 +3,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ class logging { - constructor () { - } - - static get logger () { - // Or: const {logger} = require('./logging') - return require('./console') - } + static get logger () { + // Or: const {logger} = require('./logging') + return require('./console') + } } module.exports = logging diff --git a/lib/make/alignment.js b/lib/make/alignment.js index cd7ce20..e819c62 100644 --- a/lib/make/alignment.js +++ b/lib/make/alignment.js @@ -6,17 +6,17 @@ const make = require('../make') const random = require('../random') class alignment extends make { - static horizontal () { - return random.item(['left', 'right', 'justify', 'center']) - } + static horizontal () { + return random.item(['left', 'right', 'justify', 'center']) + } - static vertical () { - return random.item(['top', 'bottom', 'middle', 'baseline']) - } + static vertical () { + return random.item(['top', 'bottom', 'middle', 'baseline']) + } - static any () { - return random.pick([this.horizontal, this.vertical]) - } + static any () { + return random.pick([this.horizontal, this.vertical]) + } } module.exports = alignment diff --git a/lib/make/crypto.js b/lib/make/crypto.js index 3199e2d..4e0ab5b 100644 --- a/lib/make/crypto.js +++ b/lib/make/crypto.js @@ -2,8 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const make = require('../make') const random = require('../random') +const make = require('../make') +const utils = require('../utils') class crypto extends make { static get keyFormats () { @@ -54,8 +55,8 @@ class crypto extends make { ] } - static randomCurve (){ - return random.item(this.curves) + static randomCurve () { + return random.item(this.curves) } static get jwkUsages () { diff --git a/lib/make/fonts.js b/lib/make/fonts.js index 0f26c13..402812d 100644 --- a/lib/make/fonts.js +++ b/lib/make/fonts.js @@ -83,7 +83,7 @@ class font extends make { ]) } - static font() { + static font () { let s = '' if (random.chance(4)) { s += random.pick(this.style) + ' ' @@ -104,4 +104,4 @@ class font extends make { } } -module.exports = font \ No newline at end of file +module.exports = font diff --git a/lib/make/index.js b/lib/make/index.js index e138f6d..99d31b9 100644 --- a/lib/make/index.js +++ b/lib/make/index.js @@ -3,89 +3,89 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ class make { - static get number () { - return require('./numbers') - } + static get number () { + return require('./numbers') + } - static get alignment () { - return require('./alignment') - } + static get alignment () { + return require('./alignment') + } - static get arrays () { - return require('./arrays') - } + static get arrays () { + return require('./arrays') + } - static get colors () { - return require('./colors') - } + static get colors () { + return require('./colors') + } - static get command () { - return require('./command') - } + static get command () { + return require('./command') + } - static get crypto () { - return require('./crypto') - } + static get crypto () { + return require('./crypto') + } - static get datetime () { - return require('./datetime') - } + static get datetime () { + return require('./datetime') + } - static get files () { - return require('./files') - } + static get files () { + return require('./files') + } - static get font () { - return require('./fonts') - } + static get font () { + return require('./fonts') + } - static get html () { - return require('./html') - } + static get html () { + return require('./html') + } - static get mime () { - return require('./mime') - } + static get mime () { + return require('./mime') + } - static get network () { - return require('./network') - } + static get network () { + return require('./network') + } - static get shaders () { - return require('./shaders') - } + static get shaders () { + return require('./shaders') + } - static get style () { - return require('./style') - } + static get style () { + return require('./style') + } - static get text () { - return require('./text') - } + static get text () { + return require('./text') + } - static get time () { - return require('./time') - } + static get time () { + return require('./time') + } - static get typed () { - return require('./typed') - } + static get typed () { + return require('./typed') + } - static get types () { - return require('./types') - } + static get types () { + return require('./types') + } - static get unit () { - return require('./units') - } + static get unit () { + return require('./units') + } - static get uri () { - return require('./uri') - } + static get uri () { + return require('./uri') + } - static get webgl () { - return require('./webgl') - } + static get webgl () { + return require('./webgl') + } } module.exports = make diff --git a/lib/make/numbers.js b/lib/make/numbers.js index bbc6ee7..52b4f69 100644 --- a/lib/make/numbers.js +++ b/lib/make/numbers.js @@ -60,7 +60,7 @@ class number extends make { return Math.pow(2, random.number(random.number(65))) + random.number(3) - 1 } - static even(number) { + static even (number) { return number % 2 === 1 ? ++number : number } diff --git a/lib/make/shaders.js b/lib/make/shaders.js index 7b332cc..7cd7065 100644 --- a/lib/make/shaders.js +++ b/lib/make/shaders.js @@ -2,8 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const make = require('../make') const random = require('../random') +const make = require('../make') +const utils = require('../utils') class shaders extends make { static get fragment1 () { @@ -29,7 +30,7 @@ class shaders extends make { ] } - static get vertex1() { + static get vertex1 () { return [ [ 'attribute vec4 aVertex;', @@ -63,7 +64,7 @@ class shaders extends make { ] } - static get fragment2() { + static get fragment2 () { return [ [ 'varying highp vec2 vTextureCoord;', @@ -96,7 +97,7 @@ class shaders extends make { ] } - static get vertex2() { + static get vertex2 () { return [ [ 'attribute highp vec3 aVertexNormal;', diff --git a/lib/make/text.js b/lib/make/text.js index da1aec8..9e0737a 100644 --- a/lib/make/text.js +++ b/lib/make/text.js @@ -2,8 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const make = require('../make') const random = require('../random') +const make = require('../make') +const utils = require('../utils') class text extends make { static lineEnd () { diff --git a/lib/random/mersennetwister.js b/lib/random/mersennetwister.js index 18b298f..45f246e 100644 --- a/lib/random/mersennetwister.js +++ b/lib/random/mersennetwister.js @@ -28,28 +28,28 @@ class MersenneTwister { } } - export_state () { + export_state () { // eslint-disable-line camelcase return [this.mt, this.mti] } - import_state (s) { + import_state (s) { // eslint-disable-line camelcase this.mt = s[0] this.mti = s[1] } - export_mta () { + export_mta () { // eslint-disable-line camelcase return this.mt } - import_mta (_mta) { + import_mta (_mta) { // eslint-disable-line camelcase this.mt = _mta } - export_mti () { + export_mti () { // eslint-disable-line camelcase return this.mti } - import_mti (_mti) { + import_mti (_mti) { // eslint-disable-line camelcase this.mti = _mti } @@ -58,8 +58,8 @@ class MersenneTwister { if (this.mti >= this.N) { /* generate N words at one time */ for (kk = 0; kk < this.N - this.M; kk++) { - y = ((this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK)) - this.mt[kk] = (this.mt[kk + this.M] ^ (y >>> 1) ^ this.MAG01[y & 0x1]) + y = ((this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK)) + this.mt[kk] = (this.mt[kk + this.M] ^ (y >>> 1) ^ this.MAG01[y & 0x1]) } for (; kk < this.N - 1; kk++) { y = ((this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK)) diff --git a/lib/random/random.js b/lib/random/random.js index e98f91b..541891f 100644 --- a/lib/random/random.js +++ b/lib/random/random.js @@ -6,7 +6,6 @@ const MersenneTwister = require('./mersennetwister') const {logger} = require('../logging') class random { - /** * Must be called before any other methods can be called to initialize MersenneTwister. * @param {number|null|undefined} seed Value to initialize MersenneTwister. diff --git a/lib/utils/block.js b/lib/utils/block.js index b5d9f79..08c9d70 100644 --- a/lib/utils/block.js +++ b/lib/utils/block.js @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +const random = require('../random') const utils = require('../utils') class block extends utils { diff --git a/lib/utils/common.js b/lib/utils/common.js index cbb30fe..89be16e 100644 --- a/lib/utils/common.js +++ b/lib/utils/common.js @@ -1,7 +1,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - +const utils = require('../utils') class common extends utils { static objToString (obj) { diff --git a/lib/utils/index.js b/lib/utils/index.js index fe6f14c..77dd756 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -1,27 +1,27 @@ class utils { - static get common () { - return require('./common') - } + static get common () { + return require('./common') + } - static get block () { - return require('./block') - } + static get block () { + return require('./block') + } - static get mutate () { - return require('./mutate') - } + static get mutate () { + return require('./mutate') + } - static Objects () { - return require('./objects') - } + static Objects () { + return require('./objects') + } - static get platform () { - return require('./platform') - } + static get platform () { + return require('./platform') + } - static get script () { - return require('./script') - } + static get script () { + return require('./script') + } } module.exports = utils diff --git a/lib/utils/mutate.js b/lib/utils/mutate.js index 25730e6..f3739cd 100644 --- a/lib/utils/mutate.js +++ b/lib/utils/mutate.js @@ -61,4 +61,4 @@ class mutate extends utils { } } -module.exports = mutate \ No newline at end of file +module.exports = mutate diff --git a/lib/utils/objects.js b/lib/utils/objects.js index 4c5df16..d2f6e5c 100644 --- a/lib/utils/objects.js +++ b/lib/utils/objects.js @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +const random = require('../random') const utils = require('../utils') const {logger} = require('../logging') @@ -113,4 +114,4 @@ class Objects { } } -module.exports = Object +module.exports = {Objects, o} diff --git a/lib/utils/script.js b/lib/utils/script.js index 1f632c0..a0733fe 100644 --- a/lib/utils/script.js +++ b/lib/utils/script.js @@ -2,8 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const utils = require('../utils') const random = require('../random') +const make = require('../make') +const utils = require('../utils') +const {o} = require('../objects') class script extends utils { static methodHead (list, numOptional) { diff --git a/package.json b/package.json index ccde6a9..b443dd4 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,7 @@ "name": "octo", "version": "1.0.0", "description": "", - "keywords": [ - "fuzzing", - "browsers", - "javascript", - "node", - "library" - ], + "keywords": ["fuzzing", "browser", "javascript", "node", "library"], "homepage": "https://github.com/mozillasecurity/octo", "repository": { "type": "git", @@ -32,17 +26,7 @@ "standard": { "ignore": [ "tests/**", - "deploy/" - ], - "globals": [ - "random", - "make", - "utils", - "logger", - "MersenneTwister", - "o", - "btoa", - "atob" + "dist/" ], "envs": [ "browser" diff --git a/webpack.config.js b/webpack.config.js index 2e384a8..64dda53 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,14 +1,13 @@ const path = require('path') -const webpack = require("webpack") let config = { - entry: './lib/index.js', - output: { - filename: 'octo.js', - library: 'octo', - path: path.resolve(__dirname, 'dist'), - libraryTarget: 'var' - } + entry: './lib/index.js', + output: { + filename: 'octo.js', + library: 'octo', + path: path.resolve(__dirname, 'dist'), + libraryTarget: 'var' + } } -module.exports = config \ No newline at end of file +module.exports = config