Created
August 11, 2021 02:04
-
-
Save colbyfayock/eb523d3359de66c7899c0b14330fc5b3 to your computer and use it in GitHub Desktop.
GitHub Copilot Suggestion Examples
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
/* Input */ | |
const recipes = [ | |
{ | |
name: 'Fried Chicken', | |
categories: ['chicken', 'meat'] | |
}, | |
{ | |
name: 'Spinach Pasta', | |
categories: ['pasta', 'vegan'] | |
}, | |
{ | |
name: 'Thai Curry with Chicken', | |
categories: ['chicken', 'thai', 'meat'] | |
} | |
]; | |
// returns an array of recipes with chicken | |
/* Input with Suggestion */ | |
const recipes = [ | |
{ | |
name: 'Fried Chicken', | |
categories: ['chicken', 'meat'] | |
}, | |
{ | |
name: 'Spinach Pasta', | |
categories: ['pasta', 'vegan'] | |
}, | |
{ | |
name: 'Thai Curry with Chicken', | |
categories: ['chicken', 'thai', 'meat'] | |
} | |
]; | |
// returns an array of recipes with chicken | |
const chickenRecipes = recipes.filter(recipe => recipe.categories.includes('chicken')); |
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
/* Input */ | |
// returns a sorted array of objects based on date | |
/* Input with Suggestion */ | |
// returns a sorted array of objects based on date | |
function sortByDate(array) { |
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
/* Input */ | |
function sortArrayByKey | |
/* Input with Suggestion */ | |
function sortArrayByKey(array, key) { | |
return array.sort(function(a, b) { | |
var x = a[key]; var y = b[key]; | |
return ((x < y) ? -1 : ((x > y) ? 1 : 0)); | |
}); | |
} |
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
/* Input */ | |
import { getApolloClient } from 'lib/apollo-client'; | |
import { QUERY_ALL_PAGES } from 'data/pages'; | |
function getAllPAges() { | |
/* Input with Suggestion */ | |
import { getApolloClient } from 'lib/apollo-client'; | |
import { QUERY_ALL_PAGES } from 'data/pages'; | |
function getAllPAges() { | |
return getApolloClient().query({ | |
query: QUERY_ALL_PAGES | |
}); | |
} |
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
/* Input */ | |
function sortArrayByKey | |
/* Synthesized Results */ | |
Sythesizing 10/10 solutions (Duplicates hidden) | |
======= | |
function sortArrayByKey(array, key) { | |
return array.sort(function(a, b) { | |
var x = a[key]; var y = b[key]; | |
return ((x < y) ? -1 : ((x > y) ? 1 : 0)); | |
}); | |
} | |
======= | |
...9 more sortArrayByKey results |
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
/* Input */ | |
import { removeExtraSpaces } from './src/lib/until'; | |
// test that extra spaces are removed | |
/* Synthesized Results */ | |
Sythesizing 10/10 solutions (Duplicates hidden) | |
======= | |
expect(removeExtraSpaces(' ')).toBe(' '); | |
expect(removeExtraSpaces(' a')).toBe(' a'); | |
expect(removeExtraSpaces('a ')).toBe('a '); | |
expect(removeExtraSpaces('a b')).toBe('a b'); | |
======= | |
...9 more results |
How to pòcibol
Ayuda
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ceipnlhmjohemhfpbjdgeigkababhmjc