@@ -4,10 +4,11 @@ export function getUniqueValues(
44) : Array < any > {
55 const output : Array < any > = [ ]
66
7- arrayOfObjects . map ( obj => {
7+ arrayOfObjects . map ( ( obj ) => {
88 if ( obj [ propertyName ] !== undefined ) {
99 if (
10- output . find ( val => JSON . stringify ( obj [ propertyName ] ) === JSON . stringify ( val ) ) === undefined
10+ output . find ( ( val ) => JSON . stringify ( obj [ propertyName ] ) === JSON . stringify ( val ) ) ===
11+ undefined
1112 ) {
1213 output . push ( obj [ propertyName ] )
1314 }
@@ -19,12 +20,12 @@ export function getUniqueValues(
1920
2021export function findFirstOneMatching (
2122 arrayOfObjects : Record < string , any > [ ] ,
22- propertyName : any ,
23+ propertyName : string ,
2324 propertyValue : any
2425) : Record < string , any > | null {
2526 let output : Record < string , any > | null = null
2627
27- arrayOfObjects . some ( obj => {
28+ arrayOfObjects . some ( ( obj ) => {
2829 if ( obj [ propertyName ] !== undefined ) {
2930 if ( JSON . stringify ( obj [ propertyName ] ) === JSON . stringify ( propertyValue ) ) {
3031 output = obj
@@ -41,12 +42,12 @@ export function findFirstOneMatching(
4142
4243export function findLastOneMatching (
4344 arrayOfObjects : Record < string , any > [ ] ,
44- propertyName : any ,
45+ propertyName : string ,
4546 propertyValue : any
4647) : Record < string , any > | null {
4748 let output : Record < string , any > | null = null
4849
49- arrayOfObjects . map ( obj => {
50+ arrayOfObjects . map ( ( obj ) => {
5051 if ( obj [ propertyName ] !== undefined ) {
5152 if ( JSON . stringify ( obj [ propertyName ] ) === JSON . stringify ( propertyValue ) ) {
5253 output = obj
@@ -59,12 +60,12 @@ export function findLastOneMatching(
5960
6061export function findAllMatching (
6162 arrayOfObjects : Record < string , any > [ ] ,
62- propertyName : any ,
63+ propertyName : string ,
6364 propertyValue : any
6465) : Record < string , any > [ ] {
65- let output : Record < string , any > [ ] = [ ]
66+ const output : Record < string , any > [ ] = [ ]
6667
67- arrayOfObjects . map ( obj => {
68+ arrayOfObjects . map ( ( obj ) => {
6869 if ( obj [ propertyName ] !== undefined ) {
6970 if ( JSON . stringify ( obj [ propertyName ] ) === JSON . stringify ( propertyValue ) ) {
7071 output . push ( obj )
@@ -77,12 +78,12 @@ export function findAllMatching(
7778
7879export function removeFirstOneMatching (
7980 arrayOfObjects : Record < string , any > [ ] ,
80- propertyName : any ,
81+ propertyName : string ,
8182 propertyValue : any
8283) : Record < string , any > [ ] {
83- let flag : boolean = false
84+ let flag = false
8485
85- return arrayOfObjects . filter ( obj => {
86+ return arrayOfObjects . filter ( ( obj ) => {
8687 if ( obj [ propertyName ] !== undefined && ! flag ) {
8788 if ( JSON . stringify ( obj [ propertyName ] ) === JSON . stringify ( propertyValue ) ) {
8889 flag = true
@@ -97,10 +98,10 @@ export function removeFirstOneMatching(
9798
9899export function removeLastOneMatching (
99100 arrayOfObjects : Record < string , any > [ ] ,
100- propertyName : any ,
101+ propertyName : string ,
101102 propertyValue : any
102103) : Record < string , any > [ ] {
103- let lastOneMatchingIndex : number = - 1
104+ let lastOneMatchingIndex = - 1
104105
105106 arrayOfObjects . map ( ( obj , index ) => {
106107 if ( obj [ propertyName ] !== undefined ) {
@@ -110,7 +111,7 @@ export function removeLastOneMatching(
110111 }
111112 } )
112113
113- let output = JSON . parse ( JSON . stringify ( arrayOfObjects ) )
114+ const output = JSON . parse ( JSON . stringify ( arrayOfObjects ) )
114115
115116 if ( lastOneMatchingIndex != - 1 ) {
116117 output . splice ( lastOneMatchingIndex , 1 )
@@ -121,10 +122,10 @@ export function removeLastOneMatching(
121122
122123export function removeAllMatching (
123124 arrayOfObjects : Record < string , any > [ ] ,
124- propertyName : any ,
125+ propertyName : string ,
125126 propertyValue : any
126127) : Record < string , any > [ ] {
127- return arrayOfObjects . filter ( obj => {
128+ return arrayOfObjects . filter ( ( obj ) => {
128129 if ( obj [ propertyName ] !== undefined ) {
129130 if ( JSON . stringify ( obj [ propertyName ] ) === JSON . stringify ( propertyValue ) ) {
130131 return false
0 commit comments