Created
August 9, 2017 16:03
-
-
Save neilrackett/2c20beaf872642a150c0225ccf2e4873 to your computer and use it in GitHub Desktop.
Convert and filter a comma delimited string into an Array of valid ID numbers
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
// Converts and filters a comma delimited string into an Array of valid database ID numbers, e.g. ",x,1,,0,~,4,5,7" => "1,4,5,7" | |
let ids = str.split(',').map(keywordId => ~~keywordId).filter(keywordId => keywordId) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment