$.unique not giving unique results in chrome
I have the following function that parses a text file and is supposed to return unique results. It works in IE and Firefox, but not quite in chrome. Also I thought unique sorted values, and I assumed this would be an alphabetical sort. I get different sort orders in in all three browsers, and none is alphabetical. Any insight would be appreciated.
- var getDb = function(select){
-
- //get database names from inputQueryExamples
- $.get('inputQueryExamples.txt',
- function(data){
- var string = data;
- var dbDynamo ='';
- dbExp = new RegExp('(DATABASE:.*)','gm');
- dbDynamo = string.match(dbExp);
- dbDynamo = dbDynamo.map(function(el){return el.replace('DATABASE:','');});
- $.unique(dbDynamo);
- console.log(dbDynamo);
- var options = '';
- for(i=0; i<dbDynamo.length; i++){
- options += '<option value="' + dbDynamo[i] + '">' + dbDynamo[i] + '</option>';
- };
- $(select).append(options);
-
-
- });
-
- };
Here is the text file I am reading:
- QUERY:1
- DATABASE:geoquery
- NL:What are the capitals of the states that border the most populated states?
- SQL:something
- DR:
- root(ROOT-0, What-1)
- cop(What-1, are-2)
- det(capitals-4, the-3)
- nsubj(What-1, capitals-4)
- det(states-7, the-6)
- prep_of(capitals-4, states-7)
- nsubj(border-9, states-7)
- rcmod(states-7, border-9)
- det(states-13, the-10)
- advmod(populated-12, most-11)
- amod(states-13, populated-12)
- dobj(border-9, states-13)
- QUERY:2
- DATABASE:geoquery
- NL:What are the capitals of the states bordering New York?
- SQL:SELECT state.Capital FROM state JOIN borderinfo ON state.State_Name = borderinfo.State_Name WHERE borderinfo.Border = 'New York'
- DR:
- root(ROOT-0, What-1)
- cop(What-1, are-2)
- det(capitals-4, the-3)
- nsubj(What-1, capitals-4)
- det(states-7, the-6)
- prep_of(capitals-4, states-7)
- partmod(states-7, bordering-8)
- nn(York-10, New-9)
- dobj(bordering-8, York-10)
- QUERY:3
- DATABASE:geoquery
- NL:Show the state capitals and populations.
- SQL:SELECT state.Capital, state.Population FROM state
- DR:
- root(ROOT-0, Show-1)
- det(capitals-4, the-2)
- nn(capitals-4, state-3)
- dobj(Show-1, capitals-4)
- dobj(Show-1, populations-6)
- conj_and(capitals-4, populations-6)
- QUERY:4
- DATABASE:geoquery
- NL:Show the capital of the state New York.
- SQL:SELECT state.Capital FROM state WHERE state.State_Name = 'New York'
- DR:
- ???
- QUERY:5
- DATABASE:geoquery
- NL:Show the average of state populations.
- SQL:something
- DR:
- root(ROOT-0, Show-1)
- det(average-3, the-2)
- dobj(Show-1, average-3)
- nn(populations-6, state-5)
- prep_of(average-3, populations-6)
- QUERY:6
- DATABASE:madsat
- NL:Show Salute platforms from NAIs with mobility nogo.
- SQL:SELECT salute.Platform FROM salute JOIN naimobility ON salute.NAI = naimobility.NAI WHERE naimobility.Mobility = ‘No Go’
- DR:
- nn(Salute-2, Show-1)
- nsubj(platforms-3, Salute-2)
- root(ROOT-0, platforms-3)
- prep_from(platforms-3, NAIs-5)
- prep_with(platforms-3, mobility-7)
- prep_as(platforms-3, nogo-9)
- QUERY:7
- DATABASE:madsat
- NL:Show Salute platforms from NAIs.
- SQL:SELECT NAI, Platform FROM salute
- DR:
- nn(Salute-2, Show-1)
- nsubj(platforms-3, Salute-2)
- root(ROOT-0, platforms-3)
- prep_from(platforms-3, NAIs-5)
- QUERY:8
- DATABASE:datasite
- NL:Show tables and servers from sites.
- SQL:SELECT Table, Server FROM Sites
- DR:
- root(ROOT-0, Show-1)
- dobj(Show-1, tables-2)
- dobj(Show-1, servers-4)
- conj_and(tables-2, servers-4)
- prep_from(Show-1, sites-6)
- QUERY:9
- DATABASE:bigdata
- NL:Show Salute platforms from NAIs with mobility nogo.
- SQL:SELECT salute.Platform FROM salute JOIN naimobility ON salute.NAI = naimobility.NAI WHERE naimobility.Mobility = 'No Go'
- DR:
- nn(Salute-2, Show-1)
- nsubj(platforms-3, Salute-2)
- root(ROOT-0, platforms-3)
- prep_from(platforms-3, NAIs-5)
- prep_with(platforms-3, mobility-7)
- prep_as(platforms-3, nogo-9)
- QUERY:10
- DATABASE:weapon
- NL:List countries who have Baradero class ships.
- SQL:SELECT navyship.Country FROM navyship WHERE navyship.class = ‘Baradero’
- DR:
- nn(Weapon-2, List-1)
- QUERY:11
- DATABASE:weapon
- NL:Show countries and lengths who have Frigate type ships.
- SQL:SELECT navyship.Country AND navyship.Length FROM navyship WHERE navyship.type = ‘Frigate’
- DR:
- nn(Weapon-2, Show-1)
- QUERY:12
- DATABASE:weapon
- NL:Show countries with ships of Frigate type and Baradero class.
- SQL:SELECT navyship.Country FROM navyship WHERE navyship.type = ‘Frigate’ AND navyship.Class = ‘Baradero’
- DR:
- nn(Weapon-2, Show-1)