Created
July 26, 2022 18:32
-
-
Save alexalannunes/de21c7530d47c79c73aef254706e027d to your computer and use it in GitHub Desktop.
validate cell of array matrix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var csv = [ | |
["id", "nome", "cidade_id"], | |
[23, "alex", "pereiro"], | |
[23, "alex", "pereiro"], | |
[23, "alex", 3], | |
] | |
const col= csv[0][2] // cidade_id | |
const cel = typeof csv[3][2]; // 3 | |
const columns ={ | |
"id": "string", | |
"nome": "string", | |
"cidade_id": "number" | |
} | |
columns[col] === cel; // number === number | |
columns; | |
// true | |
// { | |
// id: 'string', | |
// nome: 'string', | |
// cidade_id: 'number' | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment