Lint deps are upgraded to latest

main
Shaun Dern 2020-04-02 15:16:13 +01:00
parent 180a73eeb4
commit 9b14abcda0
No known key found for this signature in database
GPG Key ID: 19E354FC9294F450
19 changed files with 629 additions and 388 deletions

View File

@ -1,4 +1,4 @@
module.exports = api => { module.exports = (api) => {
api.cache(true) api.cache(true)
return { return {
presets: [ presets: [

View File

@ -20,7 +20,7 @@ var localLaunchers = {
}, },
} }
module.exports = function(config) { module.exports = function (config) {
config.set({ config.set({
// base path that will be used to resolve all patterns (eg. files, exclude) // base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '', basePath: '',

View File

@ -13,7 +13,7 @@ function needsFreezing(object) {
function recur(object) { function recur(object) {
Object.freeze(object) Object.freeze(object)
Object.keys(object).forEach(key => { Object.keys(object).forEach((key) => {
const value = object[key] const value = object[key]
if (needsFreezing(value)) { if (needsFreezing(value)) {
recur(value) recur(value)

View File

@ -2,5 +2,5 @@ import ifElse from './ifElse'
import curry from './util/curry' import curry from './util/curry'
export default curry((predicate, trueUpdates, object) => export default curry((predicate, trueUpdates, object) =>
ifElse(predicate, trueUpdates, x => x, object) ifElse(predicate, trueUpdates, (x) => x, object)
) )

View File

@ -47,7 +47,7 @@ function resolveUpdates(updates, object) {
function updateArray(updates, object) { function updateArray(updates, object) {
const newArray = [...object] const newArray = [...object]
Object.keys(updates).forEach(key => { Object.keys(updates).forEach((key) => {
newArray[key] = updates[key] newArray[key] = updates[key]
}) })
@ -91,13 +91,13 @@ function update(updates, object, ...args) {
if (Array.isArray(defaultedObject)) { if (Array.isArray(defaultedObject)) {
return updateArray(resolvedUpdates, defaultedObject).filter( return updateArray(resolvedUpdates, defaultedObject).filter(
value => value !== innerOmitted (value) => value !== innerOmitted
) )
} }
return _omitBy( return _omitBy(
{ ...defaultedObject, ...resolvedUpdates }, { ...defaultedObject, ...resolvedUpdates },
value => value === innerOmitted (value) => value === innerOmitted
) )
} }

View File

@ -7,7 +7,7 @@ const wildcard = '*'
function reducePath(acc, key) { function reducePath(acc, key) {
if (key === wildcard) { if (key === wildcard) {
return value => return (value) =>
Object.prototype.hasOwnProperty.call(value, wildcard) Object.prototype.hasOwnProperty.call(value, wildcard)
? // If we actually have wildcard as a property, update that ? // If we actually have wildcard as a property, update that
update({ [wildcard]: acc }, value) update({ [wildcard]: acc }, value)

View File

@ -1,5 +1,5 @@
import reject from 'lodash/reject' import reject from 'lodash/reject'
export default function splitPath(path) { export default function splitPath(path) {
return Array.isArray(path) ? path : reject(`${path}`.split('.'), x => !x) return Array.isArray(path) ? path : reject(`${path}`.split('.'), (x) => !x)
} }

View File

@ -43,16 +43,16 @@
"@types/chai": "^4.1.7", "@types/chai": "^4.1.7",
"@types/lodash": "^4.14.119", "@types/lodash": "^4.14.119",
"@types/mocha": "^7.0.1", "@types/mocha": "^7.0.1",
"@types/node": "^13.1.0", "@types/node": "^13.9.8",
"babel-loader": "^8.0.6", "babel-loader": "^8.0.6",
"benchmark": "^2.1.4", "benchmark": "^2.1.4",
"chai": "^4.2.0", "chai": "^4.2.0",
"dtslint": "^2.0.0", "dtslint": "^3.4.1",
"eslint": "^4.19.1", "eslint": "^6.8.0",
"eslint-config-airbnb-base": "^11.1.3", "eslint-config-airbnb-base": "^14.1.0",
"eslint-config-prettier": "^6.3.0", "eslint-config-prettier": "^6.3.0",
"eslint-plugin-import": "^2.2.0", "eslint-plugin-import": "^2.20.2",
"eslint-plugin-prettier": "^2.0.1", "eslint-plugin-prettier": "^3.1.2",
"exports-loader": "^0.7.0", "exports-loader": "^0.7.0",
"karma": "^4.3.0", "karma": "^4.3.0",
"karma-babel-preprocessor": "^8.0.1", "karma-babel-preprocessor": "^8.0.1",
@ -62,7 +62,7 @@
"karma-sourcemap-loader": "^0.3.7", "karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^4.0.2", "karma-webpack": "^4.0.2",
"mocha": "^7.0.0", "mocha": "^7.0.0",
"prettier": "^1.1.0", "prettier": "^2.0.2",
"rimraf": "^3.0.0", "rimraf": "^3.0.0",
"typescript": "^3.6.3", "typescript": "^3.6.3",
"webpack": "^4.42.1", "webpack": "^4.42.1",

View File

@ -2,13 +2,13 @@
/* global document */ /* global document */
const Benchmark = require('benchmark') const Benchmark = require('benchmark')
const u = require('../lib')
const _ = require('lodash') const _ = require('lodash')
const u = require('../lib')
const { curry2, curry4 } = require('../lib/util/curry') const { curry2, curry4 } = require('../lib/util/curry')
const add4 = (a, b, c, d) => a + b + c + d const add4 = (a, b, c, d) => a + b + c + d
const add2 = (a, b) => a + b const add2 = (a, b) => a + b
const fakeCurryAdd = x => y => x + y const fakeCurryAdd = (x) => (y) => x + y
const lodashCurryAdd2 = _.curry(add2) const lodashCurryAdd2 = _.curry(add2)
const updeepCurryAdd2 = curry2(add2) const updeepCurryAdd2 = curry2(add2)
const lodashCurryAdd4 = _.curry(add4) const lodashCurryAdd4 = _.curry(add4)
@ -37,7 +37,7 @@ function createSuite(suiteName, tests) {
}) })
suite suite
.on('cycle', event => { .on('cycle', (event) => {
log(`<li>${String(event.target)}</li>`) log(`<li>${String(event.target)}</li>`)
}) })
.on('complete', () => { .on('complete', () => {

View File

@ -19,7 +19,7 @@ describe('u.if', () => {
it('will use the result of a function passed as a predicate', () => { it('will use the result of a function passed as a predicate', () => {
const object = { a: 0 } const object = { a: 0 }
const aIsThree = x => x.a === 3 const aIsThree = (x) => x.a === 3
const result = u.if(aIsThree, { b: 1 }, object) const result = u.if(aIsThree, { b: 1 }, object)
expect(result).to.eql({ a: 0 }) expect(result).to.eql({ a: 0 })
@ -27,8 +27,8 @@ describe('u.if', () => {
it('can be partially applied', () => { it('can be partially applied', () => {
const object = { a: 2 } const object = { a: 2 }
const isEven = x => x % 2 === 0 const isEven = (x) => x % 2 === 0
const inc = x => x + 1 const inc = (x) => x + 1
const result = u( const result = u(
{ {

View File

@ -16,7 +16,7 @@ describe('u.ifElse', () => {
it('will use the result of a function passed as a predicate', () => { it('will use the result of a function passed as a predicate', () => {
const object = { a: 0 } const object = { a: 0 }
const aIsThree = x => x.a === 3 const aIsThree = (x) => x.a === 3
const result = u.ifElse(aIsThree, { b: 1 }, { b: 4 }, object) const result = u.ifElse(aIsThree, { b: 1 }, { b: 4 }, object)
expect(result).to.eql({ a: 0, b: 4 }) expect(result).to.eql({ a: 0, b: 4 })
@ -24,9 +24,9 @@ describe('u.ifElse', () => {
it('can be partially applied', () => { it('can be partially applied', () => {
const object = { a: 2 } const object = { a: 2 }
const isEven = x => x % 2 === 0 const isEven = (x) => x % 2 === 0
const inc = x => x + 1 const inc = (x) => x + 1
const dec = x => x - 1 const dec = (x) => x - 1
const result = u( const result = u(
{ {

View File

@ -8,7 +8,7 @@ describe('u.is', () => {
}) })
it('returns true if path matches a function predicate', () => { it('returns true if path matches a function predicate', () => {
const isEven = x => x % 2 === 0 const isEven = (x) => x % 2 === 0
const result = u.is('a.b', isEven, { a: { b: 6 } }) const result = u.is('a.b', isEven, { a: { b: 6 } })
expect(result).to.be.true expect(result).to.be.true
}) })
@ -19,7 +19,7 @@ describe('u.is', () => {
}) })
it('returns false if path matches a function predicate', () => { it('returns false if path matches a function predicate', () => {
const isEven = x => x % 2 === 0 const isEven = (x) => x % 2 === 0
const result = u.is('a.b', isEven, { a: { b: 7 } }) const result = u.is('a.b', isEven, { a: { b: 7 } })
expect(result).to.be.false expect(result).to.be.false
}) })

View File

@ -4,7 +4,7 @@ import u from '../lib'
describe('u.map', () => { describe('u.map', () => {
it('applies updates to each item in an array', () => { it('applies updates to each item in an array', () => {
const object = [0, 1, 2] const object = [0, 1, 2]
const inc = x => x + 1 const inc = (x) => x + 1
const result = u.map(inc, object) const result = u.map(inc, object)
expect(result).to.eql([1, 2, 3]) expect(result).to.eql([1, 2, 3])
@ -12,7 +12,7 @@ describe('u.map', () => {
it('applies updates to each value in an object', () => { it('applies updates to each value in an object', () => {
const object = { a: 0, b: 1, c: 2 } const object = { a: 0, b: 1, c: 2 }
const inc = x => x + 1 const inc = (x) => x + 1
const result = u.map(inc, object) const result = u.map(inc, object)
expect(result).to.eql({ a: 1, b: 2, c: 3 }) expect(result).to.eql({ a: 1, b: 2, c: 3 })
@ -27,7 +27,7 @@ describe('u.map', () => {
it('returns the same object if no updates are made', () => { it('returns the same object if no updates are made', () => {
const array = [0, 1] const array = [0, 1]
const ident = x => x const ident = (x) => x
let result = u.map(ident, array) let result = u.map(ident, array)
expect(result).to.equal(array) expect(result).to.equal(array)

View File

@ -18,7 +18,7 @@ describe('u.reject', () => {
const object = { foo: [1, 2, 3] } const object = { foo: [1, 2, 3] }
const result = u( const result = u(
{ {
foo: u.reject(x => x === 'Justin Bieber'), foo: u.reject((x) => x === 'Justin Bieber'),
}, },
object object
) )
@ -30,7 +30,7 @@ describe('u.reject', () => {
const object = { foo: [1, 2, 3, 4] } const object = { foo: [1, 2, 3, 4] }
const result = u( const result = u(
{ {
foo: u.reject(x => x === 4), foo: u.reject((x) => x === 4),
}, },
object object
) )

View File

@ -9,7 +9,7 @@ describe('u.updateIn', () => {
}) })
it('can update a single path described with a string with a function', () => { it('can update a single path described with a string with a function', () => {
const inc = x => x + 1 const inc = (x) => x + 1
const object = { a: { b: 0 } } const object = { a: { b: 0 } }
const result = u.updateIn('a.b', inc, object) const result = u.updateIn('a.b', inc, object)
expect(result).to.eql({ a: { b: 1 } }) expect(result).to.eql({ a: { b: 1 } })
@ -45,17 +45,17 @@ describe('u.updateIn', () => {
it('can multiple elements of an array with *', () => { it('can multiple elements of an array with *', () => {
let object = { a: [{ b: 0 }, { b: 1 }, { b: 2 }] } let object = { a: [{ b: 0 }, { b: 1 }, { b: 2 }] }
let result = u.updateIn('a.*.b', x => x + 1, object) let result = u.updateIn('a.*.b', (x) => x + 1, object)
expect(result).to.eql({ a: [{ b: 1 }, { b: 2 }, { b: 3 }] }) expect(result).to.eql({ a: [{ b: 1 }, { b: 2 }, { b: 3 }] })
object = { a: [0, 1, 2] } object = { a: [0, 1, 2] }
result = u.updateIn(['a', '*'], x => x + 1, object) result = u.updateIn(['a', '*'], (x) => x + 1, object)
expect(result).to.eql({ a: [1, 2, 3] }) expect(result).to.eql({ a: [1, 2, 3] })
}) })
it('can update properties named *', () => { it('can update properties named *', () => {
const object = { '*': 1, x: 1 } const object = { '*': 1, x: 1 }
const result = u.updateIn('*', x => x + 1, object) const result = u.updateIn('*', (x) => x + 1, object)
expect(result).to.eql({ '*': 2, x: 1 }) expect(result).to.eql({ '*': 2, x: 1 })
}) })
}) })

View File

@ -57,7 +57,7 @@ describe('updeep', () => {
}) })
it('can use functions to update values', () => { it('can use functions to update values', () => {
const inc = i => i + 1 const inc = (i) => i + 1
const object = { foo: 3, bar: 4, baz: 7 } const object = { foo: 3, bar: 4, baz: 7 }
const result = u({ foo: inc, bar: inc }, object) const result = u({ foo: inc, bar: inc }, object)
@ -65,7 +65,7 @@ describe('updeep', () => {
}) })
it('can be partially applied', () => { it('can be partially applied', () => {
const inc = i => i + 1 const inc = (i) => i + 1
const object = { foo: 3 } const object = { foo: 3 }
const incFoo = u({ foo: inc }) const incFoo = u({ foo: inc })
@ -95,7 +95,7 @@ describe('updeep', () => {
}) })
it('can take a function as the updater', () => { it('can take a function as the updater', () => {
const result = u(i => i + 1, 7) const result = u((i) => i + 1, 7)
expect(result).to.eql(8) expect(result).to.eql(8)
}) })
@ -148,7 +148,7 @@ describe('updeep', () => {
describe('u.omitted', () => { describe('u.omitted', () => {
it('omit properties via u.omitted', () => { it('omit properties via u.omitted', () => {
expectU(u({ a: u.omitted, b: i => i + 1 }), { a: 1, b: 2 }, { b: 3 }) expectU(u({ a: u.omitted, b: (i) => i + 1 }), { a: 1, b: 2 }, { b: 3 })
}) })
it('omit array and object properties', () => { it('omit array and object properties', () => {

View File

@ -3,7 +3,7 @@ import { curry1, curry2, curry3, curry4, _ } from '../../lib/util/curry'
describe('curry1', () => { describe('curry1', () => {
it('can curry one arguments', () => { it('can curry one arguments', () => {
const addOne = curry1(x => x + 1) const addOne = curry1((x) => x + 1)
expect(addOne(3)).to.equal(4) expect(addOne(3)).to.equal(4)
expect(addOne()(3)).to.equal(4) expect(addOne()(3)).to.equal(4)
}) })

View File

@ -3,14 +3,14 @@ import u from '../lib'
describe('u.withDefault', () => { describe('u.withDefault', () => {
it('uses the default as the basis for the update if the object is undefined', () => { it('uses the default as the basis for the update if the object is undefined', () => {
const inc = x => x + 1 const inc = (x) => x + 1
const result = u.withDefault({ a: 0 }, { a: inc }, undefined) const result = u.withDefault({ a: 0 }, { a: inc }, undefined)
expect(result).to.eql({ a: 1 }) expect(result).to.eql({ a: 1 })
}) })
it('uses ignores the default if the object is defined', () => { it('uses ignores the default if the object is defined', () => {
const inc = x => x + 1 const inc = (x) => x + 1
const result = u.withDefault({ a: 0 }, { a: inc }, { a: 3 }) const result = u.withDefault({ a: 0 }, { a: inc }, { a: 3 })
expect(result).to.eql({ a: 4 }) expect(result).to.eql({ a: 4 })

929
yarn.lock

File diff suppressed because it is too large Load Diff