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.
15 lines
414 B
15 lines
414 B
import { inspectList } from './helpers.js'; |
|
// 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)} }`; |
|
}
|
|
|