Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get CI passing and update all deps #16

Merged
merged 4 commits into from
Feb 25, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const inspectCustom = (value, options, type) => {
return ''
}

// eslint-disable-next-line complexity
export default function inspect(value, options) {
options = normaliseOptions(options)
options.inspect = inspect
Expand Down
6 changes: 5 additions & 1 deletion lib/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export default function inspectArray(array, options) {
options.truncate -= listContents.length
let propertyContents = ''
if (nonIndexProperties.length) {
propertyContents = inspectList(nonIndexProperties.map(key => [key, array[key]]), options, inspectProperty)
propertyContents = inspectList(
nonIndexProperties.map(key => [key, array[key]]),
options,
inspectProperty
)
}
return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ''} ]`
}
3 changes: 2 additions & 1 deletion lib/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import inspectObject from './object'
const toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag ? Symbol.toStringTag : false

export default function inspectClass(value, options) {
const name = (toStringTag && toStringTag in value ? value[toStringTag] : getFuncName(value.constructor)) || '<Anonymous Class>'
const name =
(toStringTag && toStringTag in value ? value[toStringTag] : getFuncName(value.constructor)) || '<Anonymous Class>'
options.truncate -= name.length
return `${name}${inspectObject(value, options)}`
}
8 changes: 6 additions & 2 deletions lib/error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { truncate, inspectList, inspectProperty } from './helpers'

const errorKeys = new Set(['stack', 'line', 'column', 'name', 'message'])
const errorKeys = new Set(['stack', 'line', 'column', 'name', 'message', 'fileName', 'lineNumber', 'columnNumber'])

export default function inspectObject(error, options) {
const properties = Object.getOwnPropertyNames(error).filter(key => !errorKeys.has(key))
Expand All @@ -14,6 +14,10 @@ export default function inspectObject(error, options) {
}
message = message ? `: ${message}` : ''
options.truncate -= message.length + 5
const propertyContents = inspectList(properties.map(key => [key, error[key]]), options, inspectProperty)
const propertyContents = inspectList(
properties.map(key => [key, error[key]]),
options,
inspectProperty
)
return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ''}`
}
12 changes: 10 additions & 2 deletions lib/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ export default function inspectObject(object, options) {
return '{}'
}
options.truncate -= 4
const propertyContents = inspectList(properties.map(key => [key, object[key]]), options, inspectProperty)
const symbolContents = inspectList(symbols.map(key => [key, object[key]]), options, inspectProperty)
const propertyContents = inspectList(
properties.map(key => [key, object[key]]),
options,
inspectProperty
)
const symbolContents = inspectList(
symbols.map(key => [key, object[key]]),
options,
inspectProperty
)
let sep = ''
if (propertyContents && symbolContents) {
sep = ', '
Expand Down
6 changes: 5 additions & 1 deletion lib/typedarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export default function inspectTypedArray(array, options) {
}
let propertyContents = ''
if (nonIndexProperties.length) {
propertyContents = inspectList(nonIndexProperties.map(key => [key, array[key]]), options, inspectProperty)
propertyContents = inspectList(
nonIndexProperties.map(key => [key, array[key]]),
options,
inspectProperty
)
}
return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ''} ]`
}
Loading