Created
August 2, 2017 04:09
-
-
Save Danjavia/50108de93abb1bc8b239489ecea8e310 to your computer and use it in GitHub Desktop.
Sample for Belatrix: Please, copy the code below and paste within chrome dev tools console to show result.
This file contains 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
let raw = [ | |
"01 Lima / / ", | |
"01 Lima / 50 Lima / ", | |
"01 Lima / 51 Barranca / ", | |
"01 Lima / 50 Lima / 202 La Molina", | |
"01 Lima / 50 Lima / 203 San Isidro", | |
"02 Arequipa / / ", | |
"02 Arequipa / 63 Arequipa / ", | |
"02 Arequipa / 64 Caylloma / ", | |
"02 Arequipa / 63 Arequipa / 267 Cercado" | |
]; | |
let newItems = []; | |
raw.map((line, key) => { | |
let items = line.split(/( [\d]+ |[\d]+|\/)/); | |
const cleanItems = items.filter((item) => item != '' && item != '/'); | |
newItems.push(cleanItems); | |
}); | |
console.table(newItems); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment