@@ -36,11 +36,6 @@ const mang = ['Microsoft', 'apple', 'netflix', 'Google'];
3636const result = search_in_array (" app" , mang);
3737console .log (result); // ['apple']
3838
39-
40-
41-
42-
43-
4439// Santized array Example
4540
4641// Corrupted Data array with diff data types
@@ -52,19 +47,17 @@ const my_array = [
5247 {name: ' asd' , age: 123 , isEmployed: false } ,
5348 {name: 00 , age: 123 , isEmployed: null } ,
5449 {name: ' sam' , age: ' 123' , isEmployed: undefined }
55- ]
56-
57-
50+ ];
5851
5952// Given schema for correct data types
6053const my_schema = {
6154 " name" : ' string' ,
6255 " age" : ' number' ,
6356 " isEmployed" : ' boolean'
64- }
57+ };
6558
6659// Run sanitize_array with array and schema
67- console .log (sanitize_array (my_array,my_schema))
60+ console .log (sanitize_array (my_array,my_schema));
6861
6962// Sanitized Output
7063// [ { name: 'sam', age: 0, isEmployed: false },
@@ -74,6 +67,6 @@ console.log(sanitize_array(my_array,my_schema))
7467// { name: 'asd', age: 123, isEmployed: false },
7568// { name: '0', age: 123, isEmployed: false },
7669// { name: 'sam', age: 123, isEmployed: false }
77- // ]
70+ // ]
7871
7972```
0 commit comments