Skip to content

Commit

Permalink
Update all the things
Browse files Browse the repository at this point in the history
* Remove package-lock

* Update supported Node.js versions

* Use GitHub Actions for CI

* Remove performance comparisons

* Remove lint script entry

* Upgrade AVA and nyc

* Upgrade linter and reformat

* Update dependencies

* Depend on the main lodash package
  • Loading branch information
novemberborn committed Mar 22, 2020
1 parent 63d5bf1 commit 9f7852f
Show file tree
Hide file tree
Showing 63 changed files with 450 additions and 10,263 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict'

module.exports = {
plugins: ['@novemberborn/as-i-preach'],
extends: ['plugin:@novemberborn/as-i-preach/nodejs'],
overrides: [
{
files: ['test/**/*.js'],
rules: {
'no-new-object': 'off',
strict: 'off',
},
},
],
}
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test
on:
push:
branches:
- master
pull_request:
paths-ignore:
- '*.md'
jobs:
nodejs:
name: Node.js
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [^10.18.0, ^12.14.0, ^13.5.0]
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install --no-audit
- run: npm test
- uses: codecov/codecov-action@v1
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# concordance

Compare, format, diff and serialize any JavaScript value. Built for Node.js 6
Compare, format, diff and serialize any JavaScript value. Built for Node.js 10
and above.

## Behavior
Expand Down
2 changes: 1 addition & 1 deletion lib/Registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Registry {

alloc (value) {
const index = ++this.counter
const pointer = {descriptor: null, index}
const pointer = { descriptor: null, index }
this.map.set(value, pointer)
return pointer
}
Expand Down
2 changes: 1 addition & 1 deletion lib/compare.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict'

const Circular = require('./Circular')
const constants = require('./constants')
const describe = require('./describe')
const recursorUtils = require('./recursorUtils')
const shouldCompareDeep = require('./shouldCompareDeep')
const symbolProperties = require('./symbolProperties')
const Circular = require('./Circular')

const AMBIGUOUS = constants.AMBIGUOUS
const DEEP_EQUAL = constants.DEEP_EQUAL
Expand Down
2 changes: 1 addition & 1 deletion lib/complexValues/arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function describe (props) {
return new DescribedArgumentsValue(Object.assign({
// Treat as an array, to allow comparisons with arrays
isArray: true,
isList: true
isList: true,
}, props, { ctor: 'Arguments' }))
}
exports.describe = describe
Expand Down
2 changes: 1 addition & 1 deletion lib/complexValues/arrayBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function describe (props) {
buffer: Buffer.from(props.value),
// Set isArray and isList so the property recursor excludes the byte accessors
isArray: true,
isList: true
isList: true,
}, props))
}
exports.describe = describe
Expand Down
4 changes: 2 additions & 2 deletions lib/complexValues/boxed.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const recursorUtils = require('../recursorUtils')
const stringPrimitive = require('../primitiveValues/string').tag
const recursorUtils = require('../recursorUtils')
const object = require('./object')

function describe (props) {
Expand All @@ -18,7 +18,7 @@ const tag = Symbol('BoxedValue')
exports.tag = tag

class BoxedValue extends object.ObjectValue {}
Object.defineProperty(BoxedValue.prototype, 'tag', {value: tag})
Object.defineProperty(BoxedValue.prototype, 'tag', { value: tag })

class DescribedBoxedValue extends object.DescribedMixin(BoxedValue) {
constructor (props) {
Expand Down
2 changes: 1 addition & 1 deletion lib/complexValues/dataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function describe (props) {
buffer: typedArray.getBuffer(props.value),
// Set isArray and isList so the property recursor excludes the byte accessors
isArray: true,
isList: true
isList: true,
}, props))
}
exports.describe = describe
Expand Down
10 changes: 5 additions & 5 deletions lib/complexValues/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const UNEQUAL = constants.UNEQUAL
function describe (props) {
const date = props.value
const invalid = isNaN(date.valueOf())
return new DescribedDateValue(Object.assign({}, props, {invalid}))
return new DescribedDateValue(Object.assign({}, props, { invalid }))
}
exports.describe = describe

Expand All @@ -32,7 +32,7 @@ function formatDate (date) {
date,
local: false,
showTimeZone: true,
showMilliseconds: true
showMilliseconds: true,
})
}

Expand Down Expand Up @@ -61,13 +61,13 @@ class DateValue extends object.ObjectValue {
return innerLines.isEmpty
? lineBuilder.single(string + theme.object.closeBracket)
: lineBuilder.first(string)
.concat(innerLines.withFirstPrefixed(indent.increase()).stripFlags())
.append(lineBuilder.last(indent + theme.object.closeBracket))
.concat(innerLines.withFirstPrefixed(indent.increase()).stripFlags())
.append(lineBuilder.last(indent + theme.object.closeBracket))
},

maxDepth () {
return lineBuilder.single(string + ' ' + theme.maxDepth + ' ' + theme.object.closeBracket)
}
},
})
}

Expand Down
10 changes: 5 additions & 5 deletions lib/complexValues/error.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const constants = require('../constants')
const isEnumerable = require('../isEnumerable')
const formatUtils = require('../formatUtils')
const isEnumerable = require('../isEnumerable')
const lineBuilder = require('../lineBuilder')
const NOOP_RECURSOR = require('../recursorUtils').NOOP_RECURSOR
const object = require('./object')
Expand All @@ -15,7 +15,7 @@ function describe (props) {
nameIsEnumerable: isEnumerable(error, 'name'),
name: error.name,
messageIsEnumerable: isEnumerable(error, 'message'),
message: error.message
message: error.message,
}, props))
}
exports.describe = describe
Expand Down Expand Up @@ -59,13 +59,13 @@ class ErrorValue extends object.ObjectValue {
return innerLines.isEmpty
? lineBuilder.single(string + theme.object.closeBracket)
: lineBuilder.first(string)
.concat(innerLines.withFirstPrefixed(indent.increase()).stripFlags())
.append(lineBuilder.last(indent + theme.object.closeBracket))
.concat(innerLines.withFirstPrefixed(indent.increase()).stripFlags())
.append(lineBuilder.last(indent + theme.object.closeBracket))
},

maxDepth () {
return lineBuilder.single(string + ' ' + theme.maxDepth + ' ' + theme.object.closeBracket)
}
},
})
}

Expand Down
10 changes: 5 additions & 5 deletions lib/complexValues/function.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const constants = require('../constants')
const isEnumerable = require('../isEnumerable')
const formatUtils = require('../formatUtils')
const isEnumerable = require('../isEnumerable')
const lineBuilder = require('../lineBuilder')
const NOOP_RECURSOR = require('../recursorUtils').NOOP_RECURSOR
const object = require('./object')
Expand All @@ -14,7 +14,7 @@ function describe (props) {
const fn = props.value
return new DescribedFunctionValue(Object.assign({
nameIsEnumerable: isEnumerable(fn, 'name'),
name: typeof fn.name === 'string' ? fn.name : null
name: typeof fn.name === 'string' ? fn.name : null,
}, props))
}
exports.describe = describe
Expand Down Expand Up @@ -43,13 +43,13 @@ class FunctionValue extends object.ObjectValue {
return innerLines.isEmpty
? lineBuilder.single(string + theme.object.closeBracket)
: lineBuilder.first(string)
.concat(innerLines.withFirstPrefixed(indent.increase()).stripFlags())
.append(lineBuilder.last(indent + theme.object.closeBracket))
.concat(innerLines.withFirstPrefixed(indent.increase()).stripFlags())
.append(lineBuilder.last(indent + theme.object.closeBracket))
},

maxDepth () {
return lineBuilder.single(string + ' ' + theme.maxDepth + ' ' + theme.object.closeBracket)
}
},
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/complexValues/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const UNEQUAL = constants.UNEQUAL

function describe (props) {
return new DescribedMapValue(Object.assign({
size: props.value.size
size: props.value.size,
}, props))
}
exports.describe = describe
Expand Down Expand Up @@ -39,7 +39,7 @@ class MapValue extends object.ObjectValue {

prepareDiff (expected) {
// Maps should be compared, even if they have a different number of entries.
return {compareResult: super.compare(expected)}
return { compareResult: super.compare(expected) }
}

serialize () {
Expand Down
10 changes: 5 additions & 5 deletions lib/complexValues/object.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict'

const constants = require('../constants')
const getObjectKeys = require('../getObjectKeys')
const ObjectFormatter = require('../formatUtils').ObjectFormatter
const getObjectKeys = require('../getObjectKeys')
const hasLength = require('../hasLength')
const recursorUtils = require('../recursorUtils')
const stats = require('../metaDescriptors/stats')
const recursorUtils = require('../recursorUtils')

const DEEP_EQUAL = constants.DEEP_EQUAL
const SHALLOW_EQUAL = constants.SHALLOW_EQUAL
Expand All @@ -17,7 +17,7 @@ function describe (props) {
return new DescribedObjectValue(Object.assign({
isArray,
isIterable: object[Symbol.iterator] !== undefined,
isList: isArray || hasLength(object)
isList: isArray || hasLength(object),
}, props))
}
exports.describe = describe
Expand Down Expand Up @@ -58,7 +58,7 @@ class ObjectValue {
serialize () {
return [
this.ctor, this.pointer, this.stringTag,
this.isArray, this.isIterable, this.isList
this.isArray, this.isIterable, this.isList,
]
}
}
Expand Down Expand Up @@ -231,7 +231,7 @@ function DeserializedMixin (base) {
stringTag: state[2],
isArray: state[3],
isIterable: state[4],
isList: state[5]
isList: state[5],
})

this.deserializedRecursor = recursor
Expand Down
4 changes: 2 additions & 2 deletions lib/complexValues/regexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function describe (props) {
const regexp = props.value
return new DescribedRegexpValue(Object.assign({
flags: getSortedFlags(regexp),
source: regexp.source
source: regexp.source,
}, props))
}
exports.describe = describe
Expand Down Expand Up @@ -69,7 +69,7 @@ class RegexpValue extends object.ObjectValue {
regexp + ' ' +
theme.maxDepth + ' ' +
theme.object.closeBracket)
}
},
})
}

Expand Down
4 changes: 2 additions & 2 deletions lib/complexValues/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const UNEQUAL = constants.UNEQUAL

function describe (props) {
return new DescribedSetValue(Object.assign({
size: props.value.size
size: props.value.size,
}, props))
}
exports.describe = describe
Expand Down Expand Up @@ -39,7 +39,7 @@ class SetValue extends object.ObjectValue {

prepareDiff (expected) {
// Sets should be compared, even if they have a different number of items.
return {compareResult: super.compare(expected)}
return { compareResult: super.compare(expected) }
}

serialize () {
Expand Down
6 changes: 3 additions & 3 deletions lib/complexValues/typedArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const constants = require('../constants')
const formatUtils = require('../formatUtils')
const lineBuilder = require('../lineBuilder')
const recursorUtils = require('../recursorUtils')
const propertyStatsTag = require('../metaDescriptors/stats').propertyTag
const recursorUtils = require('../recursorUtils')
const object = require('./object')

const DEEP_EQUAL = constants.DEEP_EQUAL
Expand All @@ -23,7 +23,7 @@ function describe (props) {
buffer: getBuffer(props.value),
// Set isArray and isList so the property recursor excludes the byte accessors
isArray: true,
isList: true
isList: true,
}, props))
}
exports.describe = describe
Expand Down Expand Up @@ -103,7 +103,7 @@ class TypedArrayValue extends object.ObjectValue {
if (subject.isProperty === true) return subject.key.value !== 'byteLength'
if (subject.tag === bytesTag) return subject.buffer.byteLength > 0
return true
}
},
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ module.exports = {
AMBIGUOUS,
DEEP_EQUAL,
SHALLOW_EQUAL,
UNEQUAL
UNEQUAL,
}

0 comments on commit 9f7852f

Please sign in to comment.