You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
379 B
17 lines
379 B
1 year ago
|
import { inspectList } from './helpers'
|
||
|
|
||
|
// IE11 doesn't support `Array.from(set)`
|
||
|
function arrayFromSet(set) {
|
||
|
const values = []
|
||
|
set.forEach(value => {
|
||
|
values.push(value)
|
||
|
})
|
||
|
return values
|
||
|
}
|
||
|
|
||
|
export default function inspectSet(set, options) {
|
||
|
if (set.size === 0) return 'Set{}'
|
||
|
options.truncate -= 7
|
||
|
return `Set{ ${inspectList(arrayFromSet(set), options)} }`
|
||
|
}
|