Skip to content

Commit d285f29

Browse files
committed
added toSorted snippets
1 parent 0e2e355 commit d285f29

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

snippets/arrays.json

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,45 @@
11
{
2-
"arrayFilterEqual": {
2+
"array.Filter.Equal": {
33
"prefix": "arfeq",
44
"body": "const ${1:newArray} = ${2:array}.filter((${3:element}) => ${3:element} === ${4:value})$0",
55
"description": "Array Filter compare equal"
66
},
7-
"arrayFilterNotEqual": {
7+
"array.Filter.NotEqual": {
88
"prefix": "arfne",
99
"body": "const ${1:newArray} = ${2:array}.filter((${3:element}) => ${3:element} !== ${4:value})$0",
1010
"description": "Array Filter compare not equal"
1111
},
12-
"arrayFilterObjectEqual": {
12+
"array.Filter.Object.Equal": {
1313
"prefix": "arfoeq",
1414
"body": "const ${1:newArray} = ${2:array}.filter((${3:element}) => ${3:element}.${4:prop} === ${5:value})$0",
1515
"description": "Array Filter Object compare equal"
1616
},
17-
"arrayFilterObjectNotEqual": {
17+
"array.Filter.Object.NotEqual": {
1818
"prefix": "arfone",
1919
"body": "const ${1:newArray} = ${2:array}.filter((${3:element}) => ${3:element}.${4:prop} !== ${5:value})$0",
2020
"description": "Array Filter Object compare not equal"
2121
},
22-
"arraySortNumberAsc": {
22+
"array.Sort.Number.Asc": {
2323
"prefix": "arsna",
2424
"body": "${1:array}.sort((${2:a}, ${3:z}) => ${2:a} - ${3:z})$0",
25-
"description": "Array sort numbers ascending"
25+
"description": "Array sort (mutate) numbers ascending"
2626
},
27-
"arraySortNumberDesc": {
27+
"array.Sort.Number.Desc": {
2828
"prefix": "arsnd",
2929
"body": "${1:array}.sort((${2:a}, ${3:z}) => ${3:z} - ${2:a})$0",
30-
"description": "Array sort numbers descending"
30+
"description": "Array sort (mutate) numbers descending"
3131
},
32-
"arrayUniqueValues": {
32+
"array.ToSorted.Number.Asc": {
33+
"prefix": "artsna",
34+
"body": "${1:array}.toSorted((${2:a}, ${3:z}) => ${2:a} - ${3:z})$0",
35+
"description": "Array sort (not mutate) numbers ascending"
36+
},
37+
"array.ToSorted.Number.Desc": {
38+
"prefix": "artsnd",
39+
"body": "${1:array}.toSorted((${2:a}, ${3:z}) => ${3:z} - ${2:a})$0",
40+
"description": "Array sort (not mutate) numbers descending"
41+
},
42+
"array.UniqueValues": {
3343
"prefix": "aruv",
3444
"body": "const ${1:newArray} = ${2:array}.filter((${3:current}, ${4:index}, ${5:arr}) => ${5:arr}.indexOf(${3:current}) == ${4:index})$0",
3545
"description": "Array unique values"

0 commit comments

Comments
 (0)