Lint deps are upgraded to latest
This commit is contained in:
parent
180a73eeb4
commit
9b14abcda0
@ -1,4 +1,4 @@
|
||||
module.exports = api => {
|
||||
module.exports = (api) => {
|
||||
api.cache(true)
|
||||
return {
|
||||
presets: [
|
||||
|
@ -13,7 +13,7 @@ function needsFreezing(object) {
|
||||
function recur(object) {
|
||||
Object.freeze(object)
|
||||
|
||||
Object.keys(object).forEach(key => {
|
||||
Object.keys(object).forEach((key) => {
|
||||
const value = object[key]
|
||||
if (needsFreezing(value)) {
|
||||
recur(value)
|
||||
|
@ -2,5 +2,5 @@ import ifElse from './ifElse'
|
||||
import curry from './util/curry'
|
||||
|
||||
export default curry((predicate, trueUpdates, object) =>
|
||||
ifElse(predicate, trueUpdates, x => x, object)
|
||||
ifElse(predicate, trueUpdates, (x) => x, object)
|
||||
)
|
||||
|
@ -47,7 +47,7 @@ function resolveUpdates(updates, object) {
|
||||
function updateArray(updates, object) {
|
||||
const newArray = [...object]
|
||||
|
||||
Object.keys(updates).forEach(key => {
|
||||
Object.keys(updates).forEach((key) => {
|
||||
newArray[key] = updates[key]
|
||||
})
|
||||
|
||||
@ -91,13 +91,13 @@ function update(updates, object, ...args) {
|
||||
|
||||
if (Array.isArray(defaultedObject)) {
|
||||
return updateArray(resolvedUpdates, defaultedObject).filter(
|
||||
value => value !== innerOmitted
|
||||
(value) => value !== innerOmitted
|
||||
)
|
||||
}
|
||||
|
||||
return _omitBy(
|
||||
{ ...defaultedObject, ...resolvedUpdates },
|
||||
value => value === innerOmitted
|
||||
(value) => value === innerOmitted
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ const wildcard = '*'
|
||||
|
||||
function reducePath(acc, key) {
|
||||
if (key === wildcard) {
|
||||
return value =>
|
||||
return (value) =>
|
||||
Object.prototype.hasOwnProperty.call(value, wildcard)
|
||||
? // If we actually have wildcard as a property, update that
|
||||
update({ [wildcard]: acc }, value)
|
||||
|
@ -1,5 +1,5 @@
|
||||
import reject from 'lodash/reject'
|
||||
|
||||
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)
|
||||
}
|
||||
|
14
package.json
14
package.json
@ -43,16 +43,16 @@
|
||||
"@types/chai": "^4.1.7",
|
||||
"@types/lodash": "^4.14.119",
|
||||
"@types/mocha": "^7.0.1",
|
||||
"@types/node": "^13.1.0",
|
||||
"@types/node": "^13.9.8",
|
||||
"babel-loader": "^8.0.6",
|
||||
"benchmark": "^2.1.4",
|
||||
"chai": "^4.2.0",
|
||||
"dtslint": "^2.0.0",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-airbnb-base": "^11.1.3",
|
||||
"dtslint": "^3.4.1",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-airbnb-base": "^14.1.0",
|
||||
"eslint-config-prettier": "^6.3.0",
|
||||
"eslint-plugin-import": "^2.2.0",
|
||||
"eslint-plugin-prettier": "^2.0.1",
|
||||
"eslint-plugin-import": "^2.20.2",
|
||||
"eslint-plugin-prettier": "^3.1.2",
|
||||
"exports-loader": "^0.7.0",
|
||||
"karma": "^4.3.0",
|
||||
"karma-babel-preprocessor": "^8.0.1",
|
||||
@ -62,7 +62,7 @@
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^4.0.2",
|
||||
"mocha": "^7.0.0",
|
||||
"prettier": "^1.1.0",
|
||||
"prettier": "^2.0.2",
|
||||
"rimraf": "^3.0.0",
|
||||
"typescript": "^3.6.3",
|
||||
"webpack": "^4.42.1",
|
||||
|
@ -2,13 +2,13 @@
|
||||
/* global document */
|
||||
const Benchmark = require('benchmark')
|
||||
|
||||
const u = require('../lib')
|
||||
const _ = require('lodash')
|
||||
const u = require('../lib')
|
||||
const { curry2, curry4 } = require('../lib/util/curry')
|
||||
|
||||
const add4 = (a, b, c, d) => a + b + c + d
|
||||
const add2 = (a, b) => a + b
|
||||
const fakeCurryAdd = x => y => x + y
|
||||
const fakeCurryAdd = (x) => (y) => x + y
|
||||
const lodashCurryAdd2 = _.curry(add2)
|
||||
const updeepCurryAdd2 = curry2(add2)
|
||||
const lodashCurryAdd4 = _.curry(add4)
|
||||
@ -37,7 +37,7 @@ function createSuite(suiteName, tests) {
|
||||
})
|
||||
|
||||
suite
|
||||
.on('cycle', event => {
|
||||
.on('cycle', (event) => {
|
||||
log(`<li>${String(event.target)}</li>`)
|
||||
})
|
||||
.on('complete', () => {
|
||||
|
@ -19,7 +19,7 @@ describe('u.if', () => {
|
||||
|
||||
it('will use the result of a function passed as a predicate', () => {
|
||||
const object = { a: 0 }
|
||||
const aIsThree = x => x.a === 3
|
||||
const aIsThree = (x) => x.a === 3
|
||||
const result = u.if(aIsThree, { b: 1 }, object)
|
||||
|
||||
expect(result).to.eql({ a: 0 })
|
||||
@ -27,8 +27,8 @@ describe('u.if', () => {
|
||||
|
||||
it('can be partially applied', () => {
|
||||
const object = { a: 2 }
|
||||
const isEven = x => x % 2 === 0
|
||||
const inc = x => x + 1
|
||||
const isEven = (x) => x % 2 === 0
|
||||
const inc = (x) => x + 1
|
||||
|
||||
const result = u(
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ describe('u.ifElse', () => {
|
||||
|
||||
it('will use the result of a function passed as a predicate', () => {
|
||||
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)
|
||||
|
||||
expect(result).to.eql({ a: 0, b: 4 })
|
||||
@ -24,9 +24,9 @@ describe('u.ifElse', () => {
|
||||
|
||||
it('can be partially applied', () => {
|
||||
const object = { a: 2 }
|
||||
const isEven = x => x % 2 === 0
|
||||
const inc = x => x + 1
|
||||
const dec = x => x - 1
|
||||
const isEven = (x) => x % 2 === 0
|
||||
const inc = (x) => x + 1
|
||||
const dec = (x) => x - 1
|
||||
|
||||
const result = u(
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ describe('u.is', () => {
|
||||
})
|
||||
|
||||
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 } })
|
||||
expect(result).to.be.true
|
||||
})
|
||||
@ -19,7 +19,7 @@ describe('u.is', () => {
|
||||
})
|
||||
|
||||
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 } })
|
||||
expect(result).to.be.false
|
||||
})
|
||||
|
@ -4,7 +4,7 @@ import u from '../lib'
|
||||
describe('u.map', () => {
|
||||
it('applies updates to each item in an array', () => {
|
||||
const object = [0, 1, 2]
|
||||
const inc = x => x + 1
|
||||
const inc = (x) => x + 1
|
||||
const result = u.map(inc, object)
|
||||
|
||||
expect(result).to.eql([1, 2, 3])
|
||||
@ -12,7 +12,7 @@ describe('u.map', () => {
|
||||
|
||||
it('applies updates to each value in an object', () => {
|
||||
const object = { a: 0, b: 1, c: 2 }
|
||||
const inc = x => x + 1
|
||||
const inc = (x) => x + 1
|
||||
const result = u.map(inc, object)
|
||||
|
||||
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', () => {
|
||||
const array = [0, 1]
|
||||
const ident = x => x
|
||||
const ident = (x) => x
|
||||
let result = u.map(ident, array)
|
||||
|
||||
expect(result).to.equal(array)
|
||||
|
@ -18,7 +18,7 @@ describe('u.reject', () => {
|
||||
const object = { foo: [1, 2, 3] }
|
||||
const result = u(
|
||||
{
|
||||
foo: u.reject(x => x === 'Justin Bieber'),
|
||||
foo: u.reject((x) => x === 'Justin Bieber'),
|
||||
},
|
||||
object
|
||||
)
|
||||
@ -30,7 +30,7 @@ describe('u.reject', () => {
|
||||
const object = { foo: [1, 2, 3, 4] }
|
||||
const result = u(
|
||||
{
|
||||
foo: u.reject(x => x === 4),
|
||||
foo: u.reject((x) => x === 4),
|
||||
},
|
||||
object
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ describe('u.updateIn', () => {
|
||||
})
|
||||
|
||||
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 result = u.updateIn('a.b', inc, object)
|
||||
expect(result).to.eql({ a: { b: 1 } })
|
||||
@ -45,17 +45,17 @@ describe('u.updateIn', () => {
|
||||
|
||||
it('can multiple elements of an array with *', () => {
|
||||
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 }] })
|
||||
|
||||
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] })
|
||||
})
|
||||
|
||||
it('can update properties named *', () => {
|
||||
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 })
|
||||
})
|
||||
})
|
||||
|
@ -57,7 +57,7 @@ describe('updeep', () => {
|
||||
})
|
||||
|
||||
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 result = u({ foo: inc, bar: inc }, object)
|
||||
|
||||
@ -65,7 +65,7 @@ describe('updeep', () => {
|
||||
})
|
||||
|
||||
it('can be partially applied', () => {
|
||||
const inc = i => i + 1
|
||||
const inc = (i) => i + 1
|
||||
const object = { foo: 3 }
|
||||
const incFoo = u({ foo: inc })
|
||||
|
||||
@ -95,7 +95,7 @@ describe('updeep', () => {
|
||||
})
|
||||
|
||||
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)
|
||||
})
|
||||
@ -148,7 +148,7 @@ describe('updeep', () => {
|
||||
|
||||
describe('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', () => {
|
||||
|
@ -3,7 +3,7 @@ import { curry1, curry2, curry3, curry4, _ } from '../../lib/util/curry'
|
||||
|
||||
describe('curry1', () => {
|
||||
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)
|
||||
})
|
||||
|
@ -3,14 +3,14 @@ import u from '../lib'
|
||||
|
||||
describe('u.withDefault', () => {
|
||||
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)
|
||||
|
||||
expect(result).to.eql({ a: 1 })
|
||||
})
|
||||
|
||||
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 })
|
||||
|
||||
expect(result).to.eql({ a: 4 })
|
||||
|
Loading…
Reference in New Issue
Block a user