Template Examples
{
"name": "destruct",
"body": "const { {{exprLast}}$1 } = {{exprRest}}",
"when": [
"expression",
]
},
{
"name": "log2",
"body": "console.log('{{exprLast}}', {{expr}})",
"when": [
"identifier",
"expression",
"function-call"
]
},
Usage Examples
defaultSettings.getGeneralSettings().clipboardLinkDetection.destruct
// => destruct
const { clipboardLinkDetection } = defaultSettings.getGeneralSettings()
(await fetchData()).customField.destruct
// => destruct
const { customField } = (await fetchData())
defaultSettings.general.clipboardLinkDetection.log2
// => log2
console.log('clipboardLinkDetection', defaultSettings.general.clipboardLinkDetection)
// update to include even more ideas
checkInterval.clear /* -> */ clearInterval(checkInterval)
closeTimeout.clear /* -> */ clearTimeout(closeTimeout)
While {{exprLast}} can be useful in some scenarios like logging or usage for some custom function that accepts label as first argument. Another example would be usage with test() & capitalize filter.
However, for now I can imagine only one case, where {{exprRest}} can be useful (destruct example above).
Template Examples
{ "name": "destruct", "body": "const { {{exprLast}}$1 } = {{exprRest}}", "when": [ "expression", ] }, { "name": "log2", "body": "console.log('{{exprLast}}', {{expr}})", "when": [ "identifier", "expression", "function-call" ] },Usage Examples
While
{{exprLast}}can be useful in some scenarios like logging or usage for some custom function that accepts label as first argument. Another example would be usage withtest()& capitalize filter.However, for now I can imagine only one case, where
{{exprRest}}can be useful (destructexample above).