Skip to content
Open
Changes from all 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
34 changes: 34 additions & 0 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ pluginTester({
}
`
},
{
title: 'object properties: Assigning the rest of an object to a variable',
code: `
const obj = {
// sitrep
fn() {
const { a, b, c = 'foo', ...rest } = x;
const d = a + b + c;
return { d, rest };
}
}
`
},
{
title: 'object properties with let',
code: `
Expand All @@ -85,6 +98,27 @@ pluginTester({
}
`
},
{
title: 'array properties: Ignoring some returned values',
code: `
// sitrep
function fn() {
const [, a, b, c, d] = x.split("_");
return a + b + c + d;
}
`
},
{
title: 'array properties: Assigning the rest of an array to a variable',
code: `
// sitrep
function fn() {
const [, a, b, ...rest] = x.split("_");
const c = a + b;
return { sum: c, rest };
}
`
},
{
title: 'array properties with let',
code: `
Expand Down