Created
March 21, 2014 01:19
-
-
Save jeffharnois/9677637 to your computer and use it in GitHub Desktop.
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
arr1 = ['T-GEO-US', 'T-GEO-CA'] | |
arr2 = ['T-GEO-US', 'T-GEO-GA'] | |
targetings = [arr1, arr2] | |
# we want only T-GEO-US to be returned | |
# Current: | |
flatTargetings = [].concat.apply [], targetings | |
# flatTargetings = ['T-GEO-US', 'T-GEO-CA', 'T-GEO-US', 'T-GEO-GA'] | |
geoTargetings = _.uniq flatTargetings | |
# geoTargetings = ['T-GEO-US', 'T-GEO-CA', 'T-GEO-GA'] | |
# Should be: | |
geoTargetings = _.intersection arr1, arr2 | |
# geoTargetings = ['T-GEO-US'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment