From 33759d933986bad5681e261f5660e2074d6e9edc Mon Sep 17 00:00:00 2001 From: Mykola Bilochub Date: Thu, 18 Oct 2018 01:48:28 +0300 Subject: [PATCH] Use eslint-config-metarhia and fix linting issues Refs: https://github.com/metarhia/Metarhia/issues/22 --- .eslintrc.yml | 177 +------- lib/array.js | 18 +- lib/auth.js | 36 +- lib/callbacks.js | 62 ++- lib/fp.js | 27 +- lib/id.js | 40 +- lib/iterator.js | 1 + lib/mp.js | 18 +- lib/network.js | 9 +- lib/strings.js | 128 +++--- lib/time.js | 18 +- lib/units.js | 40 +- lib/utilities.js | 32 +- package-lock.json | 729 +++++++++++++++++++------------ package.json | 4 +- test/array.js | 8 +- test/auth.js | 102 ++--- test/cache.js | 8 +- test/callback.js | 20 +- test/curry.js | 22 +- test/curryN.js | 2 +- test/data.js | 14 +- test/either.js | 10 +- test/enum.js | 16 +- test/events.js | 12 +- test/id.js | 18 +- test/math.js | 14 +- test/mixin.js | 2 +- test/mp.js | 6 +- test/network.js | 2 +- test/omap.js | 4 +- test/partial.js | 2 +- test/replicate.js | 2 +- test/restLeft.js | 2 +- test/safe.js | 8 +- test/sort.js | 8 +- test/uint64.js | 4 +- test/utilities.js | 4 +- test/zip.js | 4 +- test/zipWith.js | 2 +- tools/unicode-category-parser.js | 6 +- 41 files changed, 808 insertions(+), 833 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 64a26d59..b327b9bf 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,176 +1 @@ -env: - node: true - es6: true -extends: 'eslint:recommended' -globals: - api: false - application: false - connection: false - impress: false -rules: - indent: - - error - - 2 - - SwitchCase: 1 - VariableDeclarator: - var: 2 - let: 2 - const: 1 - MemberExpression: 1 - linebreak-style: - - error - - unix - quotes: - - error - - single - semi: - - error - - always - eqeqeq: - - error - - always - no-loop-func: - - error - strict: - - error - - global - block-spacing: - - error - - always - brace-style: - - error - - 1tbs - - allowSingleLine: true - camelcase: - - error - comma-style: - - error - - last - comma-spacing: - - error - - before: false - after: true - eol-last: - - error - func-call-spacing: - - error - - never - key-spacing: - - error - - beforeColon: false - afterColon: true - mode: minimum - keyword-spacing: - - error - - before: true - after: true - overrides: - function: - after: false - max-len: - - error - - code: 80 - ignoreUrls: true - max-nested-callbacks: - - error - - max: 5 - new-cap: - - error - - newIsCap: true - capIsNew: true - properties: true - new-parens: - - error - no-lonely-if: - - error - no-trailing-spaces: - - error - no-unneeded-ternary: - - error - no-whitespace-before-property: - - error - object-curly-spacing: - - error - - always - operator-assignment: - - error - - always - operator-linebreak: - - error - - after - semi-spacing: - - error - - before: false - after: true - space-before-blocks: - - error - - always - space-before-function-paren: - - error - - never - space-in-parens: - - error - - never - space-infix-ops: - - error - space-unary-ops: - - error - - words: true - nonwords: false - overrides: - typeof: false - no-unreachable: - - error - no-global-assign: - - error - no-self-compare: - - error - no-unmodified-loop-condition: - - error - no-constant-condition: - - error - - checkLoops: false - no-console: - - off - no-useless-concat: - - error - no-useless-escape: - - error - no-shadow-restricted-names: - - error - no-use-before-define: - - error - - functions: false - arrow-body-style: - - error - - as-needed - arrow-spacing: - - error - no-confusing-arrow: - - error - - allowParens: true - no-useless-computed-key: - - error - no-useless-rename: - - error - no-var: - - error - object-shorthand: - - error - - always - prefer-arrow-callback: - - error - prefer-const: - - error - prefer-numeric-literals: - - error - prefer-rest-params: - - error - prefer-spread: - - error - rest-spread-spacing: - - error - - never - template-curly-spacing: - - error - - never +extends: 'metarhia' diff --git a/lib/array.js b/lib/array.js index e71eaf34..262df623 100644 --- a/lib/array.js +++ b/lib/array.js @@ -11,11 +11,10 @@ const splitAt = ( return [part1, part2]; }; -const shuffle = ( - // Shuffle an array - arr // array - // Returns: array -) => ( +// Shuffle an array +// arr - array +// Returns: array +const shuffle = arr => ( arr.sort(() => Math.random() - 0.5) ); @@ -59,11 +58,10 @@ const sequence = ( return res; }; -const last = ( - // Get last element of array - arr // array - // Returns: element -) => ( +// Get last element of array +// arr - array +// Returns: element +const last = arr => ( arr[arr.length - 1] ); diff --git a/lib/auth.js b/lib/auth.js index cda003e1..e6070209 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -41,20 +41,20 @@ const passwordTests = { MIN_LENGTH: { test: (password, options) => password.length >= options.minLength, hint: options => ({ name: 'MIN_LENGTH', minLength: options.minLength }), - options: { minLength: 10 } + options: { minLength: 10 }, }, MAX_LENGTH: { test: (password, options) => password.length <= options.maxLength, hint: options => ({ name: 'MAX_LENGTH', maxLength: options.maxLength }), - options: { maxLength: 128 } + options: { maxLength: 128 }, }, MIN_PASSPHRASE_LENGTH: { test: (password, options) => password.length >= options.minLength, hint: options => ({ name: 'MIN_PASSPHRASE_LENGTH', - minLength: options.minLength + minLength: options.minLength, }), - options: { minLength: 20 } + options: { minLength: 20 }, }, MAX_REPEATED_CHARS: { test: (password, options) => { @@ -62,21 +62,21 @@ const passwordTests = { return !regexp.test(password); }, hint: options => ({ name: 'MAX_REPEATED_CHARS', number: options.number }), - options: { number: 2 } + options: { number: 2 }, }, MIN_LOWERCASE_CHARS: { test: (password, option) => ( stringIncludesChars(password, unicodeCategories.Ll, option.number) ), hint: options => ({ name: 'MIN_LOWERCASE_CHARS', number: options.number }), - options: { number: 1 } + options: { number: 1 }, }, MIN_UPPERCASE_CHARS: { test: (password, options) => ( stringIncludesChars(password, unicodeCategories.Lu, options.number) ), hint: options => ({ name: 'MIN_UPPERCASE_CHARS', number: options.number }), - options: { number: 1 } + options: { number: 1 }, }, MIN_NUMBERS: { test: (password, options) => { @@ -84,7 +84,7 @@ const passwordTests = { return stringIncludesChars(password, NUMBERS_RANGE, options.number); }, hint: options => ({ name: 'MIN_NUMBERS', number: options.number }), - options: { number: 1 } + options: { number: 1 }, }, MIN_SPECIAL_CHARS: { test: (password, options) => { @@ -93,20 +93,20 @@ const passwordTests = { return stringIncludesChars(password, SPECIAL_CHARS_RANGE, options.number); }, hint: options => ({ name: 'MIN_SPECIAL_CHARS', number: options.number }), - options: { number: 1 } - } + options: { number: 1 }, + }, }; const loginTests = { MIN_LENGTH: { test: (login, options) => login.length >= options.minLength, hint: options => ({ name: 'MIN_LENGTH', minLength: options.minLength }), - options: { minLength: 6 } + options: { minLength: 6 }, }, MAX_LENGTH: { test: (login, options) => login.length <= options.maxLength, hint: options => ({ name: 'MAX_LENGTH', maxLength: options.maxLength }), - options: { maxLength: 50 } + options: { maxLength: 50 }, }, IS_EMAIL: { test: login => { @@ -123,9 +123,11 @@ const loginTests = { localPart.length <= MAX_LOCAL_PART_LENGTH && EMAIL_REGEXP.test(login); } + + return false; }, hint: () => ({ name: 'IS_EMAIL' }), - } + }, }; const loginPasswordTests = { @@ -136,7 +138,7 @@ const loginPasswordTests = { PASSWORD_INCLUDES_LOGIN: { test: (login, password) => !password.includes(login), hint: () => ({ name: 'PASSWORD_INCLUDES_LOGIN' }), - } + }, }; class AuthenticationStrength { @@ -220,7 +222,7 @@ const checkPassword = ( 'MIN_NUMBERS', 'MIN_SPECIAL_CHARS', 'MIN_UPPERCASE_CHARS', - 'MIN_LOWERCASE_CHARS' + 'MIN_LOWERCASE_CHARS', ]; } return makeTest(passwordTests, required, optional, password); @@ -237,7 +239,7 @@ const checkLoginPassword = ( if (!required) { required = [ 'PASSWORD_INCLUDES_LOGIN', - 'LOGIN_INCLUDES_PASSWORD' + 'LOGIN_INCLUDES_PASSWORD', ]; } return makeTest(loginPasswordTests, required, optional, login, password); @@ -246,5 +248,5 @@ const checkLoginPassword = ( module.exports = { checkLogin, checkPassword, - checkLoginPassword + checkLoginPassword, }; diff --git a/lib/callbacks.js b/lib/callbacks.js index fecb14cb..0796317c 100644 --- a/lib/callbacks.js +++ b/lib/callbacks.js @@ -18,10 +18,9 @@ const emptiness = ( // Returns: always undefined ) => {}; -const nop = ( - // Empty asynchronous callback-last single-argument function - callback // function, callback to be called with (null) -) => { +// Empty asynchronous callback-last single-argument function +// callback - function, callback to be called with (null) +const nop = callback => { callback(null); }; @@ -33,11 +32,10 @@ const noop = ( callback(null, null); }; -const once = ( - // Wrap function: call once, not null - fn // function (optional) - // Returns: function, wrapped callback -) => { +// Wrap function: call once, not null +// fn - function (optional) +// Returns: function, wrapped callback +const once = fn => { if (!fn) return emptiness; let finished = false; const wrap = (...args) => { @@ -48,46 +46,42 @@ const once = ( return wrap; }; -const unsafeCallback = ( - // Extract callback function - // It's unsafe: may return null, allows multiple calls - args // array, arguments - // Returns: function, callback or null - // Hint: previous name: `common.cbUnsafe` (deprecated) - // Hint: another alias: `common.extractCallback` (deprecated) -) => { +// Extract callback function +// It's unsafe: may return null, allows multiple calls +// args - array, arguments +// Returns: function, callback or null +// Hint: previous name: `common.cbUnsafe` (deprecated) +// Hint: another alias: `common.extractCallback` (deprecated) +const unsafeCallback = args => { const callback = last(args); if (typeof callback === 'function') return args.pop(); return null; }; -const safeCallback = ( - // Extract callback - args // array, arguments - // Returns: function, wrapped callback or common.emptiness if there is no one - // Hint: previous name: `cbExtract` (deprecated) -) => { +// Extract callback +// args - array, arguments +// Returns: function, wrapped callback or common.emptiness if there is no one +// Hint: previous name: `cbExtract` (deprecated) +const safeCallback = args => { const callback = last(args); if (typeof callback === 'function') return args.pop(); return emptiness; }; -const requiredCallback = ( - // Extract callback - args // array, arguments - // Returns: function or throw TypeError if there is no callback -) => { +// Extract callback +// args - array, arguments +// Returns: function or throw TypeError if there is no callback +const requiredCallback = args => { const callback = last(args); if (typeof callback === 'function') return args.pop(); throw new TypeError('No callback provided'); }; -const onceCallback = ( - // Extract callback and make it safe - // Wrap callback with once() - args // array, arguments - // Returns: function, callback or common.emptiness if there is no callback -) => { +// Extract callback and make it safe +// Wrap callback with once() +// args - array, arguments +// Returns: function, callback or common.emptiness if there is no callback +const onceCallback = args => { const callback = last(args); if (typeof callback === 'function') return once(args.pop()); return emptiness; diff --git a/lib/fp.js b/lib/fp.js index bf9bdd89..f973885d 100644 --- a/lib/fp.js +++ b/lib/fp.js @@ -135,11 +135,10 @@ const curryN = ( return curryUntil(condition, fn, ...args); }; -const curryTwice = ( - // Curry function curry with fn - fn // function, to be curried - // Returns: function, to pass arguments that returns curried fn -) => curry(curry, fn); +// Curry function curry with fn +// fn - function, to be curried +// Returns: function, to pass arguments that returns curried fn +const curryTwice = fn => curry(curry, fn); const applyArgs = ( // Apply arguments @@ -147,11 +146,10 @@ const applyArgs = ( // Returns: function, to pass (fn) arguments will be applied ) => fn => fn(...args); -const either = ( - // Get first not errored result of fn - fn // function, to be called - // Returns: result of `fn` -) => ( +// Get first not errored result of fn +// fn - function, to be called +// Returns: result of `fn` +const either = fn => ( ...args // arguments to iterate ) => { let lastError; @@ -165,11 +163,10 @@ const either = ( throw lastError; }; -const restLeft = ( - // Rest left, transform function - fn // function, (args, arg1..argN, callback) - // Returns: function, (arg1..argN, ...args, callback) -) => (...spreadArgs) => { +// Rest left, transform function +// fn - function, (args, arg1..argN, callback) +// Returns: function, (arg1..argN, ...args, callback) +const restLeft = fn => (...spreadArgs) => { const callback = safeCallback(spreadArgs); const namedArgsCount = fn.length - 2; const namedArgs = spreadArgs.slice(0, namedArgsCount); diff --git a/lib/id.js b/lib/id.js index 03895db7..706e49dd 100644 --- a/lib/id.js +++ b/lib/id.js @@ -48,7 +48,7 @@ const generateGUID = ( bytes.toString('hex', 4, 6), bytes.toString('hex', 6, 8), bytes.toString('hex', 8, 10), - bytes.toString('hex', 10, 16) + bytes.toString('hex', 10, 16), ].join('-'); }; @@ -65,11 +65,10 @@ const crcSID = ( .substring(0, 4) ); -const generateSID = ( - // Generate random SID - config // record, { length, characters, secret } - // Returns: string, SID -) => { +// Generate random SID +// config - record, { length, characters, secret } +// Returns: string, SID +const generateSID = config => { const key = generateKey( config.length - 4, config.characters @@ -109,11 +108,10 @@ const validateHash = ( // Returns: boolean ) => (hash(password, salt) === hash); -const idToChunks = ( - // Convert id to array of hex strings - id // number - // Returns: array, minimal length is 2 -) => { +// Convert id to array of hex strings +// id - number +// Returns: array, minimal length is 2 +const idToChunks = id => { let hex = id.toString(16); const remainder = hex.length % 4; if (remainder !== 0) { @@ -133,21 +131,19 @@ const idToChunks = ( return chunks; }; -const idToPath = ( - // Convert id to file path - id // number - // Returns: string -) => { +// Convert id to file path +// id - number +// Returns: string +const idToPath = id => { const chunks = idToChunks(id); const path = chunks.join('/'); return path; }; -const pathToId = ( - // Convert file path to id - path // string - // Returns: number -) => { +// Convert file path to id +// path - string +// Returns: number +const pathToId = path => { const chunks = path.split('/'); let hex = '0x'; for (let i = chunks.length - 1; i >= 0; i--) { @@ -167,5 +163,5 @@ module.exports = { generateStorageKey, idToChunks, idToPath, - pathToId + pathToId, }; diff --git a/lib/iterator.js b/lib/iterator.js index 7f379226..ef92a776 100644 --- a/lib/iterator.js +++ b/lib/iterator.js @@ -55,6 +55,7 @@ class Iterator { return value; } } + return undefined; } includes(element) { diff --git a/lib/mp.js b/lib/mp.js index c243259f..13385191 100644 --- a/lib/mp.js +++ b/lib/mp.js @@ -1,10 +1,9 @@ 'use strict'; -const methods = ( - // List method names - iface // object, to be introspected - // Returns: array of strings, method names -) => { +// List method names +// iface - object, to be introspected +// Returns: array of strings, method names +const methods = iface => { const names = []; for (const name in iface) { if (typeof iface[name] === 'function') { @@ -14,11 +13,10 @@ const methods = ( return names; }; -const properties = ( - // List property names - iface // object, to be introspected - // Returns: array of string, property names -) => { +// List property names +// iface - object, to be introspected +// Returns: array of string, property names +const properties = iface => { const names = []; for (const name in iface) { if (typeof iface[name] !== 'function') { diff --git a/lib/network.js b/lib/network.js index fd947367..b1498abf 100644 --- a/lib/network.js +++ b/lib/network.js @@ -33,11 +33,10 @@ const localIPs = ( return ips; }; -const parseHost = ( - // Parse host string - host // string, host or empty string, may contain `:port` - // Returns: string, host without port but not empty -) => { +// Parse host string +// host - string, host or empty string, may contain `:port` +// Returns: string, host without port but not empty +const parseHost = host => { if (!host) { return 'no-host-name-in-http-headers'; } diff --git a/lib/strings.js b/lib/strings.js index 0678a8d4..8cea9955 100644 --- a/lib/strings.js +++ b/lib/strings.js @@ -8,7 +8,7 @@ const { nowDateTime } = require('./time'); const HTML_ESCAPE_REGEXP = new RegExp('[&<>"\'/]', 'g'); const HTML_ESCAPE_CHARS = { - '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''' + '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''', }; const ALPHA_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; @@ -17,12 +17,11 @@ const ALPHA = ALPHA_UPPER + ALPHA_LOWER; const DIGIT = '0123456789'; const ALPHA_DIGIT = ALPHA + DIGIT; -const htmlEscape = ( - // Escape html characters - content // string, to escape - // Returns: string - // Example: htmlEscape('5>=5') = '5<=5' -) => ( +// Escape html characters +// content - string, to escape +// Returns: string +// Example: htmlEscape('5>=5') = '5<=5' +const htmlEscape = content => ( content.replace(HTML_ESCAPE_REGEXP, char => HTML_ESCAPE_CHARS[char]) ); @@ -88,45 +87,41 @@ const subst = ( return result; }; -const fileExt = ( - // Extract file extension in lower case with no dot - fileName // string, file name - // Returns: string - // Example: fileExt('/dir/file.txt') - // Result: 'txt' -) => ( +// Extract file extension in lower case with no dot +// fileName - string, file name +// Returns: string +// Example: fileExt('/dir/file.txt') +// Result: 'txt' +const fileExt = fileName => ( path.extname(fileName).replace('.', '').toLowerCase() ); -const removeExt = ( - // Remove file extension from file name - fileName // string, file name - // Returns: string - // Example: fileExt('file.txt') - // Result: 'file' -) => ( +// Remove file extension from file name +// fileName - string, file name +// Returns: string +// Example: fileExt('file.txt') +// Result: 'file' +const removeExt = fileName => ( fileName.substr(0, fileName.lastIndexOf('.')) ); const CAPITALIZE_REGEXP = /\w+/g; -const capitalize = ( - // Capitalize string - s // string - // Returns: string -) => ( - s.replace(CAPITALIZE_REGEXP, (word) => ( +// Capitalize string +// s - string +// Returns: string +const capitalize = s => ( + s.replace(CAPITALIZE_REGEXP, word => ( word.charAt(0).toUpperCase() + word.substr(1).toLowerCase() )) ); const UNDERLINE_REGEXP = /_/g; -const spinalToCamel = ( - // Convert spinal case to camel case - name // string - // Returns: string -) => ( +// Convert spinal case to camel case +// name - string +// Returns: string +const spinalToCamel = name => ( name .replace(UNDERLINE_REGEXP, '-') .split('-') @@ -138,49 +133,44 @@ const ESCAPE_REGEXP_SPECIALS = [ // order matters for these '-', '[', ']', // order doesn't matter for any of these - '/', '{', '}', '(', ')', '*', '+', '?', '.', '\\', '^', '$', '|' + '/', '{', '}', '(', ')', '*', '+', '?', '.', '\\', '^', '$', '|', ]; const ESCAPE_REGEXP = new RegExp( '[' + ESCAPE_REGEXP_SPECIALS.join('\\') + ']', 'g' ); -const escapeRegExp = ( - // Escape regular expression control characters - s // string - // Returns: string - // Example: escapeRegExp('/path/to/res?search=this.that') -) => ( +// Escape regular expression control characters +// s - string +// Returns: string +// Example: escapeRegExp('/path/to/res?search=this.that') +const escapeRegExp = s => ( s.replace(ESCAPE_REGEXP, '\\$&') ); -const newEscapedRegExp = ( - // Generate escaped regular expression - s // string - // Returns: RegExp, instance -) => ( +// Generate escaped regular expression +// s - string +// Returns: RegExp, instance +const newEscapedRegExp = s => ( new RegExp(escapeRegExp(s), 'g') ); -const addTrailingSlash = ( - // Add trailing slash at the end if there isn't one - s // string - // Returns: string -) => s + (s.endsWith('/') ? '' : '/'); +// Add trailing slash at the end if there isn't one +// s - string +// Returns: string +const addTrailingSlash = s => s + (s.endsWith('/') ? '' : '/'); -const stripTrailingSlash = ( - // Remove trailing slash from string - s // string - // Returns: string -) => ( +// Remove trailing slash from string +// s - string +// Returns: string +const stripTrailingSlash = s => ( s.endsWith('/') ? s.substr(0, s.length - 1) : s ); -const dirname = ( - // Get directory name with trailing slash from path - filePath // string - // Returns: string -) => { +// Get directory name with trailing slash from path +// filePath - string +// Returns: string +const dirname = filePath => { let dir = path.dirname(filePath); if (dir !== '/') dir += '/'; return dir; @@ -206,22 +196,20 @@ const between = ( const BOM_REGEXP = /^[\uBBBF\uFEFF]*/; -const removeBOM = ( - // Remove UTF-8 BOM - s // string, possibly starts with BOM - // Returns: string -) => ( +// Remove UTF-8 BOM +// s - string, possibly starts with BOM +// Returns: string +const removeBOM = s => ( typeof s === 'string' ? s.replace(BOM_REGEXP, '') : s ); const ITEM_ESCAPE_REGEXP = /\\\*/g; -const arrayRegExp = ( - // Generate RegExp from array with '*' wildcards - items // array of strings - // Returns: RegExp, instance - // Example: ['/css/*', '/index.html'] -) => { +// Generate RegExp from array with '*' wildcards +// items - array of strings +// Returns: RegExp, instance +// Example: ['/css/*', '/index.html'] +const arrayRegExp = items => { if (!items || items.length === 0) return null; items = items.map( item => escapeRegExp(item).replace(ITEM_ESCAPE_REGEXP, '.*') diff --git a/lib/time.js b/lib/time.js index e01140aa..1552ab22 100644 --- a/lib/time.js +++ b/lib/time.js @@ -12,11 +12,10 @@ const isTimeEqual = ( const pad2 = n => (n < 10 ? '0' + n : '' + n); -const nowDate = ( - // Get current date in YYYY-MM-DD format - date // Date (optional), now by default - // Returns: string -) => { +// Get current date in YYYY-MM-DD format +// date - Date (optional), now by default +// Returns: string +const nowDate = date => { if (!date) date = new Date(); return ( date.getUTCFullYear() + '-' + @@ -25,11 +24,10 @@ const nowDate = ( ); }; -const nowDateTime = ( - // Get current date in YYYY-MM-DD hh:mm format - date // Date (optional), now by default - // Returns: string -) => { +// Get current date in YYYY-MM-DD hh:mm format +// date - Date (optional), now by default +// Returns: string +const nowDateTime = date => { if (!date) date = new Date(); return ( date.getUTCFullYear() + '-' + diff --git a/lib/units.js b/lib/units.js index 09c41133..ffba4caa 100644 --- a/lib/units.js +++ b/lib/units.js @@ -7,12 +7,11 @@ const DURATION_UNITS = { s: 1, // seconds }; -const duration = ( - // Parse duration to seconds - s // string, duration syntax - // Returns: number, milliseconds - // Example: duration('1d 10h 7m 13s') -) => { +// Parse duration to seconds +// s - string, duration syntax +// Returns: number, milliseconds +// Example: duration('1d 10h 7m 13s') +const duration = s => { if (typeof s === 'number') return s; if (typeof s !== 'string') return 0; let result = 0; @@ -32,11 +31,10 @@ const UNITS_MAX_DURATION = { h: 24, // hours }; -const durationToString = ( - // Convert integer duration to string - n // number, duration - // Returns: string -) => { +// Convert integer duration to string +// n - number, duration +// Returns: string +const durationToString = n => { if (typeof n !== 'number' || !n) return '0s'; n = Math.floor(n / 1000); const parts = []; @@ -51,14 +49,13 @@ const durationToString = ( }; const SIZE_UNITS = [ - '', ' Kb', ' Mb', ' Gb', ' Tb', ' Pb', ' Eb', ' Zb', ' Yb' + '', ' Kb', ' Mb', ' Gb', ' Tb', ' Pb', ' Eb', ' Zb', ' Yb', ]; -const bytesToSize = ( - // Convert integer to string, representing data size in Kb, Mb, Gb, and Tb - bytes // number, size - // Returns: string -) => { +// Convert integer to string, representing data size in Kb, Mb, Gb, and Tb +// bytes - number, size +// Returns: string +const bytesToSize = bytes => { if (bytes === 0) return '0'; const exp = Math.floor(Math.log(bytes) / Math.log(1000)); const size = bytes / Math.pow(1000, exp); @@ -78,11 +75,10 @@ const UNIT_SIZES = { kb: 3, // kilobyte }; -const sizeToBytes = ( - // Convert string with data size to integer - size // string, size - // Returns: number -) => { +// Convert string with data size to integer +// size - string, size +// Returns: number +const sizeToBytes = size => { if (typeof size === 'number') return size; const [num, unit] = size.toLowerCase().split(' '); const exp = UNIT_SIZES[unit]; diff --git a/lib/utilities.js b/lib/utilities.js index 74710038..8680f432 100644 --- a/lib/utilities.js +++ b/lib/utilities.js @@ -4,11 +4,10 @@ const { basename } = require('path'); const { between } = require('./strings'); -const deprecate = ( - // Wrap method to mark it as deprecated - fn // function (optional) - // Returns: function, wrapped with deprecation warning -) => { +// Wrap method to mark it as deprecated +// fn - function (optional) +// Returns: function, wrapped with deprecation warning +const deprecate = fn => { let warned = false; const wrap = (...args) => { if (!warned) { @@ -21,11 +20,10 @@ const deprecate = ( return wrap; }; -const alias = ( - // Wrap new method to mark old alias as deprecated - fn // function (optional) - // Returns: function, wrapped with deprecation warning -) => { +// Wrap new method to mark old alias as deprecated +// fn - function (optional) +// Returns: function, wrapped with deprecation warning +const alias = fn => { let warned = false; const wrap = (...args) => { if (!warned) { @@ -41,11 +39,10 @@ const alias = ( return wrap; }; -const safe = ( - // Make function raise-safe - fn // function - // Returns: function, wrapped with try/catch interception -) => (...args) => { +// Make function raise-safe +// fn - function +// Returns: function, wrapped with try/catch interception +const safe = fn => (...args) => { try { return [null, fn(...args)]; } catch (err) { @@ -77,10 +74,11 @@ const callerFilepath = (depth = 0, stack = null) => { const end = frame.indexOf(':', start + 1); return frame.substring(start + 1, end); } + return ''; }; -const callerFilename = (depth = 0, stack = null) => - basename(callerFilepath(depth + 1, stack) || ''); +const callerFilename = + (depth = 0, stack = null) => basename(callerFilepath(depth + 1, stack) || ''); module.exports = { deprecate, diff --git a/package-lock.json b/package-lock.json index fd5313a0..2fcf99eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1012,20 +1012,12 @@ } }, "acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-4.1.1.tgz", + "integrity": "sha512-JY+iV6r+cO21KtntVvFkD+iqjtdpRUpGqKWgfkCdZq1R+kbreEl8EcdcJR4SmiIgsIQT33s6QzheQ9a275Q8xw==", "dev": true, "requires": { - "acorn": "^3.0.4" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "dev": true - } + "acorn": "^5.0.3" } }, "after": { @@ -1039,6 +1031,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, + "optional": true, "requires": { "co": "^4.6.0", "fast-deep-equal": "^1.0.0", @@ -1046,12 +1039,6 @@ "json-schema-traverse": "^0.3.0" } }, - "ajv-keywords": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", - "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", - "dev": true - }, "ansi-escapes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", @@ -1059,16 +1046,19 @@ "dev": true }, "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } }, "anymatch": { "version": "2.0.0", @@ -1265,17 +1255,6 @@ "dev": true, "optional": true }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -1610,6 +1589,12 @@ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", @@ -1695,22 +1680,20 @@ "optional": true }, "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, "chokidar": { @@ -1807,7 +1790,8 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true + "dev": true, + "optional": true }, "collection-visit": { "version": "1.0.0", @@ -1934,6 +1918,12 @@ "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", "dev": true }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true + }, "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", @@ -2025,12 +2015,14 @@ } }, "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { - "lru-cache": "^4.0.1", + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" } @@ -2423,6 +2415,15 @@ "prr": "~1.0.1" } }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, "es5-ext": { "version": "0.10.46", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.46.tgz", @@ -2475,122 +2476,200 @@ "dev": true }, "eslint": { - "version": "4.19.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz", - "integrity": "sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.7.0.tgz", + "integrity": "sha512-zYCeFQahsxffGl87U2aJ7DPyH8CbWgxBC213Y8+TCanhUTf2gEvfq3EKpHmEcozTLyPmGe9LZdMAwC/CpJBM5A==", "dev": true, "requires": { - "ajv": "^5.3.0", - "babel-code-frame": "^6.22.0", + "@babel/code-frame": "^7.0.0", + "ajv": "^6.5.3", "chalk": "^2.1.0", - "concat-stream": "^1.6.0", - "cross-spawn": "^5.1.0", - "debug": "^3.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", "doctrine": "^2.1.0", - "eslint-scope": "^3.7.1", + "eslint-scope": "^4.0.0", + "eslint-utils": "^1.3.1", "eslint-visitor-keys": "^1.0.0", - "espree": "^3.5.4", - "esquery": "^1.0.0", + "espree": "^4.0.0", + "esquery": "^1.0.1", "esutils": "^2.0.2", "file-entry-cache": "^2.0.0", "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", - "globals": "^11.0.1", - "ignore": "^3.3.3", + "globals": "^11.7.0", + "ignore": "^4.0.6", "imurmurhash": "^0.1.4", - "inquirer": "^3.0.6", - "is-resolvable": "^1.0.0", - "js-yaml": "^3.9.1", + "inquirer": "^6.1.0", + "is-resolvable": "^1.1.0", + "js-yaml": "^3.12.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", - "lodash": "^4.17.4", - "minimatch": "^3.0.2", + "lodash": "^4.17.5", + "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", "optionator": "^0.8.2", "path-is-inside": "^1.0.2", "pluralize": "^7.0.0", "progress": "^2.0.0", - "regexpp": "^1.0.1", + "regexpp": "^2.0.1", "require-uncached": "^1.0.3", - "semver": "^5.3.0", + "semver": "^5.5.1", "strip-ansi": "^4.0.0", - "strip-json-comments": "~2.0.1", - "table": "4.0.2", - "text-table": "~0.2.0" + "strip-json-comments": "^2.0.1", + "table": "^5.0.2", + "text-table": "^0.2.0" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ms": "^2.1.1" } }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + } + } + }, + "eslint-config-metarhia": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-metarhia/-/eslint-config-metarhia-5.0.0.tgz", + "integrity": "sha512-m5duvNQiqeco7uQZYyTkZPUW6kNzsPexTW4Roo0GE+hTayJLEQlhKKLDZlbqhKEjg1nobSwUTN9NV6x+p3x6WQ==", + "dev": true + }, + "eslint-import-resolver-node": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", + "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "resolve": "^1.5.0" + } + }, + "eslint-module-utils": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz", + "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=", + "dev": true, + "requires": { + "debug": "^2.6.8", + "pkg-dir": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "ms": "2.0.0" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" } }, - "globals": { - "version": "11.7.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", - "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "pinkie-promise": "^2.0.0" } }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "pkg-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", + "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", "dev": true, "requires": { - "has-flag": "^3.0.0" + "find-up": "^1.0.0" + } + } + } + }, + "eslint-plugin-import": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz", + "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==", + "dev": true, + "requires": { + "contains-path": "^0.1.0", + "debug": "^2.6.8", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.1", + "eslint-module-utils": "^2.2.0", + "has": "^1.0.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.3", + "read-pkg-up": "^2.0.0", + "resolve": "^1.6.0" + }, + "dependencies": { + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" } } } }, "eslint-scope": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.3.tgz", - "integrity": "sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", "dev": true, "requires": { "esrecurse": "^4.1.0", "estraverse": "^4.1.1" } }, + "eslint-utils": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", + "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", + "dev": true + }, "eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", @@ -2598,13 +2677,13 @@ "dev": true }, "espree": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", - "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-4.0.0.tgz", + "integrity": "sha512-kapdTCt1bjmspxStVKX6huolXVV5ZfyZguY1lcfhVVZstce3bqxH9mcLzNn3/mlgW6wQ732+0fuG9v7h0ZQoKg==", "dev": true, "requires": { - "acorn": "^5.5.0", - "acorn-jsx": "^3.0.0" + "acorn": "^5.6.0", + "acorn-jsx": "^4.1.1" } }, "esprima": { @@ -2780,14 +2859,25 @@ } }, "external-editor": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", "dev": true, "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", "tmp": "^0.0.33" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } } }, "extglob": { @@ -2878,7 +2968,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", - "dev": true + "dev": true, + "optional": true }, "fast-json-stable-stringify": { "version": "2.0.0", @@ -3151,7 +3242,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3172,12 +3264,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3192,17 +3286,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3319,7 +3416,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3331,6 +3429,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3345,6 +3444,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3352,12 +3452,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -3376,6 +3478,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3456,7 +3559,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3468,6 +3572,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3553,7 +3658,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3589,6 +3695,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3608,6 +3715,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3651,12 +3759,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -3767,13 +3877,13 @@ "har-schema": "^2.0.0" } }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "function-bind": "^1.1.1" } }, "has-binary2": { @@ -3885,6 +3995,12 @@ "minimalistic-crypto-utils": "^1.0.1" } }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, "http-errors": { "version": "1.6.3", "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", @@ -3948,9 +4064,9 @@ "dev": true }, "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, "imurmurhash": { @@ -3982,71 +4098,24 @@ "dev": true }, "inquirer": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", "dev": true, "requires": { "ansi-escapes": "^3.0.0", "chalk": "^2.0.0", "cli-cursor": "^2.1.0", "cli-width": "^2.0.0", - "external-editor": "^2.0.4", + "external-editor": "^3.0.0", "figures": "^2.0.0", - "lodash": "^4.3.0", + "lodash": "^4.17.10", "mute-stream": "0.0.7", "run-async": "^2.2.0", - "rx-lite": "^4.0.8", - "rx-lite-aggregates": "^4.0.8", + "rxjs": "^6.1.0", "string-width": "^2.1.0", "strip-ansi": "^4.0.0", "through": "^2.3.6" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } } }, "invariant": { @@ -4078,6 +4147,12 @@ } } }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, "is-binary-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", @@ -4093,6 +4168,15 @@ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -4336,7 +4420,8 @@ "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true + "dev": true, + "optional": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -4523,6 +4608,18 @@ "type-check": "~0.3.2" } }, + "load-json-file": { + "version": "2.0.0", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, "loader-runner": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.1.tgz", @@ -5004,6 +5101,12 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, "node-libs-browser": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", @@ -5044,6 +5147,18 @@ "semver": "^5.3.0" } }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, "normalize-path": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", @@ -5282,6 +5397,15 @@ "pbkdf2": "^3.0.3" } }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, "parseqs": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", @@ -5342,12 +5466,27 @@ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, "pbkdf2": { "version": "3.0.17", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", @@ -5469,9 +5608,9 @@ "dev": true }, "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz", + "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==", "dev": true }, "promise-inflight": { @@ -5600,6 +5739,27 @@ "unpipe": "1.0.0" } }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + }, "readable-stream": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", @@ -5668,9 +5828,9 @@ } }, "regexpp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz", - "integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, "regexpu-core": { @@ -5863,19 +6023,13 @@ "aproba": "^1.1.1" } }, - "rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", - "dev": true - }, - "rx-lite-aggregates": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", - "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "rxjs": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", + "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", "dev": true, "requires": { - "rx-lite": "*" + "tslib": "^1.9.0" } }, "safe-buffer": { @@ -6270,6 +6424,38 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, + "spdx-correct": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz", + "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", + "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", + "dev": true + }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -6415,23 +6601,6 @@ "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } } }, "string_decoder": { @@ -6444,14 +6613,20 @@ } }, "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "^3.0.0" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -6459,53 +6634,49 @@ "dev": true }, "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } }, "table": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", - "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/table/-/table-5.1.0.tgz", + "integrity": "sha512-e542in22ZLhD/fOIuXs/8yDZ9W61ltF8daM88rkRNtgTIct+vI2fTnAyu/Db2TCfEcI8i7mjZz6meLq0nW7TYg==", "dev": true, "requires": { - "ajv": "^5.2.3", - "ajv-keywords": "^2.1.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", + "ajv": "^6.5.3", + "lodash": "^4.17.10", "slice-ansi": "1.0.0", "string-width": "^2.1.1" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true } } }, @@ -6530,7 +6701,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -6978,6 +7149,16 @@ "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", "dev": true }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", diff --git a/package.json b/package.json index bf431445..ad185ca9 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "@babel/cli": "^7.1.2", "@babel/core": "^7.1.2", "@babel/preset-env": "^7.1.0", - "eslint": "^4.19.1", + "eslint": "^5.7.0", + "eslint-config-metarhia": "^5.0.0", + "eslint-plugin-import": "^2.14.0", "metaschema": "^0.0.21", "metasync": "^0.3.29", "metatests": "^0.2.1" diff --git a/test/array.js b/test/array.js index 46333548..3a2aa08b 100644 --- a/test/array.js +++ b/test/array.js @@ -34,9 +34,9 @@ metatests.case('Common / array', { common }, { [[40, [-3]], 6, [40, 41, 42]], ], 'common.shuffle': [ - [[1, 2, 3], (result) => (JSON.stringify(result.sort()) === '[1,2,3]') ], - [['a', 'b'], (result) => (JSON.stringify(result.sort()) === '["a","b"]')], - [[1, 'a', 3], (result) => (JSON.stringify(result.sort()) === '[1,3,"a"]')], - [[], (result) => (JSON.stringify(result.sort()) === '[]') ], + [[1, 2, 3], result => (JSON.stringify(result.sort()) === '[1,2,3]') ], + [['a', 'b'], result => (JSON.stringify(result.sort()) === '["a","b"]')], + [[1, 'a', 3], result => (JSON.stringify(result.sort()) === '[1,3,"a"]')], + [[], result => (JSON.stringify(result.sort()) === '[]') ], ], }); diff --git a/test/auth.js b/test/auth.js index ccc6f8e1..f100bef6 100644 --- a/test/auth.js +++ b/test/auth.js @@ -3,13 +3,13 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('test checkPassword / MIN_LENGTH', (test) => { +metatests.test('test checkPassword / MIN_LENGTH', test => { const password = 'password'; const passedResult = common.checkPassword(password, [ - { name: 'MIN_LENGTH', minLength: password.length } + { name: 'MIN_LENGTH', minLength: password.length }, ]); const failedResult = common.checkPassword(password, [ - { name: 'MIN_LENGTH', minLength: password.length + 1 } + { name: 'MIN_LENGTH', minLength: password.length + 1 }, ]); test.strictSame(passedResult.valid, true); @@ -17,13 +17,13 @@ metatests.test('test checkPassword / MIN_LENGTH', (test) => { test.end(); }); -metatests.test('test checkPassword / MAX_LENGTH', (test) => { +metatests.test('test checkPassword / MAX_LENGTH', test => { const password = 'password'; const passedResult = common.checkPassword(password, [ - { name: 'MAX_LENGTH', maxLength: password.length } + { name: 'MAX_LENGTH', maxLength: password.length }, ]); const failedResult = common.checkPassword(password, [ - { name: 'MAX_LENGTH', maxLength: password.length - 1 } + { name: 'MAX_LENGTH', maxLength: password.length - 1 }, ]); test.strictSame(passedResult.valid, true); @@ -31,13 +31,13 @@ metatests.test('test checkPassword / MAX_LENGTH', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_PASSPHRASE_LENGTH', (test) => { +metatests.test('test checkPassword / MIN_PASSPHRASE_LENGTH', test => { const password = 'password'; const passedResult = common.checkPassword(password, [ - { name: 'MIN_PASSPHRASE_LENGTH', minLength: password.length } + { name: 'MIN_PASSPHRASE_LENGTH', minLength: password.length }, ]); const failedResult = common.checkPassword(password, [ - { name: 'MIN_PASSPHRASE_LENGTH', minLength: password.length + 1 } + { name: 'MIN_PASSPHRASE_LENGTH', minLength: password.length + 1 }, ]); test.strictSame(passedResult.valid, true); @@ -45,19 +45,19 @@ metatests.test('test checkPassword / MIN_PASSPHRASE_LENGTH', (test) => { test.end(); }); -metatests.test('test checkPassword / MAX_REPEATED_CHARS', (test) => { +metatests.test('test checkPassword / MAX_REPEATED_CHARS', test => { const password = 'password'; const passedResult = common.checkPassword(password, [ { name: 'MAX_REPEATED_CHARS', - number: 2 - } + number: 2, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MAX_REPEATED_CHARS', - number: 1 - } + number: 1, + }, ]); test.strictSame(passedResult.valid, true); @@ -65,19 +65,19 @@ metatests.test('test checkPassword / MAX_REPEATED_CHARS', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_LOWERCASE_CHARS', (test) => { +metatests.test('test checkPassword / MIN_LOWERCASE_CHARS', test => { const password = 'PASSword𞥃'; const passedResult = common.checkPassword(password, [ { name: 'MIN_LOWERCASE_CHARS', - number: 5 - } + number: 5, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MIN_LOWERCASE_CHARS', - number: 6 - } + number: 6, + }, ]); test.strictSame(passedResult.valid, true); @@ -85,19 +85,19 @@ metatests.test('test checkPassword / MIN_LOWERCASE_CHARS', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_UPPERCASE_CHARS', (test) => { +metatests.test('test checkPassword / MIN_UPPERCASE_CHARS', test => { const password = 'PASSword𞤡'; const passedResult = common.checkPassword(password, [ { name: 'MIN_UPPERCASE_CHARS', - number: 5 - } + number: 5, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MIN_UPPERCASE_CHARS', - number: 6 - } + number: 6, + }, ]); test.strictSame(passedResult.valid, true); @@ -105,19 +105,19 @@ metatests.test('test checkPassword / MIN_UPPERCASE_CHARS', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_NUMBERS', (test) => { +metatests.test('test checkPassword / MIN_NUMBERS', test => { const password = 'pa123ss45'; const passedResult = common.checkPassword(password, [ { name: 'MIN_NUMBERS', - number: 5 - } + number: 5, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MIN_NUMBERS', - number: 6 - } + number: 6, + }, ]); test.strictSame(passedResult.valid, true); @@ -125,19 +125,19 @@ metatests.test('test checkPassword / MIN_NUMBERS', (test) => { test.end(); }); -metatests.test('test checkPassword / MIN_SPECIAL_CHARS', (test) => { +metatests.test('test checkPassword / MIN_SPECIAL_CHARS', test => { const password = 'pa!#ss&*'; const passedResult = common.checkPassword(password, [ { name: 'MIN_SPECIAL_CHARS', - number: 4 - } + number: 4, + }, ]); const failedResult = common.checkPassword(password, [ { name: 'MIN_SPECIAL_CHARS', - number: 5 - } + number: 5, + }, ]); test.strictSame(passedResult.valid, true); @@ -145,13 +145,13 @@ metatests.test('test checkPassword / MIN_SPECIAL_CHARS', (test) => { test.end(); }); -metatests.test('test checkLogin / MIN_LENGTH', (test) => { +metatests.test('test checkLogin / MIN_LENGTH', test => { const login = 'login'; const passedResult = common.checkLogin(login, [ - { name: 'MIN_LENGTH', minLength: login.length } + { name: 'MIN_LENGTH', minLength: login.length }, ]); const failedResult = common.checkLogin(login, [ - { name: 'MIN_LENGTH', minLength: login.length + 1 } + { name: 'MIN_LENGTH', minLength: login.length + 1 }, ]); test.strictSame(passedResult.valid, true); @@ -159,13 +159,13 @@ metatests.test('test checkLogin / MIN_LENGTH', (test) => { test.end(); }); -metatests.test('test checkLogin / MAX_LENGTH', (test) => { +metatests.test('test checkLogin / MAX_LENGTH', test => { const login = 'login'; const passedResult = common.checkLogin(login, [ - { name: 'MAX_LENGTH', maxLength: login.length } + { name: 'MAX_LENGTH', maxLength: login.length }, ]); const failedResult = common.checkLogin(login, [ - { name: 'MAX_LENGTH', maxLength: login.length - 1 } + { name: 'MAX_LENGTH', maxLength: login.length - 1 }, ]); test.strictSame(passedResult.valid, true); @@ -173,10 +173,10 @@ metatests.test('test checkLogin / MAX_LENGTH', (test) => { test.end(); }); -metatests.test('test checkLogin / IS_EMAIL', (test) => { +metatests.test('test checkLogin / IS_EMAIL', test => { const emails = [ 'local-part@domain', - 'l@dom' + 'l@dom', ]; emails.forEach(email => { const passedResult = common.checkLogin(email, ['IS_EMAIL']); @@ -189,7 +189,7 @@ metatests.test('test checkLogin / IS_EMAIL', (test) => { 'local-part@do', '@domain', 'l'.repeat(65) + '@domain', - 'local-part@' + 'd'.repeat(256) + 'local-part@' + 'd'.repeat(256), ]; invalidEmails.forEach(invalidEmail => { const failedResult = common.checkLogin(invalidEmail, ['IS_EMAIL']); @@ -198,12 +198,12 @@ metatests.test('test checkLogin / IS_EMAIL', (test) => { test.end(); }); -metatests.test('test checkLoginPassword / LOGIN_INCLUDES_PASSWORD', (test) => { +metatests.test('test checkLoginPassword / LOGIN_INCLUDES_PASSWORD', test => { const passedResult = common.checkLoginPassword('login', 'password', [ - 'LOGIN_INCLUDES_PASSWORD' + 'LOGIN_INCLUDES_PASSWORD', ]); const failedResult = common.checkLoginPassword('loginpassword', 'password', [ - 'LOGIN_INCLUDES_PASSWORD' + 'LOGIN_INCLUDES_PASSWORD', ]); test.strictSame(passedResult.valid, true); @@ -211,12 +211,12 @@ metatests.test('test checkLoginPassword / LOGIN_INCLUDES_PASSWORD', (test) => { test.end(); }); -metatests.test('test checkLoginPassword / PASSWORD_INCLUDES_LOGIN', (test) => { +metatests.test('test checkLoginPassword / PASSWORD_INCLUDES_LOGIN', test => { const passedResult = common.checkLoginPassword('login', 'password', [ - 'PASSWORD_INCLUDES_LOGIN' + 'PASSWORD_INCLUDES_LOGIN', ]); const failedResult = common.checkLoginPassword('login', 'loginpassword', [ - 'PASSWORD_INCLUDES_LOGIN' + 'PASSWORD_INCLUDES_LOGIN', ]); test.strictSame(passedResult.valid, true); @@ -224,14 +224,14 @@ metatests.test('test checkLoginPassword / PASSWORD_INCLUDES_LOGIN', (test) => { test.end(); }); -metatests.test('test AuthenticationStrength / strength', (test) => { +metatests.test('test AuthenticationStrength / strength', test => { let password = 'pass'; const required = [{ name: 'MIN_LENGTH', minLength: 5 }]; const optional = [ { name: 'MAX_REPEATED_CHARS', number: 2 }, { name: 'MIN_SPECIAL_CHARS', number: 1 }, { name: 'MIN_UPPERCASE_CHARS', number: 1 }, - { name: 'MIN_NUMBERS', number: 1 } + { name: 'MIN_NUMBERS', number: 1 }, ]; let result = common.checkPassword(password, required, optional); diff --git a/test/cache.js b/test/cache.js index b5072ced..fadc1b81 100644 --- a/test/cache.js +++ b/test/cache.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('cache create add get', (test) => { +metatests.test('cache create add get', test => { const cache = common.cache(); cache.add('key1', 'value1'); @@ -15,7 +15,7 @@ metatests.test('cache create add get', (test) => { test.end(); }); -metatests.test('cache del key', (test) => { +metatests.test('cache del key', test => { const cache = common.cache(); cache.add('key1', 'value1'); @@ -27,7 +27,7 @@ metatests.test('cache del key', (test) => { test.end(); }); -metatests.test('cache clr', (test) => { +metatests.test('cache clr', test => { const cache = common.cache({ }); cache.add('key1', 'value1'); @@ -39,7 +39,7 @@ metatests.test('cache clr', (test) => { test.end(); }); -metatests.test('cache calcSize', (test) => { +metatests.test('cache calcSize', test => { const cache = common.cache({ calcSize: true }); cache.add('key1', { length: 10, str: '0123456789' }); diff --git a/test/callback.js b/test/callback.js index 871ebb44..6702ddbb 100644 --- a/test/callback.js +++ b/test/callback.js @@ -9,7 +9,7 @@ metatests.case('Common / callbacks', { common }, { 'common.emptyness': [[[], undefined]], }); -metatests.test('unsafeCallback', (test) => { +metatests.test('unsafeCallback', test => { const callback = (...args) => { test.strictSame(args, [1, 2, 3]); test.end(); @@ -20,7 +20,7 @@ metatests.test('unsafeCallback', (test) => { cb(...args); }); -metatests.test('unsafeCallback without callback', (test) => { +metatests.test('unsafeCallback without callback', test => { const args = ['a', 'b', 'c']; const cb = common.unsafeCallback(args); test.strictSame(args, ['a', 'b', 'c']); @@ -28,7 +28,7 @@ metatests.test('unsafeCallback without callback', (test) => { test.end(); }); -metatests.test('safeCallback', (test) => { +metatests.test('safeCallback', test => { const callback = (...args) => { test.strictSame(args, [10, 20, 30, 40, 50]); test.end(); @@ -39,7 +39,7 @@ metatests.test('safeCallback', (test) => { wrappedCb(...args); }); -metatests.test('safeCallback without callback', (test) => { +metatests.test('safeCallback without callback', test => { const args = [11, 22, 33]; const wrappedCb = common.safeCallback(args); test.strictSame(args, [11, 22, 33]); @@ -47,7 +47,7 @@ metatests.test('safeCallback without callback', (test) => { test.end(); }); -metatests.test('safeCallback return emptiness', (test) => { +metatests.test('safeCallback return emptiness', test => { const args = [3, 2, 1]; const wrappedCb = common.safeCallback(args); test.strictSame(wrappedCb, common.emptiness); @@ -55,7 +55,7 @@ metatests.test('safeCallback return emptiness', (test) => { test.end(); }); -metatests.test('onceCallback prevent callback twice', (test) => { +metatests.test('onceCallback prevent callback twice', test => { const callback = (...args) => { test.strictSame(args, ['A', 'B', 'C']); test.end(); @@ -67,7 +67,7 @@ metatests.test('onceCallback prevent callback twice', (test) => { wrappedCb(...args); }); -metatests.test('requiredCallback', (test) => { +metatests.test('requiredCallback', test => { const callback = (...args) => { test.strictSame(args, [100, 200, 300]); test.end(); @@ -78,7 +78,7 @@ metatests.test('requiredCallback', (test) => { wrappedCb(...args); }); -metatests.test('requiredCallback raise', (test) => { +metatests.test('requiredCallback raise', test => { const args = [-1, -2, -3]; try { const wrappedCb = common.requiredCallback(args); @@ -89,7 +89,7 @@ metatests.test('requiredCallback raise', (test) => { } }); -metatests.test('once', (test) => { +metatests.test('once', test => { const fn = () => { test.end(); }; @@ -98,7 +98,7 @@ metatests.test('once', (test) => { wrapped(); }); -metatests.test('once without function', (test) => { +metatests.test('once without function', test => { const wrapped = common.once(null); test.strictSame(wrapped, common.emptiness); wrapped(); diff --git a/test/curry.js b/test/curry.js index 77851a9c..1458858c 100644 --- a/test/curry.js +++ b/test/curry.js @@ -3,49 +3,49 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('curry(f)(1)(2)(3)', (test) => { +metatests.test('curry(f)(1)(2)(3)', test => { const sum = (x, y, z) => (x + y + z); const res = common.curry(sum)(1)(2)(3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f, 1)(2)(3)', (test) => { +metatests.test('curry(f, 1)(2)(3)', test => { const sum = (x, y, z) => (x + y + z); const res = common.curry(sum, 1)(2)(3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f, 1, 2)(3)', (test) => { +metatests.test('curry(f, 1, 2)(3)', test => { const sum = (x, y, z) => (x + y + z); const res = common.curry(sum, 1, 2)(3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f, 1, 2, 3)', (test) => { +metatests.test('curry(f, 1, 2, 3)', test => { const sum = (x, y, z) => (x + y + z); const res = common.curry(sum, 1, 2, 3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f, 1)(2, 3)', (test) => { +metatests.test('curry(f, 1)(2, 3)', test => { const sum = (x, y, z) => (x + y + z); const res = common.curry(sum, 1)(2, 3); test.strictSame(res, 6); test.end(); }); -metatests.test('curry(f)(1, 2, 3)', (test) => { +metatests.test('curry(f)(1, 2, 3)', test => { const sum = (x, y, z) => (x + y + z); const res = common.curry(sum)(1, 2, 3); test.strictSame(res, 6); test.end(); }); -metatests.testSync('multiple curry of sum(x, y)', (test) => { +metatests.testSync('multiple curry of sum(x, y)', test => { const sum = (x, y) => x + y; const sumCurry = common.curry(sum); const addOne = sumCurry(1); @@ -56,7 +56,7 @@ metatests.testSync('multiple curry of sum(x, y)', (test) => { test.strictSame(addTwo(20), 22); }); -metatests.testSync('multiple curry of sum(x, y, z)', (test) => { +metatests.testSync('multiple curry of sum(x, y, z)', test => { const sum = (x, y, z) => x + y + z; const sumCurry = common.curry(sum); const addOneTwo = sumCurry(1, 2); @@ -67,7 +67,7 @@ metatests.testSync('multiple curry of sum(x, y, z)', (test) => { test.strictSame(addTwoThree(20), 25); }); -metatests.testSync('curry of identity', (test) => { +metatests.testSync('curry of identity', test => { const id = x => x; const idCurry = common.curry(id); test.strictSame(idCurry(10), 10); @@ -76,13 +76,13 @@ metatests.testSync('curry of identity', (test) => { test.strictSame(common.curry(id, 10), 10); }); -metatests.testSync('curry of unit', (test) => { +metatests.testSync('curry of unit', test => { const unit = () => 42; const unitCurry = common.curry(unit); test.strictSame(unitCurry(), 42); }); -metatests.testSync('redundant args must be ignored', (test) => { +metatests.testSync('redundant args must be ignored', test => { const add = (x, y) => x + y; const addCurry = common.curry(add); test.strictSame(addCurry(1, 2, 4), 3); diff --git a/test/curryN.js b/test/curryN.js index 0ca8f439..b17a1968 100644 --- a/test/curryN.js +++ b/test/curryN.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('curryN', (test) => { +metatests.test('curryN', test => { const sum = (x, y, z) => (x + y + z); const sumC = common.curryN(sum, 2, 1); const sumC2 = sumC(2); diff --git a/test/data.js b/test/data.js index f39b805d..0cfb0360 100644 --- a/test/data.js +++ b/test/data.js @@ -82,45 +82,45 @@ metatests.case('Common / data types', { common }, { ], }); -metatests.test('setByPath', (test) => { +metatests.test('setByPath', test => { const obj = { a: {} }; test.assert(common.setByPath(obj, 'a.b.c', 42)); test.strictSame(obj.a.b.c, 42); test.end(); }); -metatests.test('setByPath non-object', (test) => { +metatests.test('setByPath non-object', test => { const obj = { a: 10 }; test.assertNot(common.setByPath(obj, 'a.b.c', 42)); test.end(); }); -metatests.test('setByPath non-object first', (test) => { +metatests.test('setByPath non-object first', test => { const nonobj = 10; test.assertNot(common.setByPath(nonobj, 'a.b.c', 42)); test.end(); }); -metatests.test('setByPath non-object last', (test) => { +metatests.test('setByPath non-object last', test => { const obj = { a: { b: 10 } }; test.assertNot(common.setByPath(obj, 'a.b.c', 42)); test.end(); }); -metatests.test('deleteByPath', (test) => { +metatests.test('deleteByPath', test => { const obj = { a: { b: { c: 42 } } }; test.assert(common.deleteByPath(obj, 'a.b.c')); test.assertNot(obj.a.b.c); test.end(); }); -metatests.test('deleteByPath non-existent', (test) => { +metatests.test('deleteByPath non-existent', test => { const obj = { a: {} }; test.assertNot(common.deleteByPath(obj, 'a.b.c')); test.end(); }); -metatests.test('deleteByPath non-existent last', (test) => { +metatests.test('deleteByPath non-existent last', test => { const obj = { a: { b: {} } }; test.assertNot(common.deleteByPath(obj, 'a.b.c')); test.end(); diff --git a/test/either.js b/test/either.js index 105edeb7..a391cee4 100644 --- a/test/either.js +++ b/test/either.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('either', (test) => { +metatests.test('either', test => { const fnEither = common.either(x => x * 2); const res = fnEither(1, 2); @@ -12,9 +12,9 @@ metatests.test('either', (test) => { test.end(); }); -metatests.test('either with one error and one success', (test) => { +metatests.test('either with one error and one success', test => { const fnError = new Error('either with error'); - const fn = (x) => { + const fn = x => { if (x === 1) { throw fnError; } else { @@ -29,10 +29,10 @@ metatests.test('either with one error and one success', (test) => { test.end(); }); -metatests.test('either with all errors', (test) => { +metatests.test('either with all errors', test => { const fnError1 = new Error('either with error 1'); const fnError2 = new Error('either with error 2'); - const fn = (x) => { + const fn = x => { if (x === 1) { throw fnError1; } else { diff --git a/test/enum.js b/test/enum.js index 899d537d..3a56700d 100644 --- a/test/enum.js +++ b/test/enum.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const { Enum } = require('..'); -metatests.test('Enum with key/value', (test) => { +metatests.test('Enum with key/value', test => { const Month = Enum.from({ Jan: 'January', Feb: 'February', @@ -16,7 +16,7 @@ metatests.test('Enum with key/value', (test) => { Sep: 'September', Oct: 'October', Nov: 'November', - Dec: 'December' + Dec: 'December', }); test.strictSame(typeof Month, 'function'); @@ -38,7 +38,7 @@ metatests.test('Enum with key/value', (test) => { test.end(); }); -metatests.test('Enum string month keys', (test) => { +metatests.test('Enum string month keys', test => { const Month = Enum.from( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' @@ -64,7 +64,7 @@ metatests.test('Enum string month keys', (test) => { test.end(); }); -metatests.test('Enum string month typed keys', (test) => { +metatests.test('Enum string month typed keys', test => { const Month = Enum.from({ 1: 'January', 2: 'February', @@ -77,7 +77,7 @@ metatests.test('Enum string month typed keys', (test) => { 9: 'September', 10: 'October', 11: 'November', - 12: 'December' + 12: 'December', }); test.strictSame(typeof Month, 'function'); @@ -99,7 +99,7 @@ metatests.test('Enum string month typed keys', (test) => { test.end(); }); -metatests.test('Enum hundreds keys', (test) => { +metatests.test('Enum hundreds keys', test => { const Hundreds = Enum.from(100, 200, 300, 400, 500); const h100 = Hundreds.from(100); @@ -134,7 +134,7 @@ metatests.test('Enum hundreds keys', (test) => { test.end(); }); -metatests.test('Enum hundreds keys array', (test) => { +metatests.test('Enum hundreds keys array', test => { const Hundreds = Enum.from([100, 200, 300, 400, 500]); test.strictSame(Hundreds.from(0), Enum.NaE); @@ -147,7 +147,7 @@ metatests.test('Enum hundreds keys array', (test) => { test.end(); }); -metatests.test('Enum.NaE property', (test) => { +metatests.test('Enum.NaE property', test => { test.strictSame(Object.getOwnPropertyDescriptor(Enum, 'NaE'), { writable: false, enumerable: false, diff --git a/test/events.js b/test/events.js index f6e229eb..6c37ca11 100644 --- a/test/events.js +++ b/test/events.js @@ -4,7 +4,7 @@ const metatests = require('metatests'); const events = require('events'); const common = require('..'); -metatests.test('emitter', (test) => { +metatests.test('emitter', test => { const ee = common.emitter(); ee.on('name', () => { test.end(); @@ -12,7 +12,7 @@ metatests.test('emitter', (test) => { ee.emit('name'); }); -metatests.test('forward all events', (test) => { +metatests.test('forward all events', test => { test.plan(3); const sourceEmitter = common.emitter(); @@ -37,7 +37,7 @@ metatests.test('forward all events', (test) => { sourceEmitter.emit('testEvent3'); }); -metatests.test('forward all events by method', (test) => { +metatests.test('forward all events by method', test => { test.plan(3); const sourceEmitter = common.emitter(); @@ -62,7 +62,7 @@ metatests.test('forward all events by method', (test) => { sourceEmitter.emit('testEvent3'); }); -metatests.test('forward a single event', (test) => { +metatests.test('forward a single event', test => { test.plan(1); const sourceEventEmitter = new events.EventEmitter(); @@ -77,7 +77,7 @@ metatests.test('forward a single event', (test) => { sourceEventEmitter.emit('testEvent'); }); -metatests.test('forward a single event under a new name', (test) => { +metatests.test('forward a single event under a new name', test => { test.plan(1); const sourceEventEmitter = new events.EventEmitter(); @@ -94,7 +94,7 @@ metatests.test('forward a single event under a new name', (test) => { sourceEventEmitter.emit('testEvent'); }); -metatests.test('forward multiple events', (test) => { +metatests.test('forward multiple events', test => { test.plan(2); const sourceEventEmitter = new events.EventEmitter(); diff --git a/test/id.js b/test/id.js index e72ef870..b42fa744 100644 --- a/test/id.js +++ b/test/id.js @@ -8,7 +8,7 @@ const common = require('..'); const config = { characters: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', secret: 'secret', - length: 64 + length: 64, }; metatests.case('Common / id', { common }, { @@ -20,7 +20,7 @@ metatests.case('Common / id', { common }, { [config, '', false], ], 'common.generateSID': [ - [config, (result) => (result.length === 64)], + [config, result => (result.length === 64)], ], 'common.crcSID': [ [ @@ -29,8 +29,8 @@ metatests.case('Common / id', { common }, { config.length - 4, config.characters ), - (result) => (result.length === 4) - ] + result => (result.length === 4), + ], ], 'common.idToChunks': [ [0, ['0000', '0000']], @@ -38,7 +38,7 @@ metatests.case('Common / id', { common }, { [30, ['001e', '0000']], [123456789, ['cd15', '075b']], [123456789123, ['1a83', 'be99', '001c']], - [9007199254740991, ['ffff', 'ffff', 'ffff', '001f']] + [9007199254740991, ['ffff', 'ffff', 'ffff', '001f']], ], 'common.idToPath': [ [0, '0000/0000'], @@ -46,7 +46,7 @@ metatests.case('Common / id', { common }, { [30, '001e/0000'], [123456789, 'cd15/075b'], [123456789123, '1a83/be99/001c'], - [9007199254740991, 'ffff/ffff/ffff/001f'] + [9007199254740991, 'ffff/ffff/ffff/001f'], ], 'common.pathToId': [ ['0000/0000', 0], @@ -64,11 +64,11 @@ metatests.case('Common / id', { common }, { ['1a83/be99/001c', 123456789123], ['0000/0000/1000', 17592186044416], ['0000/0000/ffff', 281470681743360], - ['ffff/ffff/ffff/001f', 9007199254740991] - ] + ['ffff/ffff/ffff/001f', 9007199254740991], + ], }); -metatests.test('generateStorageKey', (test) => { +metatests.test('generateStorageKey', test => { const key = common.generateStorageKey(); test.strictSame(Array.isArray(key), true); test.strictSame(key.length, 3); diff --git a/test/math.js b/test/math.js index 0d5646dc..f973c8ce 100644 --- a/test/math.js +++ b/test/math.js @@ -5,15 +5,15 @@ const common = require('..'); metatests.case('Common / math', { common }, { 'common.random': [ - [ 0, 10, (result) => (result >= 0 && result <= 10)], - [ 1, 10, (result) => (result >= 1 && result <= 10)], - [-1, 10, (result) => (result >= -1 && result <= 10)], - [10, 20, (result) => (result >= 10 && result <= 20)], - [10, 0, (result) => (result >= 0 && result <= 10)], - [20, (result) => (result >= 0 && result <= 20)], + [ 0, 10, result => (result >= 0 && result <= 10)], + [ 1, 10, result => (result >= 1 && result <= 10)], + [-1, 10, result => (result >= -1 && result <= 10)], + [10, 20, result => (result >= 10 && result <= 20)], + [10, 0, result => (result >= 0 && result <= 10)], + [20, result => (result >= 0 && result <= 20)], [10, 10, 10], ], 'common.cryptoRandom': [ - [(result) => (result >= 0 && result <= 1)], + [result => (result >= 0 && result <= 1)], ], }); diff --git a/test/mixin.js b/test/mixin.js index 7ef4622c..26b8b017 100644 --- a/test/mixin.js +++ b/test/mixin.js @@ -36,7 +36,7 @@ class Child extends Parent { common.mixin(Child.prototype, Lazy.prototype); -metatests.test('multiple inheritance with mixin', (test) => { +metatests.test('multiple inheritance with mixin', test => { const obj = new Child(); obj.method1(); obj.method2(); diff --git a/test/mp.js b/test/mp.js index 8c264881..8470e0db 100644 --- a/test/mp.js +++ b/test/mp.js @@ -12,20 +12,20 @@ const iface = { prop2: 1000, prop3: false, prop4: undefined, - prop5: null + prop5: null, }; iface.fn3 = function(x) { return x * 3; }; -metatests.test('methods', (test) => { +metatests.test('methods', test => { const result = common.methods(iface); test.strictSame(result, ['fn1', 'fn2', 'fn3']); test.end(); }); -metatests.test('properties', (test) => { +metatests.test('properties', test => { const result = common.properties(iface); test.strictSame(result, ['prop1', 'prop2', 'prop3', 'prop4', 'prop5']); test.end(); diff --git a/test/network.js b/test/network.js index b70ceb86..08cd4259 100644 --- a/test/network.js +++ b/test/network.js @@ -23,6 +23,6 @@ metatests.case('Common / network', { common }, { ['localhost:8080', 'localhost'], ], 'common.localIPs': [ - [[], (value) => Array.isArray(value)], + [[], value => Array.isArray(value)], ], }); diff --git a/test/omap.js b/test/omap.js index 4b129975..205096f2 100644 --- a/test/omap.js +++ b/test/omap.js @@ -3,10 +3,10 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('omap', (test) => { +metatests.test('omap', test => { const persons = { vlad: { age: 20, side: 'good' }, - dziuba: { age: 20, side: 'evil' } + dziuba: { age: 20, side: 'evil' }, }; const expected = { vlad: 'good', dziuba: 'evil' }; const result = common.omap(p => p.side, persons); diff --git a/test/partial.js b/test/partial.js index 9a1f5f6b..2c308459 100644 --- a/test/partial.js +++ b/test/partial.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('partial ', (test) => { +metatests.test('partial ', test => { const func = (a, b, c, d) => (a + b + c + d); const fn1 = common.partial(func); const fn2 = common.partial(func, 10); diff --git a/test/replicate.js b/test/replicate.js index a69f0d61..42420900 100644 --- a/test/replicate.js +++ b/test/replicate.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('replicate', (test) => { +metatests.test('replicate', test => { const expected = [true, true, true, true, true]; const result = common.replicate(5, true); test.strictSame(result, expected); diff --git a/test/restLeft.js b/test/restLeft.js index 64848789..75bb4a5a 100644 --- a/test/restLeft.js +++ b/test/restLeft.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('restLeft', (test) => { +metatests.test('restLeft', test => { const expectedArgs = [3, 4, 5]; const expectedArg1 = 1; const expectedArg2 = 2; diff --git a/test/safe.js b/test/safe.js index 0d82a542..79e74bed 100644 --- a/test/safe.js +++ b/test/safe.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('safe require success', (test) => { +metatests.test('safe require success', test => { const safeRequire = common.safe(require); const result = safeRequire('./mp'); test.strictSame(!!result[0], false); @@ -11,7 +11,7 @@ metatests.test('safe require success', (test) => { test.end(); }); -metatests.test('safe require fail', (test) => { +metatests.test('safe require fail', test => { const safeRequire = common.safe(require); const result = safeRequire('./name'); test.strictSame(!!result[0], true); @@ -19,7 +19,7 @@ metatests.test('safe require fail', (test) => { test.end(); }); -metatests.test('safe parser success', (test) => { +metatests.test('safe parser success', test => { const parser = common.safe(JSON.parse); const result = parser('{"a":5}'); test.strictSame(!!result[0], false); @@ -27,7 +27,7 @@ metatests.test('safe parser success', (test) => { test.end(); }); -metatests.test('safe parser fail', (test) => { +metatests.test('safe parser fail', test => { const parser = common.safe(JSON.parse); const result = parser('{a:}'); test.strictSame(!!result[0], true); diff --git a/test/sort.js b/test/sort.js index f03d3cd6..81578f04 100644 --- a/test/sort.js +++ b/test/sort.js @@ -18,7 +18,7 @@ const CONFIG_FILES_PRIORITY = [ 'filestorage.js', 'mail.js', 'hosts.js', - 'routes.js' + 'routes.js', ]; metatests.case('Common / sort', { common }, { @@ -54,13 +54,13 @@ metatests.case('Common / sort', { common }, { ], }); -metatests.test('sortCompareDirectories', (test) => { +metatests.test('sortCompareDirectories', test => { const array = [ { name: 'file0.txt' }, { name: '/dir' }, { name: 'file1.txt' }, { name: 'file0.txt' }, - { name: '/foo' } + { name: '/foo' }, ]; const sorted = [ { name: '/dir' }, @@ -73,7 +73,7 @@ metatests.test('sortCompareDirectories', (test) => { test.end(); }); -metatests.test('sortCompareByName', (test) => { +metatests.test('sortCompareByName', test => { const array = [{ name: 'c' }, { name: 'a' }, { name: 'a' }, { name: 'b' }]; const sorted = [{ name: 'a' }, { name: 'a' }, { name: 'b' }, { name: 'c' }]; test.strictSame(array.sort(common.sortCompareByName), sorted); diff --git a/test/uint64.js b/test/uint64.js index d9ec3782..dff43155 100644 --- a/test/uint64.js +++ b/test/uint64.js @@ -90,7 +90,7 @@ metatests.test('Uint64 binary operators', test => { { values: [ '0b0000000000000000000000000000000000000000000000000000000000000010', - '0b0100000000000000000000000000000000000000000000000000000000000000' + '0b0100000000000000000000000000000000000000000000000000000000000000', ], operations: { add: '4000000000000002', @@ -104,7 +104,7 @@ metatests.test('Uint64 binary operators', test => { { values: [ '0b0000000000000000000000000000000000000000000000000000000000000001', - '0b1000000000000000000000000000000000000000000000000000000000000000' + '0b1000000000000000000000000000000000000000000000000000000000000000', ], operations: { add: '8000000000000001', diff --git a/test/utilities.js b/test/utilities.js index 73d7ab1d..24a4a2fd 100644 --- a/test/utilities.js +++ b/test/utilities.js @@ -3,13 +3,13 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('Check called filename/filepath', (test) => { +metatests.test('Check called filename/filepath', test => { test.ok(common.callerFilepath().endsWith('test/utilities.js')); test.strictSame(common.callerFilename(), 'utilities.js'); test.end(); }); -metatests.test('Check called filename/filepath parent', (test) => { +metatests.test('Check called filename/filepath parent', test => { child(test, 1); test.end(); }); diff --git a/test/zip.js b/test/zip.js index 31a962b8..f77dd3aa 100644 --- a/test/zip.js +++ b/test/zip.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('zip', (test) => { +metatests.test('zip', test => { const data = [ [1, 2, 3], ['one', 'two', 'three'], @@ -19,7 +19,7 @@ metatests.test('zip', (test) => { test.end(); }); -metatests.test('zip with no elements', (test) => { +metatests.test('zip with no elements', test => { const res = common.zip(); test.strictSame(res, []); test.end(); diff --git a/test/zipWith.js b/test/zipWith.js index be73f511..8c11db41 100644 --- a/test/zipWith.js +++ b/test/zipWith.js @@ -3,7 +3,7 @@ const metatests = require('metatests'); const common = require('..'); -metatests.test('zipWith', (test) => { +metatests.test('zipWith', test => { const data = [ [1, 2, 3], ['one', 'two', 'three'], diff --git a/tools/unicode-category-parser.js b/tools/unicode-category-parser.js index a2eb790e..153e5dbd 100644 --- a/tools/unicode-category-parser.js +++ b/tools/unicode-category-parser.js @@ -34,6 +34,7 @@ const UCD_LINK = 'http://www.unicode.org/Public/' + UNICODE_VERSION + const OUTPUT_PATH = path.join(__dirname, '../lib/unicode-categories.js'); +/* eslint-disable implicit-arrow-linebreak */ const getFileHeader = () => `// Copyright (c) 2017-2018 Metarhia contributors. Use of this source code is // governed by the MIT license that can be found in the LICENSE file. @@ -83,6 +84,7 @@ const getFileHeader = () => // Do not edit this file manually! /* eslint-disable */ module.exports = `; +/* eslint-enable implicit-arrow-linebreak */ const resultObject = {}; resultObject.addRange = range => { @@ -97,11 +99,11 @@ UNICODE_CATEGORIES.forEach(category => { resultObject[category] = []; }); -http.get(UCD_LINK, (res) => { +http.get(UCD_LINK, res => { const linereader = readline.createInterface({ input: res, historySize: 0 }); let prevCategory; let range = {}; - linereader.on('line', (line) => { + linereader.on('line', line => { const [code,, category] = line.split(';'); if (UNICODE_CATEGORIES.includes(category)) { const decimalCode = parseInt(code, 16);