Initial commit
This commit is contained in:
commit
3c76badc10
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/src/privatekeys.json
|
13
README.md
Normal file
13
README.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
## How to use your own cookies
|
||||||
|
Private session cookies are necessary to query CSET-foretell and Good Judgment Open. You can get said cookies by creating an account in said platforms and then making and inspecting a request (e.g., by making a prediction). After doing this, you should create a `src/privatekeys.json`, in the same format as `src/privatekeys_example.json`
|
||||||
|
|
||||||
|
## How to run
|
||||||
|
|
||||||
|
From the top level directory, enter: `npm run start`
|
||||||
|
|
||||||
|
## Various notes
|
||||||
|
|
||||||
|
- This will eventually be a webpage where users can just search for keywords and obtain forecasts related to those keywords. For example, by searching "Trump" and get probabilities related to various scenarios involving him.
|
||||||
|
- A demo of this functionality can be found [here](https://www.loki.red/metaforecasts/), the database can be found [here](https://www.loki.red/metaforecasts/data/), and a csv with the raw data [here](https://www.loki.red/metaforecasts/merged-questions.csv).
|
||||||
|
- These probabilities could then be rated and annotated, e.g., prediction markets rarely go above 95% or below 5%.
|
||||||
|
- For elicit and metaculus, this library currently filters questions with <10 predictions
|
25
data/csetforetell-questions.csv
Normal file
25
data/csetforetell-questions.csv
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
"Title","URL","Platform","Binary question?","Percentage","# Forecasts","# Forecasters"
|
||||||
|
"How many AI papers will be posted on arXiv between July 1 and December 31, 2021, inclusive?","https://www.cset-foretell.com/questions/103-how-many-ai-papers-will-be-posted-on-arxiv-between-july-1-and-december-31-2021-inclusive","CSET-foretell",false,"none","11","11"
|
||||||
|
"How many members will the Alphabet Workers Union have by December 31, 2021?","https://www.cset-foretell.com/questions/105-how-many-members-will-the-alphabet-workers-union-have-by-december-31-2021","CSET-foretell",false,"none","25","25"
|
||||||
|
"What percentage of U.S. news articles about AI will be about privacy and security between July 1 and December 31, 2021, inclusive?","https://www.cset-foretell.com/questions/104-what-percentage-of-u-s-news-articles-about-ai-will-be-about-privacy-and-security-between-july-1-and-december-31-2021-inclusive","CSET-foretell",false,"none","11","10"
|
||||||
|
"Will NVIDIA acquire Arm by March 31, 2022?","https://www.cset-foretell.com/questions/102-will-nvidia-acquire-arm-by-march-30-2022","CSET-foretell",true,"51%","38","31"
|
||||||
|
"How many of the top chipmakers in China will be subject to new export controls in 2021?","https://www.cset-foretell.com/questions/101-on-how-many-of-china-s-top-chipmakers-will-the-united-states-impose-new-export-controls-in-2021","CSET-foretell",false,"none","49","48"
|
||||||
|
"What percentage of the combined revenue of the top five semiconductor manufacturing equipment producers will come from China in 2021?","https://www.cset-foretell.com/questions/100-what-percentage-of-the-collective-revenue-of-the-leading-semiconductor-manufacturing-equipment-producers-will-come-from-china-between-july-1-2020-and-june-30-2021-inclusive","CSET-foretell",false,"none","43","41"
|
||||||
|
"Will the United States return to compliance with the 2015 Iran nuclear deal by December 31, 2021?","https://www.cset-foretell.com/questions/99-will-the-united-states-re-enter-the-2015-nuclear-deal-with-iran-by-december-31-2021","CSET-foretell",true,"65%","101","75"
|
||||||
|
"What will be the value, in dollars, of all Chinese imports of semiconductor manufacturing equipment in 2021?","https://www.cset-foretell.com/questions/95-what-will-be-the-value-in-dollars-of-all-chinese-imports-of-semiconductor-manufacturing-equipment-in-2021","CSET-foretell",false,"none","59","50"
|
||||||
|
"When will Ant Financial have an IPO in China or Hong Kong?","https://www.cset-foretell.com/questions/97-when-will-ant-financial-have-an-ipo-in-china-or-hong-kong","CSET-foretell",false,"none","131","98"
|
||||||
|
"What will be the value, in dollars, of all Chinese imports of semiconductor chips in 2021?","https://www.cset-foretell.com/questions/96-what-will-be-the-value-in-dollars-of-all-chinese-imports-of-semiconductor-chips-in-2021","CSET-foretell",false,"none","59","52"
|
||||||
|
"What will be the value, in dollars, of U.S. exports of semiconductor chips to China in the first half of 2021?","https://www.cset-foretell.com/questions/93-what-will-the-dollar-value-of-u-s-exports-of-semiconductor-chips-to-china-be-in-the-first-half-of-2021","CSET-foretell",false,"none","67","55"
|
||||||
|
"What will be the value, in dollars, of U.S. exports of semiconductor manufacturing equipment to China in the first half of 2021? ","https://www.cset-foretell.com/questions/92-what-will-the-dollar-value-of-u-s-exports-of-semiconductor-manufacturing-equipment-to-china-be-in-the-first-half-of-2021","CSET-foretell",false,"none","55","42"
|
||||||
|
"What percentage of U.S. residents will have an unfavorable view of China, as reflected in the 2022 Pew Global Attitudes Survey?","https://www.cset-foretell.com/questions/91-conditional-on-vice-president-biden-s-election-what-percentage-of-u-s-residents-will-have-an-unfavorable-view-of-china-as-reflected-in-the-2022-pew-global-attitudes-survey","CSET-foretell",false,"none","138","121"
|
||||||
|
"What percentage of U.S. AI publications will have a Chinese co-author in 2021?","https://www.cset-foretell.com/questions/86-what-percentage-of-u-s-ai-publications-will-be-u-s-china-collaborations-in-2021","CSET-foretell",false,"none","82","77"
|
||||||
|
"Will the U.S. government file an antitrust lawsuit against Apple, Amazon, or Facebook between January 20, 2021 and January 19, 2025?","https://www.cset-foretell.com/questions/89-conditional-on-vice-president-biden-s-election-will-the-u-s-government-file-an-antitrust-lawsuit-against-apple-amazon-or-facebook-between-january-20-2021-and-january-19-2025","CSET-foretell",true,"71%","120","89"
|
||||||
|
"What will the trade-to-GDP ratio for China be in the first two quarters of 2021?","https://www.cset-foretell.com/questions/84-what-will-the-ratio-of-trade-imports-exports-of-goods-to-gdp-be-china-in-the-first-two-quarters-january-1-through-june-30-of-2021","CSET-foretell",false,"none","53","42"
|
||||||
|
"What will the trade-to-GDP ratio for all OECD member countries be in the first two quarters of 2021?","https://www.cset-foretell.com/questions/83-what-will-the-ratio-of-trade-imports-exports-of-goods-to-gdp-be-for-oecd-member-countries-in-the-first-two-quarters-january-1-through-june-30-of-2021","CSET-foretell",false,"none","47","34"
|
||||||
|
"What percentage of U.S. residents will have an unfavorable view of China, as reflected in the 2021 Pew Global Attitudes Survey?","https://www.cset-foretell.com/questions/80-what-percentage-of-u-s-citizens-will-have-an-unfavorable-view-of-china-as-reflected-in-the-2021-pew-global-attitudes-survey","CSET-foretell",false,"none","200","158"
|
||||||
|
"What percentage of O visas will go to Chinese nationals in FY 2021 (October 1, 2020 to September 30, 2021)?","https://www.cset-foretell.com/questions/79-conditional-on-biden-s-election-what-percentage-of-o-visas-will-go-to-chinese-nationals-in-fy-2021-october-1-2020-to-september-30-2021","CSET-foretell",false,"none","84","68"
|
||||||
|
"What will total U.S. trade volume with China (imports and exports of goods) be in 2021?","https://www.cset-foretell.com/questions/76-what-will-total-u-s-trade-volume-with-china-imports-and-exports-of-goods-be-in-2021","CSET-foretell",false,"none","80","61"
|
||||||
|
"What percentage of U.S. corporate press releases about AI will reference AI ethics in 2021?","https://www.cset-foretell.com/questions/45-what-percent-of-u-s-corporate-press-releases-about-ai-will-be-about-ai-ethics-in-2021","CSET-foretell",false,"none","169","126"
|
||||||
|
"How much will the U.S. government spend on surveillance-related AI grants between June 1, 2020 and May 31, 2021, inclusive?","https://www.cset-foretell.com/questions/41-how-much-will-the-u-s-government-spend-on-surveillance-related-ai-grants-between-june-1-2020-and-may-31-2021-inclusive","CSET-foretell",false,"none","79","62"
|
||||||
|
"How many times will the Japanese Air Force respond to threats to Japan's territorial airspace by Chinese military aircraft between April 1, 2020 and March 31, 2021, inclusive?","https://www.cset-foretell.com/questions/32-how-many-sorties-against-chinese-aircraft-will-the-japanese-air-self-defense-force-conduct-by-april-30th-2020","CSET-foretell",false,"none","85","55"
|
||||||
|
"How many new H-1B visa applications submitted by the ""Big 5"" tech companies will the U.S. grant between October 1, 2020 and September 30, 2021, inclusive?","https://www.cset-foretell.com/questions/23-how-many-new-h-1b-applications-submitted-by-the-big-5-tech-companies-will-the-u-s-grant-in-fy-2020","CSET-foretell",false,"none","119","75"
|
|
218
data/csetforetell-questions.json
Normal file
218
data/csetforetell-questions.json
Normal file
|
@ -0,0 +1,218 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Title": "How many AI papers will be posted on arXiv between July 1 and December 31, 2021, inclusive?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/103-how-many-ai-papers-will-be-posted-on-arxiv-between-july-1-and-december-31-2021-inclusive",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "11",
|
||||||
|
"# Forecasters": "11"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many members will the Alphabet Workers Union have by December 31, 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/105-how-many-members-will-the-alphabet-workers-union-have-by-december-31-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "25",
|
||||||
|
"# Forecasters": "25"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What percentage of U.S. news articles about AI will be about privacy and security between July 1 and December 31, 2021, inclusive?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/104-what-percentage-of-u-s-news-articles-about-ai-will-be-about-privacy-and-security-between-july-1-and-december-31-2021-inclusive",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "11",
|
||||||
|
"# Forecasters": "10"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will NVIDIA acquire Arm by March 31, 2022?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/102-will-nvidia-acquire-arm-by-march-30-2022",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "51%",
|
||||||
|
"# Forecasts": "38",
|
||||||
|
"# Forecasters": "31"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many of the top chipmakers in China will be subject to new export controls in 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/101-on-how-many-of-china-s-top-chipmakers-will-the-united-states-impose-new-export-controls-in-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "49",
|
||||||
|
"# Forecasters": "48"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What percentage of the combined revenue of the top five semiconductor manufacturing equipment producers will come from China in 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/100-what-percentage-of-the-collective-revenue-of-the-leading-semiconductor-manufacturing-equipment-producers-will-come-from-china-between-july-1-2020-and-june-30-2021-inclusive",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "43",
|
||||||
|
"# Forecasters": "41"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will the United States return to compliance with the 2015 Iran nuclear deal by December 31, 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/99-will-the-united-states-re-enter-the-2015-nuclear-deal-with-iran-by-december-31-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "65%",
|
||||||
|
"# Forecasts": "101",
|
||||||
|
"# Forecasters": "75"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will be the value, in dollars, of all Chinese imports of semiconductor manufacturing equipment in 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/95-what-will-be-the-value-in-dollars-of-all-chinese-imports-of-semiconductor-manufacturing-equipment-in-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "59",
|
||||||
|
"# Forecasters": "50"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "When will Ant Financial have an IPO in China or Hong Kong?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/97-when-will-ant-financial-have-an-ipo-in-china-or-hong-kong",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "131",
|
||||||
|
"# Forecasters": "98"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will be the value, in dollars, of all Chinese imports of semiconductor chips in 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/96-what-will-be-the-value-in-dollars-of-all-chinese-imports-of-semiconductor-chips-in-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "59",
|
||||||
|
"# Forecasters": "52"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will be the value, in dollars, of U.S. exports of semiconductor chips to China in the first half of 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/93-what-will-the-dollar-value-of-u-s-exports-of-semiconductor-chips-to-china-be-in-the-first-half-of-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "67",
|
||||||
|
"# Forecasters": "55"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will be the value, in dollars, of U.S. exports of semiconductor manufacturing equipment to China in the first half of 2021? ",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/92-what-will-the-dollar-value-of-u-s-exports-of-semiconductor-manufacturing-equipment-to-china-be-in-the-first-half-of-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "55",
|
||||||
|
"# Forecasters": "42"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What percentage of U.S. residents will have an unfavorable view of China, as reflected in the 2022 Pew Global Attitudes Survey?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/91-conditional-on-vice-president-biden-s-election-what-percentage-of-u-s-residents-will-have-an-unfavorable-view-of-china-as-reflected-in-the-2022-pew-global-attitudes-survey",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "138",
|
||||||
|
"# Forecasters": "121"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What percentage of U.S. AI publications will have a Chinese co-author in 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/86-what-percentage-of-u-s-ai-publications-will-be-u-s-china-collaborations-in-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "82",
|
||||||
|
"# Forecasters": "77"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will the U.S. government file an antitrust lawsuit against Apple, Amazon, or Facebook between January 20, 2021 and January 19, 2025?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/89-conditional-on-vice-president-biden-s-election-will-the-u-s-government-file-an-antitrust-lawsuit-against-apple-amazon-or-facebook-between-january-20-2021-and-january-19-2025",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "71%",
|
||||||
|
"# Forecasts": "120",
|
||||||
|
"# Forecasters": "89"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will the trade-to-GDP ratio for China be in the first two quarters of 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/84-what-will-the-ratio-of-trade-imports-exports-of-goods-to-gdp-be-china-in-the-first-two-quarters-january-1-through-june-30-of-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "53",
|
||||||
|
"# Forecasters": "42"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will the trade-to-GDP ratio for all OECD member countries be in the first two quarters of 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/83-what-will-the-ratio-of-trade-imports-exports-of-goods-to-gdp-be-for-oecd-member-countries-in-the-first-two-quarters-january-1-through-june-30-of-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "47",
|
||||||
|
"# Forecasters": "34"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What percentage of U.S. residents will have an unfavorable view of China, as reflected in the 2021 Pew Global Attitudes Survey?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/80-what-percentage-of-u-s-citizens-will-have-an-unfavorable-view-of-china-as-reflected-in-the-2021-pew-global-attitudes-survey",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "200",
|
||||||
|
"# Forecasters": "158"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What percentage of O visas will go to Chinese nationals in FY 2021 (October 1, 2020 to September 30, 2021)?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/79-conditional-on-biden-s-election-what-percentage-of-o-visas-will-go-to-chinese-nationals-in-fy-2021-october-1-2020-to-september-30-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "84",
|
||||||
|
"# Forecasters": "68"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will total U.S. trade volume with China (imports and exports of goods) be in 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/76-what-will-total-u-s-trade-volume-with-china-imports-and-exports-of-goods-be-in-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "80",
|
||||||
|
"# Forecasters": "61"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What percentage of U.S. corporate press releases about AI will reference AI ethics in 2021?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/45-what-percent-of-u-s-corporate-press-releases-about-ai-will-be-about-ai-ethics-in-2021",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "169",
|
||||||
|
"# Forecasters": "126"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How much will the U.S. government spend on surveillance-related AI grants between June 1, 2020 and May 31, 2021, inclusive?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/41-how-much-will-the-u-s-government-spend-on-surveillance-related-ai-grants-between-june-1-2020-and-may-31-2021-inclusive",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "79",
|
||||||
|
"# Forecasters": "62"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many times will the Japanese Air Force respond to threats to Japan's territorial airspace by Chinese military aircraft between April 1, 2020 and March 31, 2021, inclusive?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/32-how-many-sorties-against-chinese-aircraft-will-the-japanese-air-self-defense-force-conduct-by-april-30th-2020",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "85",
|
||||||
|
"# Forecasters": "55"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many new H-1B visa applications submitted by the \"Big 5\" tech companies will the U.S. grant between October 1, 2020 and September 30, 2021, inclusive?",
|
||||||
|
"URL": "https://www.cset-foretell.com/questions/23-how-many-new-h-1b-applications-submitted-by-the-big-5-tech-companies-will-the-u-s-grant-in-fy-2020",
|
||||||
|
"Platform": "CSET-foretell",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "119",
|
||||||
|
"# Forecasters": "75"
|
||||||
|
}
|
||||||
|
]
|
20431
data/elicit-binary_export.csv
Normal file
20431
data/elicit-binary_export.csv
Normal file
File diff suppressed because it is too large
Load Diff
348
data/elicit-questions.csv
Normal file
348
data/elicit-questions.csv
Normal file
|
@ -0,0 +1,348 @@
|
||||||
|
"Title","URL","Platform","Binary question?","Percentage","# Forecasts","# Forecasters"
|
||||||
|
"Will there be more than 50 prediction questions embedded in LessWrong posts and comments this month?","https://elicit.org/binary?binaryQuestions.search=Will%20there be more than 50 prediction questions embedded in LessWrong posts and comments this month?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"56.34%",336,138
|
||||||
|
"Will more than 50 people predict on this post?","https://elicit.org/binary?binaryQuestions.search=Will%20more than 50 people predict on this post?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"81.86%",227,120
|
||||||
|
"Will AGI cause an existential catastrophe?","https://elicit.org/binary?binaryQuestions.search=Will%20AGI cause an existential catastrophe?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"36.85%",158,102
|
||||||
|
"Will AGI cause an existential catastrophe without additional intervention from the existing AI Alignment research community?","https://elicit.org/binary?binaryQuestions.search=Will%20AGI cause an existential catastrophe without additional intervention from the existing AI Alignment research community?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"52.70%",137,95
|
||||||
|
"Will there be an arms race dynamic in the lead-up to AGI?","https://elicit.org/binary?binaryQuestions.search=Will%20there be an arms race dynamic in the lead-up to AGI?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"75.52%",113,91
|
||||||
|
"The new English Strain is at least 50% more infectious than the currently dominant American strain of Covid-19","https://elicit.org/binary?binaryQuestions.search=The%20new English Strain is at least 50% more infectious than the currently dominant American strain of Covid-19&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"62.91%",207,89
|
||||||
|
"Will a single AGI or AGI project achieve a decisive strategic advantage?","https://elicit.org/binary?binaryQuestions.search=Will%20a single AGI or AGI project achieve a decisive strategic advantage?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"61.63%",115,86
|
||||||
|
"How vivid is your visual imagination?","https://elicit.org/binary?binaryQuestions.search=How%20vivid is your visual imagination?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"50.68%",119,77
|
||||||
|
"Will we get AGI from deep learning with small variations, without more insights on a similar level to deep learning?","https://elicit.org/binary?binaryQuestions.search=Will%20we get AGI from deep learning with small variations, without more insights on a similar level to deep learning?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"33.50%",110,77
|
||||||
|
"Will > 50% of AGI researchers agree with safety concerns by 2030?","https://elicit.org/binary?binaryQuestions.search=Will%20> 50% of AGI researchers agree with safety concerns by 2030?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"42.70%",107,76
|
||||||
|
"Will we experience an existential catastrophe before we build AGI?","https://elicit.org/binary?binaryQuestions.search=Will%20we experience an existential catastrophe before we build AGI?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"11.79%",100,75
|
||||||
|
"How vivid is your sound imagination?","https://elicit.org/binary?binaryQuestions.search=How%20vivid is your sound imagination?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"61.17%",106,74
|
||||||
|
"Will there be another AI Winter (a period commonly referred to as such) before we develop AGI?","https://elicit.org/binary?binaryQuestions.search=Will%20there be another AI Winter (a period commonly referred to as such) before we develop AGI?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"28.63%",95,72
|
||||||
|
"Will we get AGI from 1-3 more insights on a similar level to deep learning?","https://elicit.org/binary?binaryQuestions.search=Will%20we get AGI from 1-3 more insights on a similar level to deep learning?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"43.12%",112,71
|
||||||
|
"There will be an additional distinct large wave of Covid-19 infections in the United States 2021","https://elicit.org/binary?binaryQuestions.search=There%20will be an additional distinct large wave of Covid-19 infections in the United States 2021&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"60.43%",145,69
|
||||||
|
"How vivid is your taste imagination?","https://elicit.org/binary?binaryQuestions.search=How%20vivid is your taste imagination?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"25.73%",84,69
|
||||||
|
"How vivid is your smell imagination?","https://elicit.org/binary?binaryQuestions.search=How%20vivid is your smell imagination?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"25.41%",82,68
|
||||||
|
"Will we need > 3 breakthroughs on a similar level to deep learning to get AGI?","https://elicit.org/binary?binaryQuestions.search=Will%20we need > 3 breakthroughs on a similar level to deep learning to get AGI?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"25.38%",84,67
|
||||||
|
"Do you have a type of Synaesthesia?","https://elicit.org/binary?binaryQuestions.search=Do%20you have a type of Synaesthesia?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"19.76%",87,66
|
||||||
|
"How frequently do you think in words?","https://elicit.org/binary?binaryQuestions.search=How%20frequently do you think in words?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"78.13%",86,66
|
||||||
|
"Do you have an internal monologue?","https://elicit.org/binary?binaryQuestions.search=Do%20you have an internal monologue?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"82.28%",80,63
|
||||||
|
"How vivid is your touch imagination?","https://elicit.org/binary?binaryQuestions.search=How%20vivid is your touch imagination?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"36.13%",79,62
|
||||||
|
"How good is your memory?","https://elicit.org/binary?binaryQuestions.search=How%20good is your memory?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"53.25%",77,61
|
||||||
|
"How much control do you have over your mind?","https://elicit.org/binary?binaryQuestions.search=How%20much control do you have over your mind?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"45.59%",76,61
|
||||||
|
"Before reaching AGI, will we hit a point where we can no longer improve AI capabilities by scaling?","https://elicit.org/binary?binaryQuestions.search=Before%20reaching AGI, will we hit a point where we can no longer improve AI capabilities by scaling?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"42.76%",85,57
|
||||||
|
"Trump will win a second term","https://elicit.org/binary?binaryQuestions.search=Trump%20will win a second term&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"46.20%",74,54
|
||||||
|
"Before reaching AGI, will we hit a point where we can no longer improve AI capabilities by scaling because we are unable to continue scaling?","https://elicit.org/binary?binaryQuestions.search=Before%20reaching AGI, will we hit a point where we can no longer improve AI capabilities by scaling because we are unable to continue scaling?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"24.51%",75,52
|
||||||
|
"Before reaching AGI, will we hit a point where we can no longer improve AI capabilities by scaling because the increase in AI capabilities from scaling plateaus?","https://elicit.org/binary?binaryQuestions.search=Before%20reaching AGI, will we hit a point where we can no longer improve AI capabilities by scaling because the increase in AI capabilities from scaling plateaus?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"31.56%",66,52
|
||||||
|
"Will the Hedonometer show an average happiness above 6.2 for Christmas day 2020?","https://elicit.org/binary?binaryQuestions.search=Will%20the Hedonometer show an average happiness above 6.2 for Christmas day 2020?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"32.77%",93,49
|
||||||
|
"Will the post ""Embedded Interactive Predictions on LessWrong"" get more than 80 karma by December 1st?","https://elicit.org/binary?binaryQuestions.search=Will%20the post ""Embedded Interactive Predictions on LessWrong"" get more than 80 karma by December 1st?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"89.52%",83,45
|
||||||
|
"Will interest in a January forecasting club be greater than 3.5/5?","https://elicit.org/binary?binaryQuestions.search=Will%20interest in a January forecasting club be greater than 3.5/5?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"55.93%",44,41
|
||||||
|
"Having a button/prompt for Elicit on LW would increase usage by at least 5x","https://elicit.org/binary?binaryQuestions.search=Having%20a button/prompt for Elicit on LW would increase usage by at least 5x&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"60.22%",41,37
|
||||||
|
"By 2025 bitcoin will no longer be the highest traded cryptocurrency. ","https://elicit.org/binary?binaryQuestions.search=By%202025 bitcoin will no longer be the highest traded cryptocurrency. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"55.49%",37,35
|
||||||
|
"A Singularity will not occur by the year 2040.","https://elicit.org/binary?binaryQuestions.search=A%20Singularity will not occur by the year 2040.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"68.71%",42,34
|
||||||
|
"Will there be a 4 year interval in which world GDP doubles before the first 1 year interval in which world GDP doubles?","https://elicit.org/binary?binaryQuestions.search=Will%20there be a 4 year interval in which world GDP doubles before the first 1 year interval in which world GDP doubles?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"61.12%",42,33
|
||||||
|
"Before 2025, most of Russia will become part of the United States, or the reverse, or they will in some other manner become the same sovereign state, or part of the same sovereign state","https://elicit.org/binary?binaryQuestions.search=Before%202025, most of Russia will become part of the United States, or the reverse, or they will in some other manner become the same sovereign state, or part of the same sovereign state&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"0.79%",34,32
|
||||||
|
"The Pope will be assassinated.","https://elicit.org/binary?binaryQuestions.search=The%20Pope will be assassinated.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"3.03%",32,30
|
||||||
|
"""There will only be three languages in the world - English, Spanish and Mandarin"" --Bill Walker, BBC","https://elicit.org/binary?binaryQuestions.search=""There%20will only be three languages in the world - English, Spanish and Mandarin"" --Bill Walker, BBC&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"2.91%",33,29
|
||||||
|
"The real identity of Nakamoto Satoshi will be publicly known by 2022","https://elicit.org/binary?binaryQuestions.search=The%20real identity of Nakamoto Satoshi will be publicly known by 2022&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"38.97%",31,29
|
||||||
|
"PredictionBook will still survive by the end of 2020","https://elicit.org/binary?binaryQuestions.search=PredictionBook%20will still survive by the end of 2020&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"83.00%",40,29
|
||||||
|
"Will AGI cause existential catastrophe conditional on there being a 4 year period of doubling of world GDP before a 1 year period of doubling?","https://elicit.org/binary?binaryQuestions.search=Will%20AGI cause existential catastrophe conditional on there being a 4 year period of doubling of world GDP before a 1 year period of doubling?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"36.91%",34,29
|
||||||
|
"Will there be a 4 year interval in which world GDP growth doubles before the first 1 year interval in which world GDP growth doubles?","https://elicit.org/binary?binaryQuestions.search=Will%20there be a 4 year interval in which world GDP growth doubles before the first 1 year interval in which world GDP growth doubles?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"47.38%",47,28
|
||||||
|
"Will LessWrong add a button to embed interactive predictions before 2021-07-01?","https://elicit.org/binary?binaryQuestions.search=Will%20LessWrong add a button to embed interactive predictions before 2021-07-01?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"54.94%",47,28
|
||||||
|
"Will AGI cause existential catastrophe conditional on there being a 1 year period of doubling of world GDP without there first being a 4 year period of doubling?","https://elicit.org/binary?binaryQuestions.search=Will%20AGI cause existential catastrophe conditional on there being a 1 year period of doubling of world GDP without there first being a 4 year period of doubling?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"47.00%",34,28
|
||||||
|
"Flying cars will become the dominant form of transportation in at least one major world city by 2035. ","https://elicit.org/binary?binaryQuestions.search=Flying%20cars will become the dominant form of transportation in at least one major world city by 2035. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"8.81%",31,28
|
||||||
|
"No nuclear weapon will be used for the remainder of this decade. (Does not count tests)","https://elicit.org/binary?binaryQuestions.search=No%20nuclear weapon will be used for the remainder of this decade. (Does not count tests)&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"82.13%",32,28
|
||||||
|
"No military draft in the United States before 2020.","https://elicit.org/binary?binaryQuestions.search=No%20military draft in the United States before 2020.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"90.27%",33,28
|
||||||
|
"Before 2030 organised religions will no longer exist in any meaningful way and religion will no longer have any political influence.","https://elicit.org/binary?binaryQuestions.search=Before%202030 organised religions will no longer exist in any meaningful way and religion will no longer have any political influence.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"8.68%",28,27
|
||||||
|
"Edward Snowden will be U.S. President before 2034","https://elicit.org/binary?binaryQuestions.search=Edward%20Snowden will be U.S. President before 2034&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"0.23%",26,26
|
||||||
|
"Will AGI cause existential catastrophe conditional on there being a 4 year period of doubling of world GDP growth before a 1 year period of doubling?","https://elicit.org/binary?binaryQuestions.search=Will%20AGI cause existential catastrophe conditional on there being a 4 year period of doubling of world GDP growth before a 1 year period of doubling?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"40.24%",42,26
|
||||||
|
"California will secede from the United States before 2021","https://elicit.org/binary?binaryQuestions.search=California%20will secede from the United States before 2021&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"0.68%",34,26
|
||||||
|
"Trump wins Nobel","https://elicit.org/binary?binaryQuestions.search=Trump%20wins Nobel&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"10.55%",38,26
|
||||||
|
"Bitcoin was an official NSA or CIA project.","https://elicit.org/binary?binaryQuestions.search=Bitcoin%20was an official NSA or CIA project.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"1.88%",26,25
|
||||||
|
"Will AGI cause existential catastrophe conditional on there being a 1 year period of doubling of world GDP growth without there first being a 4 year period of doubling?","https://elicit.org/binary?binaryQuestions.search=Will%20AGI cause existential catastrophe conditional on there being a 1 year period of doubling of world GDP growth without there first being a 4 year period of doubling?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"46.84%",32,24
|
||||||
|
"""I predict that by 2020, China will ban foreign men from entering China, except for special cases.""","https://elicit.org/binary?binaryQuestions.search=""I%20predict that by 2020, China will ban foreign men from entering China, except for special cases.""&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"9.69%",26,23
|
||||||
|
"Queen Elizabeth II will abdicate before her death.","https://elicit.org/binary?binaryQuestions.search=Queen%20Elizabeth II will abdicate before her death.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"7.46%",26,23
|
||||||
|
"The Singularity will occur by 2050.","https://elicit.org/binary?binaryQuestions.search=The%20Singularity will occur by 2050.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"35.12%",25,23
|
||||||
|
"50% chance of AI by 2028 --Shane Legg","https://elicit.org/binary?binaryQuestions.search=50%%20chance of AI by 2028 --Shane Legg&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"24.39%",28,23
|
||||||
|
"Computer Go running on commodity hardware (<$2k) to reach world champion level (>=9 dan) by 2030","https://elicit.org/binary?binaryQuestions.search=Computer%20Go running on commodity hardware (<$2k) to reach world champion level (>=9 dan) by 2030&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"84.11%",27,22
|
||||||
|
"Will there be an ""Inverse AlphaFold"" by end of 2025?","https://elicit.org/binary?binaryQuestions.search=Will%20there be an ""Inverse AlphaFold"" by end of 2025?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"33.91%",33,22
|
||||||
|
"PredictionBook.com will be up and running 10 years from today - 5/31/2023 - with this individual prediction still accessible.","https://elicit.org/binary?binaryQuestions.search=PredictionBook.com%20will be up and running 10 years from today - 5/31/2023 - with this individual prediction still accessible.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"68.88%",25,22
|
||||||
|
"Polyamory will have legal status in the USA similar to 2013's gay marriage by 2035.","https://elicit.org/binary?binaryQuestions.search=Polyamory%20will have legal status in the USA similar to 2013's gay marriage by 2035.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"19.35%",23,22
|
||||||
|
"By 2020, Eliezer Yudkowsky will have given up building friendly AI.","https://elicit.org/binary?binaryQuestions.search=By%202020, Eliezer Yudkowsky will have given up building friendly AI.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"6.67%",24,22
|
||||||
|
"TurnTrout will use the Elicit embedding on LessWrong for a non-prediction question by 28-11-2020","https://elicit.org/binary?binaryQuestions.search=TurnTrout%20will use the Elicit embedding on LessWrong for a non-prediction question by 28-11-2020&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"58.15%",39,21
|
||||||
|
"For most of history, a human attempting to use reasoning to do things like cooking, crafting, or planning (instead of using inherited cultural heuristics, like omens or folk wisdom), would have been substantially worse off, and faced a major increase in their risk of death (without a commensurate increase in life quality).","https://elicit.org/binary?binaryQuestions.search=For%20most of history, a human attempting to use reasoning to do things like cooking, crafting, or planning (instead of using inherited cultural heuristics, like omens or folk wisdom), would have been substantially worse off, and faced a major increase in their risk of death (without a commensurate increase in life quality).&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"59.38%",32,21
|
||||||
|
"In 2070 there will be a human alive with age 150 or older.","https://elicit.org/binary?binaryQuestions.search=In%202070 there will be a human alive with age 150 or older.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"26.36%",25,21
|
||||||
|
"Most babies born in 2022 do not have Zika virus.","https://elicit.org/binary?binaryQuestions.search=Most%20babies born in 2022 do not have Zika virus.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"99.41%",22,21
|
||||||
|
"China and Japan will engage in armed conflict with each other resulting in > 1,000 deaths before 2023.","https://elicit.org/binary?binaryQuestions.search=China%20and Japan will engage in armed conflict with each other resulting in > 1,000 deaths before 2023.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"7.45%",22,20
|
||||||
|
"Chess will be solved within 10 years, and the end result will be a draw for Black.","https://elicit.org/binary?binaryQuestions.search=Chess%20will be solved within 10 years, and the end result will be a draw for Black.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"15.33%",21,20
|
||||||
|
"Homo sapiens will be near or fully extinct by 2100.","https://elicit.org/binary?binaryQuestions.search=Homo%20sapiens will be near or fully extinct by 2100.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"21.64%",22,20
|
||||||
|
"Google will survive for 15 more years","https://elicit.org/binary?binaryQuestions.search=Google%20will survive for 15 more years&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"88.38%",21,20
|
||||||
|
"Before 2020 organized religions will have no political influence.","https://elicit.org/binary?binaryQuestions.search=Before%202020 organized religions will have no political influence.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"11.68%",22,20
|
||||||
|
"Magick qua magick works AND hinges on the intersection between quantum physics and decision theory.","https://elicit.org/binary?binaryQuestions.search=Magick%20qua magick works AND hinges on the intersection between quantum physics and decision theory.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"4.74%",23,20
|
||||||
|
"Background knowledge and motivation levels being equal, humans will learn how to perform new tasks at roughly equal rates.","https://elicit.org/binary?binaryQuestions.search=Background%20knowledge and motivation levels being equal, humans will learn how to perform new tasks at roughly equal rates.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"18.43%",23,19
|
||||||
|
"Robin Hanson: In 2032, less than 50% of cars on the road will completely autonomous. (to be assessed by asking an unbiased expert if the answer is not obvious) ","https://elicit.org/binary?binaryQuestions.search=Robin%20Hanson: In 2032, less than 50% of cars on the road will completely autonomous. (to be assessed by asking an unbiased expert if the answer is not obvious) &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"54.20%",20,19
|
||||||
|
"Machiavellian Intelligence Hypothesis: humans evolved big brains in order to succeed at social manuevering and climbing dominance hierarchies.","https://elicit.org/binary?binaryQuestions.search=Machiavellian%20Intelligence Hypothesis: humans evolved big brains in order to succeed at social manuevering and climbing dominance hierarchies.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"60.07%",30,19
|
||||||
|
"Conditional on the AI community learning of pre-AGI catastrophic deceptive misalignment, will the ($ spent on AI alignment research)/($ spent on AI research) ratio increase by more than 50% over the two years following the catastrophe?","https://elicit.org/binary?binaryQuestions.search=Conditional%20on the AI community learning of pre-AGI catastrophic deceptive misalignment, will the ($ spent on AI alignment research)/($ spent on AI research) ratio increase by more than 50% over the two years following the catastrophe?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"39.69%",35,18
|
||||||
|
"Before AGI, will we learn of an example of catastrophic deceptive misalignment?","https://elicit.org/binary?binaryQuestions.search=Before%20AGI, will we learn of an example of catastrophic deceptive misalignment?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"56.94%",35,19
|
||||||
|
"No human revived from cryonic suspension by 2040.","https://elicit.org/binary?binaryQuestions.search=No%20human revived from cryonic suspension by 2040.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"86.75%",24,19
|
||||||
|
"Brexit will cause hundreds of thousands of deaths from mass starvation in the UK --Charlie Stross","https://elicit.org/binary?binaryQuestions.search=Brexit%20will cause hundreds of thousands of deaths from mass starvation in the UK --Charlie Stross&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"2.21%",19,19
|
||||||
|
"United States will invade Australia and take over","https://elicit.org/binary?binaryQuestions.search=United%20States will invade Australia and take over&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"10.00%",21,19
|
||||||
|
"90% chance of AI by 2050 --Shane Legg","https://elicit.org/binary?binaryQuestions.search=90%%20chance of AI by 2050 --Shane Legg&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"47.05%",21,19
|
||||||
|
"Contrary to my left leanings, Man Made Global Warming will be proved incorrect by 2022","https://elicit.org/binary?binaryQuestions.search=Contrary%20to my left leanings, Man Made Global Warming will be proved incorrect by 2022&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"6.95%",20,19
|
||||||
|
"No human will visit the moon from 2012-2020.","https://elicit.org/binary?binaryQuestions.search=No%20human will visit the moon from 2012-2020.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"74.85%",20,19
|
||||||
|
"The United States will contain exactly 50 states by 2025.","https://elicit.org/binary?binaryQuestions.search=The%20United States will contain exactly 50 states by 2025.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"72.43%",23,19
|
||||||
|
"Will First Contact happen in the form of a message (e.g. radio waves), rather than by physical visitors?","https://elicit.org/binary?binaryQuestions.search=Will%20First Contact happen in the form of a message (e.g. radio waves), rather than by physical visitors?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"64.80%",40,18
|
||||||
|
"Cultural Intelligence Hypothesis: humans evolved big brains in order to be able to maintain [complicated, detailed, arbitrary-seeming cultural knowledge like 20+ step Inuit seal hunting techniques]. Everything that separates us from the apes is part of an evolutionary package designed to help us maintain this kind of culture, exploit this kind of culture, or adjust to the new abilities that this kind of culture gave us. ","https://elicit.org/binary?binaryQuestions.search=Cultural%20Intelligence Hypothesis: humans evolved big brains in order to be able to maintain [complicated, detailed, arbitrary-seeming cultural knowledge like 20+ step Inuit seal hunting techniques]. Everything that separates us from the apes is part of an evolutionary package designed to help us maintain this kind of culture, exploit this kind of culture, or adjust to the new abilities that this kind of culture gave us. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"34.33%",45,18
|
||||||
|
"Does Pareto frontier trick allow people to circumvent the Generalized Efficient Market hypothesis? That is, take people in the 98th percentile of intelligence. Are there a few separate fields such that they could become experts in each, with less than 10 years of total time investment... and then have a realistic shot at a big money/status windfall, with relatively little *marginal* effort.","https://elicit.org/binary?binaryQuestions.search=Does%20Pareto frontier trick allow people to circumvent the Generalized Efficient Market hypothesis? That is, take people in the 98th percentile of intelligence. Are there a few separate fields such that they could become experts in each, with less than 10 years of total time investment... and then have a realistic shot at a big money/status windfall, with relatively little *marginal* effort.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"69.74%",19,18
|
||||||
|
"The modern Scientific Revolution occurred in Europe between the 16th and 18th Centuries. Why did it not happen in China? Historian Toby Huff claims the reason is that China was unable to produce modern science primarily because a lack of the requisite intellectual freedom. Was he basically correct?","https://elicit.org/binary?binaryQuestions.search=The%20modern Scientific Revolution occurred in Europe between the 16th and 18th Centuries. Why did it not happen in China? Historian Toby Huff claims the reason is that China was unable to produce modern science primarily because a lack of the requisite intellectual freedom. Was he basically correct?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"36.67%",21,18
|
||||||
|
"What percentage of people experience a ""Clogged drainpipe"" effect in idea generation? (That is, they'd agree that they recognised the feeling as described in the post, after attempting a babble challenge)","https://elicit.org/binary?binaryQuestions.search=What%20percentage of people experience a ""Clogged drainpipe"" effect in idea generation? (That is, they'd agree that they recognised the feeling as described in the post, after attempting a babble challenge)&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"64.34%",50,18
|
||||||
|
"We will make First Contact before we will have AGI.","https://elicit.org/binary?binaryQuestions.search=We%20will make First Contact before we will have AGI.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"12.05%",21,18
|
||||||
|
"“No human will set his or her foot on Mars and return safely to earth before 2050.”","https://elicit.org/binary?binaryQuestions.search=“No%20human will set his or her foot on Mars and return safely to earth before 2050.”&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"40.27%",26,18
|
||||||
|
"Trump eventually signs an executive order forcing everyone to kneel in his presence","https://elicit.org/binary?binaryQuestions.search=Trump%20eventually signs an executive order forcing everyone to kneel in his presence&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"3.32%",22,18
|
||||||
|
"The percentage of people professing to be both athiest and agnostic will increase over the next decade","https://elicit.org/binary?binaryQuestions.search=The%20percentage of people professing to be both athiest and agnostic will increase over the next decade&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"67.55%",22,18
|
||||||
|
"Between 2016-2116, at least 1 American President will be neither Democratic or Republican.","https://elicit.org/binary?binaryQuestions.search=Between%202016-2116, at least 1 American President will be neither Democratic or Republican.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"51.78%",18,18
|
||||||
|
"There will be driverless taxis available for use by the public in at least one US city in 2023.","https://elicit.org/binary?binaryQuestions.search=There%20will be driverless taxis available for use by the public in at least one US city in 2023.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"64.28%",18,18
|
||||||
|
"A Level 7 (Chernobyl/2011 Japan level) nuclear accident will take place by end of 2020.","https://elicit.org/binary?binaryQuestions.search=A%20Level 7 (Chernobyl/2011 Japan level) nuclear accident will take place by end of 2020.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"21.62%",21,17
|
||||||
|
"Another version: roughly, everything that top-humans can learn, most humans can too if they actually tried. That is, there is psychological unity of humankind in what we can learn, but not necessarily what we have learned. By contrast, a mouse really couldn't learn chess, even if they tried. And in turn, no human can learn to play 90-dimensional chess, unlike the hypothetical superintelligences that can.","https://elicit.org/binary?binaryQuestions.search=Another%20version: roughly, everything that top-humans can learn, most humans can too if they actually tried. That is, there is psychological unity of humankind in what we can learn, but not necessarily what we have learned. By contrast, a mouse really couldn't learn chess, even if they tried. And in turn, no human can learn to play 90-dimensional chess, unlike the hypothetical superintelligences that can.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"29.78%",32,17
|
||||||
|
"It will be illegal to drive yourself on USA public roads ","https://elicit.org/binary?binaryQuestions.search=It%20will be illegal to drive yourself on USA public roads &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"1.72%",18,17
|
||||||
|
"My net financial worth will be greater than 10 million (2012-inflation adjusted), or enough to indefinitely earn a passive income to provide 100 people with cryonics, (whichever of the two is greater), by 2028","https://elicit.org/binary?binaryQuestions.search=My%20net financial worth will be greater than 10 million (2012-inflation adjusted), or enough to indefinitely earn a passive income to provide 100 people with cryonics, (whichever of the two is greater), by 2028&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"8.39%",18,17
|
||||||
|
"The Millennium Prize for solving P Versus NP will remain unclaimed by 2020.","https://elicit.org/binary?binaryQuestions.search=The%20Millennium Prize for solving P Versus NP will remain unclaimed by 2020.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"83.95%",21,17
|
||||||
|
"Nuclear power plants will no longer operate by the year 2020.","https://elicit.org/binary?binaryQuestions.search=Nuclear%20power plants will no longer operate by the year 2020.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"12.79%",19,17
|
||||||
|
"aliens invade earth in 2023","https://elicit.org/binary?binaryQuestions.search=aliens%20invade earth in 2023&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"0.94%",18,17
|
||||||
|
"Robin Hanson's brain will be cryogenically frozen.","https://elicit.org/binary?binaryQuestions.search=Robin%20Hanson's brain will be cryogenically frozen.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"47.17%",23,17
|
||||||
|
"...be an environmental disaster.","https://elicit.org/binary?binaryQuestions.search=...be%20an environmental disaster.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"30.95%",19,17
|
||||||
|
"Russia will not have established moon bases by 2032","https://elicit.org/binary?binaryQuestions.search=Russia%20will not have established moon bases by 2032&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"69.33%",18,17
|
||||||
|
"'2021 The first humans land on Mars.' --Arthur C. Clarke","https://elicit.org/binary?binaryQuestions.search='2021%20The first humans land on Mars.' --Arthur C. Clarke&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"1.80%",25,17
|
||||||
|
"Human-level artificial general intelligence by 2030","https://elicit.org/binary?binaryQuestions.search=Human-level%20artificial general intelligence by 2030&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"26.89%",19,17
|
||||||
|
"A professional athlete will voluntarily amputate their legs to use prosthetics like Oscar Pistorius, by 2021","https://elicit.org/binary?binaryQuestions.search=A%20professional athlete will voluntarily amputate their legs to use prosthetics like Oscar Pistorius, by 2021&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"30.95%",20,17
|
||||||
|
"“One or more space agencies will send a manned mission to Mars by 2035.”","https://elicit.org/binary?binaryQuestions.search=“One%20or more space agencies will send a manned mission to Mars by 2035.”&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"35.00%",23,17
|
||||||
|
"An open atheist will be elected US President within 20 years.","https://elicit.org/binary?binaryQuestions.search=An%20open atheist will be elected US President within 20 years.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"8.12%",17,16
|
||||||
|
"Information recorded in the predictionbook will be practically retrievable ""in ten thousand years, or so""","https://elicit.org/binary?binaryQuestions.search=Information%20recorded in the predictionbook will be practically retrievable ""in ten thousand years, or so""&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"19.11%",19,16
|
||||||
|
"If we receive a message from outer space, will it be in a form already accessible today (e.g., radio waves)?","https://elicit.org/binary?binaryQuestions.search=If%20we receive a message from outer space, will it be in a form already accessible today (e.g., radio waves)?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"77.71%",17,16
|
||||||
|
"By 2026 we will be technically capable of fixing arbitrary single-gene disorders - sickle cell anaemia, Huntington's, cystic fibrosis, Tay-Sachs, muscular dystrophy... - in living humans, with close to zero risk of severe complications.","https://elicit.org/binary?binaryQuestions.search=By%202026 we will be technically capable of fixing arbitrary single-gene disorders - sickle cell anaemia, Huntington's, cystic fibrosis, Tay-Sachs, muscular dystrophy... - in living humans, with close to zero risk of severe complications.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"34.67%",18,16
|
||||||
|
"US presidents term limits abolished","https://elicit.org/binary?binaryQuestions.search=US%20presidents term limits abolished&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"2.24%",17,16
|
||||||
|
"The strategy-stealing assumption is ""a good enough approximation that we can basically act as if it’s true"". That is, for any strategy an unaligned AI could use to influence the long-run future, there is an analogous strategy that a similarly-sized group of humans can use in order to capture a similar amount of flexible influence over the future. By “flexible” is meant that humans can decide later what to do with that influence (which is important since humans don’t yet know what we want in the long run).","https://elicit.org/binary?binaryQuestions.search=The%20strategy-stealing assumption is ""a good enough approximation that we can basically act as if it’s true"". That is, for any strategy an unaligned AI could use to influence the long-run future, there is an analogous strategy that a similarly-sized group of humans can use in order to capture a similar amount of flexible influence over the future. By “flexible” is meant that humans can decide later what to do with that influence (which is important since humans don’t yet know what we want in the long run).&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"29.04%",24,16
|
||||||
|
"Will the UK terrorism threat level be ‘severe’ at 9am PST on Sun 11/22?","https://elicit.org/binary?binaryQuestions.search=Will%20the UK terrorism threat level be ‘severe’ at 9am PST on Sun 11/22?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"81.00%",24,16
|
||||||
|
"Man will travel to Mars by 2030. ","https://elicit.org/binary?binaryQuestions.search=Man%20will travel to Mars by 2030. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"42.89%",18,16
|
||||||
|
"Legal challenges initiated by the Donald Trump campaign will not change the outcome of the US Presidential election","https://elicit.org/binary?binaryQuestions.search=Legal%20challenges initiated by the Donald Trump campaign will not change the outcome of the US Presidential election&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"95.32%",19,16
|
||||||
|
"Some people living today (October 17th, 2009) will also be alive on October 17th, 3009.","https://elicit.org/binary?binaryQuestions.search=Some%20people living today (October 17th, 2009) will also be alive on October 17th, 3009.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"35.53%",19,16
|
||||||
|
"Elon Musk will come out as trans (MtF or MtX)","https://elicit.org/binary?binaryQuestions.search=Elon%20Musk will come out as trans (MtF or MtX)&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"4.13%",16,16
|
||||||
|
"A Mars colony will be established in 2026. It will be an International establishment.","https://elicit.org/binary?binaryQuestions.search=A%20Mars colony will be established in 2026. It will be an International establishment.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"4.90%",20,16
|
||||||
|
"An alive human has been on mars soil and returned to earth safely before year 2100.","https://elicit.org/binary?binaryQuestions.search=An%20alive human has been on mars soil and returned to earth safely before year 2100.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"57.78%",18,16
|
||||||
|
"Kamala Harris will be president on Nov. 1, 2021.","https://elicit.org/binary?binaryQuestions.search=Kamala%20Harris will be president on Nov. 1, 2021.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"11.81%",16,15
|
||||||
|
"If a message from outer space is detected, will we answer it?","https://elicit.org/binary?binaryQuestions.search=If%20a message from outer space is detected, will we answer it?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"73.94%",17,15
|
||||||
|
"If we answer it, will it be a single answer sent by all of humanity?","https://elicit.org/binary?binaryQuestions.search=If%20we answer it, will it be a single answer sent by all of humanity?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"29.44%",16,15
|
||||||
|
"If First Contact yields information beyond current human knowledge, will it be shared and made available for all humans?","https://elicit.org/binary?binaryQuestions.search=If%20First Contact yields information beyond current human knowledge, will it be shared and made available for all humans?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"66.47%",17,15
|
||||||
|
"Will the title of the New York Times front page article on Sun 11/22 include any of the words: ‘coronavirus,’ ‘COVID-19,’ ‘COVID,’ or ‘SARS-CoV-2’?","https://elicit.org/binary?binaryQuestions.search=Will%20the title of the New York Times front page article on Sun 11/22 include any of the words: ‘coronavirus,’ ‘COVID-19,’ ‘COVID,’ or ‘SARS-CoV-2’?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"25.33%",24,15
|
||||||
|
"Extraterrestrial life will be confirmed on at least one body by 2050. ","https://elicit.org/binary?binaryQuestions.search=Extraterrestrial%20 life will be confirmed on at least one body by 2050. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"55.18%",17,15
|
||||||
|
"Overall, in 2019, biosecurity in the context of catastrophic risks had been underfunded and underdiscussed.","https://elicit.org/binary?binaryQuestions.search=Overall,%20in 2019, biosecurity in the context of catastrophic risks had been underfunded and underdiscussed.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"80.50%",18,15
|
||||||
|
"Ghislane Maxwell will die by the end of the year 12/31","https://elicit.org/binary?binaryQuestions.search=Ghislane%20Maxwell will die by the end of the year 12/31&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"14.48%",25,15
|
||||||
|
"...substantially improve current housing shortages and rent prices by 2035. ","https://elicit.org/binary?binaryQuestions.search=...substantially%20improve current housing shortages and rent prices by 2035. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"64.47%",15,15
|
||||||
|
"The Great Filter is the discovery of AGI, because it destroys their creators (us humans).","https://elicit.org/binary?binaryQuestions.search=The%20Great Filter is the discovery of AGI, because it destroys their creators (us humans).&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"28.00%",20,15
|
||||||
|
"A CRISPR-edited human baby will be born by 2020","https://elicit.org/binary?binaryQuestions.search=A%20CRISPR-edited human baby will be born by 2020&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"43.47%",19,15
|
||||||
|
"Are there simple changes to chimps (or other animals) that would make them much better at accumulating culture?","https://elicit.org/binary?binaryQuestions.search=Are%20there simple changes to chimps (or other animals) that would make them much better at accumulating culture?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"56.90%",29,15
|
||||||
|
"Will humans continually pursue all simple yet powerful changes to our AIs?","https://elicit.org/binary?binaryQuestions.search=Will%20humans continually pursue all simple yet powerful changes to our AIs?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"59.36%",25,15
|
||||||
|
"Mark Zuckerberg, co-founder of Facebook, is President of the United States before 2026","https://elicit.org/binary?binaryQuestions.search=Mark%20Zuckerberg, co-founder of Facebook, is President of the United States before 2026&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"3.71%",17,15
|
||||||
|
"There will NOT be a ""World War III"" within the next 10 years. (Between Russia and it's ""allies"" and NATO and/or western europe)","https://elicit.org/binary?binaryQuestions.search=There%20will NOT be a ""World War III"" within the next 10 years. (Between Russia and it's ""allies"" and NATO and/or western europe)&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"93.31%",16,15
|
||||||
|
"C still widely in use in the 2020s","https://elicit.org/binary?binaryQuestions.search=C%20still widely in use in the 2020s&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"93.53%",15,15
|
||||||
|
"USA will collapse before the People's Republic of China.","https://elicit.org/binary?binaryQuestions.search=USA%20will collapse before the People's Republic of China.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"41.47%",17,15
|
||||||
|
"Jesus will not come down from the heavens to judge mankind in my life time, my childrens life time, or my grand-childrens life time.","https://elicit.org/binary?binaryQuestions.search=Jesus%20will not come down from the heavens to judge mankind in my life time, my childrens life time, or my grand-childrens life time.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"92.69%",16,15
|
||||||
|
"""by 2030 we should have the capability to upload a person’s consciousness to a computer system""","https://elicit.org/binary?binaryQuestions.search=""by%202030 we should have the capability to upload a person’s consciousness to a computer system""&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"6.20%",15,14
|
||||||
|
"Will we understand the content of a message from outer space?","https://elicit.org/binary?binaryQuestions.search=Will%20we understand the content of a message from outer space?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"47.39%",18,14
|
||||||
|
"The United States will reach less than 3% unemployment at some point within the next 15 years.","https://elicit.org/binary?binaryQuestions.search=The%20United States will reach less than 3% unemployment at some point within the next 15 years.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"11.73%",15,14
|
||||||
|
"Gay marriage will remain legal throughout a Trump presidency.","https://elicit.org/binary?binaryQuestions.search=Gay%20marriage will remain legal throughout a Trump presidency.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"87.18%",17,14
|
||||||
|
"Banning of incandescent light bulbs globally by 2022.Incandescent lightbulbs will not be bought, manufactured or sold legally.
|
||||||
|
","https://elicit.org/binary?binaryQuestions.search=Banning%20of incandescent light bulbs globally by 2022.Incandescent lightbulbs will not be bought, manufactured or sold legally.
|
||||||
|
&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"11.19%",16,14
|
||||||
|
"If First Contact is in physical form, will the ETI be in biological form?","https://elicit.org/binary?binaryQuestions.search=If%20First Contact is in physical form, will the ETI be in biological form?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"17.39%",18,14
|
||||||
|
"The message begins with ""Execute this algorithm on a computer today, or I will make your sun go supernova tomorrow"". Should we execute it?","https://elicit.org/binary?binaryQuestions.search=The%20message begins with ""Execute this algorithm on a computer today, or I will make your sun go supernova tomorrow"". Should we execute it?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"7.86%",14,14
|
||||||
|
"...cause a water shortage such that, in 2030, residents of the Bay Area would spend on average 100% more on water, after adjusting for inflation, compared to 2020. (In 2020 the average American spends around $200/year on water)","https://elicit.org/binary?binaryQuestions.search=...cause%20a water shortage such that, in 2030, residents of the Bay Area would spend on average 100% more on water, after adjusting for inflation, compared to 2020. (In 2020 the average American spends around $200/year on water)&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"18.07%",15,14
|
||||||
|
"Microsoft will release the source code to the current version of Windows under a free-software license.","https://elicit.org/binary?binaryQuestions.search=Microsoft%20will release the source code to the current version of Windows under a free-software license.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"14.00%",15,14
|
||||||
|
"In the next ten years, scientists will publish a paper in a refereed journal claiming to have experimentally moved matter faster than the speed of light. ","https://elicit.org/binary?binaryQuestions.search=In%20the next ten years, scientists will publish a paper in a refereed journal claiming to have experimentally moved matter faster than the speed of light. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"9.47%",15,14
|
||||||
|
"The next non-Democrat to win the White House will also be a non-Republican.","https://elicit.org/binary?binaryQuestions.search=The%20next non-Democrat to win the White House will also be a non-Republican.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"17.00%",15,14
|
||||||
|
"""Within ten years the SAT testing service will require students to take a blood test to prove they are not on cognitive enhancing drugs."" --James Miller","https://elicit.org/binary?binaryQuestions.search=""Within%20ten years the SAT testing service will require students to take a blood test to prove they are not on cognitive enhancing drugs."" --James Miller&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"9.55%",20,14
|
||||||
|
"I will not pass Eliezer in LW karma in the next 10 years.","https://elicit.org/binary?binaryQuestions.search=I%20will not pass Eliezer in LW karma in the next 10 years.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"82.20%",15,14
|
||||||
|
"The United States will contain less than 50 states by 2025.","https://elicit.org/binary?binaryQuestions.search=The%20United States will contain less than 50 states by 2025.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"9.82%",17,14
|
||||||
|
"North Korea invades South Korea before the end of 2020","https://elicit.org/binary?binaryQuestions.search=North%20Korea invades South Korea before the end of 2020&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"5.94%",17,14
|
||||||
|
"By 2022, autonomous drones will have been used by a government agency to kill someone.","https://elicit.org/binary?binaryQuestions.search=By%202022, autonomous drones will have been used by a government agency to kill someone.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"53.00%",14,14
|
||||||
|
"The United States will contain more than 50 states by 2025.","https://elicit.org/binary?binaryQuestions.search=The%20United States will contain more than 50 states by 2025.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"30.26%",19,14
|
||||||
|
"By mid-century, Mandarin will be more widely spoken in Africa than English. ","https://elicit.org/binary?binaryQuestions.search=By%20mid-century, Mandarin will be more widely spoken in Africa than English. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"28.21%",14,14
|
||||||
|
"Hacking and cyberterrorism will be punishable by death worldwide by Dec. 1, 2029.","https://elicit.org/binary?binaryQuestions.search=Hacking%20and cyberterrorism will be punishable by death worldwide by Dec. 1, 2029.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"7.00%",18,14
|
||||||
|
"A right wing billionaire is behind the creation of bitcoin.","https://elicit.org/binary?binaryQuestions.search=A%20right wing billionaire is behind the creation of bitcoin.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"8.79%",14,14
|
||||||
|
"By 2022, [almost] every new car will have broadband Internet. -- Alyssa Vance","https://elicit.org/binary?binaryQuestions.search=By%202022, [almost] every new car will have broadband Internet. -- Alyssa Vance&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"44.15%",13,13
|
||||||
|
"ETI is AGI","https://elicit.org/binary?binaryQuestions.search=ETI%20is AGI&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"84.61%",18,13
|
||||||
|
"Humanity still a thing in 2036","https://elicit.org/binary?binaryQuestions.search=Humanity%20still a thing in 2036&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"89.00%",13,13
|
||||||
|
"There be a ""SETI Winter"" before First Contact.","https://elicit.org/binary?binaryQuestions.search=There%20be a ""SETI Winter"" before First Contact.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"73.89%",19,13
|
||||||
|
"We will experience an existential catastrophe before First Contact.","https://elicit.org/binary?binaryQuestions.search=We%20will experience an existential catastrophe before First Contact.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"40.84%",19,13
|
||||||
|
"The tech will exist and be relatively safe for media to be uploaded directly into the human brain by 2026.","https://elicit.org/binary?binaryQuestions.search=The%20tech will exist and be relatively safe for media to be uploaded directly into the human brain by 2026.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"14.62%",13,13
|
||||||
|
"If First Contact is in physical form, will the ETI ""spaceship"" be larger than 1m in size?","https://elicit.org/binary?binaryQuestions.search=If%20First Contact is in physical form, will the ETI ""spaceship"" be larger than 1m in size?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"51.36%",14,13
|
||||||
|
"Before receiving a message from outer space, will we need a technological breakthrough (e.g., by discovering yet unknown elementary particles)","https://elicit.org/binary?binaryQuestions.search=Before%20receiving a message from outer space, will we need a technological breakthrough (e.g., by discovering yet unknown elementary particles)&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"29.33%",18,13
|
||||||
|
"Generic AI won't happen in the next 10 years.","https://elicit.org/binary?binaryQuestions.search=Generic%20AI won't happen in the next 10 years.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"85.31%",16,13
|
||||||
|
"Joe Biden is the sitting president 4 years from today","https://elicit.org/binary?binaryQuestions.search=Joe%20Biden is the sitting president 4 years from today&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"33.75%",16,13
|
||||||
|
"...create buildings where the expected yearly damage from earthquakes (both in terms of reduced quality of life and property destroyed) is >1.5x that of nearby buildings on old land.","https://elicit.org/binary?binaryQuestions.search=...create%20buildings where the expected yearly damage from earthquakes (both in terms of reduced quality of life and property destroyed) is >1.5x that of nearby buildings on old land.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"37.07%",15,13
|
||||||
|
"Will the number of active COVID cases in California increase by more than 15K between Fri 11/20 and Sun 11/22?","https://elicit.org/binary?binaryQuestions.search=Will%20the number of active COVID cases in California increase by more than 15K between Fri 11/20 and Sun 11/22?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"71.29%",21,13
|
||||||
|
"Reproductive human cloning widely socially accepted by 2040. -- Axel Boldt","https://elicit.org/binary?binaryQuestions.search=Reproductive%20human cloning widely socially accepted by 2040. -- Axel Boldt&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"32.06%",16,13
|
||||||
|
"""The Essential Workers"" (or similar subject) will be TIME Magazine's Person of the Year for 2020.","https://elicit.org/binary?binaryQuestions.search=""The%20Essential Workers"" (or similar subject) will be TIME Magazine's Person of the Year for 2020.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"40.27%",15,13
|
||||||
|
"North Korea will invade South Korea by January 1st, 2022","https://elicit.org/binary?binaryQuestions.search=North%20Korea will invade South Korea by January 1st, 2022&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"5.33%",15,13
|
||||||
|
"All children in the US must have GPS attached to them in some sense by law if they leave their parents house.","https://elicit.org/binary?binaryQuestions.search=All%20children in the US must have GPS attached to them in some sense by law if they leave their parents house.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"4.92%",13,13
|
||||||
|
"Average world IQ to decrease from 2015 to 2050","https://elicit.org/binary?binaryQuestions.search=Average%20world IQ to decrease from 2015 to 2050&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"29.79%",14,13
|
||||||
|
"...all-things-considered, be good for the world.","https://elicit.org/binary?binaryQuestions.search=...all-things-considered,%20be good for the world.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"81.32%",19,13
|
||||||
|
"Fusion Power will revolutionize the world energy demands by 2025.","https://elicit.org/binary?binaryQuestions.search=Fusion%20Power will revolutionize the world energy demands by 2025.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"9.47%",15,13
|
||||||
|
"Our descendants will colonize millions of star systems within ten thousand years or so. -- Robin Hanson","https://elicit.org/binary?binaryQuestions.search=Our%20descendants will colonize millions of star systems within ten thousand years or so. -- Robin Hanson&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"27.64%",14,13
|
||||||
|
"USA mints a coin worth $1,000,000,000 or more before 2021","https://elicit.org/binary?binaryQuestions.search=USA%20mints a coin worth $1,000,000,000 or more before 2021&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"4.50%",16,13
|
||||||
|
"Truly ""Pilotless"" air travel will be the standard in 2050.","https://elicit.org/binary?binaryQuestions.search=Truly%20""Pilotless"" air travel will be the standard in 2050.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"62.71%",14,13
|
||||||
|
"The Roman Catholic Church ordains female priests before 2033.","https://elicit.org/binary?binaryQuestions.search=The%20Roman Catholic Church ordains female priests before 2033.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"18.54%",13,13
|
||||||
|
"In the next ten years, self-identified Libertarians will outnumber self-identified Republicans in the US. ","https://elicit.org/binary?binaryQuestions.search=In%20the next ten years, self-identified Libertarians will outnumber self-identified Republicans in the US. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"14.69%",13,13
|
||||||
|
"Trump dies of COVID-19","https://elicit.org/binary?binaryQuestions.search=Trump%20dies of COVID-19&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"6.63%",32,13
|
||||||
|
"By 2030, mothers will be the primary breadwinner in the majority of households with children in the U.S.","https://elicit.org/binary?binaryQuestions.search=By%202030, mothers will be the primary breadwinner in the majority of households with children in the U.S.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"38.31%",13,13
|
||||||
|
"10 million","https://elicit.org/binary?binaryQuestions.search=10%20million&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"8.42%",36,13
|
||||||
|
"Human level AI by 2029 (Ray Kurzweil, ""How to create a mind"")","https://elicit.org/binary?binaryQuestions.search=Human%20level AI by 2029 (Ray Kurzweil, ""How to create a mind"")&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"26.75%",16,13
|
||||||
|
"Saudi Arabian government collapses within the next 5 years.","https://elicit.org/binary?binaryQuestions.search=Saudi%20Arabian government collapses within the next 5 years.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"10.69%",16,13
|
||||||
|
"Satoshi Nakamoto is just Wei Dai and this is known before 2060","https://elicit.org/binary?binaryQuestions.search=Satoshi%20Nakamoto is just Wei Dai and this is known before 2060&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"13.37%",19,13
|
||||||
|
"By 2065, a majority of the world will be vegan. ","https://elicit.org/binary?binaryQuestions.search=By%202065, a majority of the world will be vegan. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"11.08%",13,13
|
||||||
|
"Steve Jobs' brain was cryopreserved or plastinated within two weeks of declaration of death, and this is known before 2070.","https://elicit.org/binary?binaryQuestions.search=Steve%20Jobs' brain was cryopreserved or plastinated within two weeks of declaration of death, and this is known before 2070.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"4.08%",13,13
|
||||||
|
"Kanye West elected President by 2032 -- Scott Adams","https://elicit.org/binary?binaryQuestions.search=Kanye%20West elected President by 2032 -- Scott Adams&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"0.60%",15,12
|
||||||
|
"If we find indications of a dormant artifact buried on the moon, should we dig it up?","https://elicit.org/binary?binaryQuestions.search=If%20we find indications of a dormant artifact buried on the moon, should we dig it up?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"70.00%",15,12
|
||||||
|
"If the message is not shared, will it yield a decisive advantage for its owner?","https://elicit.org/binary?binaryQuestions.search=If%20the message is not shared, will it yield a decisive advantage for its owner?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"43.11%",19,12
|
||||||
|
"The first person to set foot on Mars will have left Earth holding American citizenship.","https://elicit.org/binary?binaryQuestions.search=The%20first person to set foot on Mars will have left Earth holding American citizenship.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"46.69%",13,12
|
||||||
|
"Effective HIV vaccine developed by 2040. -- Axel Boldt","https://elicit.org/binary?binaryQuestions.search=Effective%20HIV vaccine developed by 2040. -- Axel Boldt&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"69.69%",13,12
|
||||||
|
"Will a message from outer space contain deep and profound information?","https://elicit.org/binary?binaryQuestions.search=Will%20a message from outer space contain deep and profound information?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"52.47%",15,12
|
||||||
|
"There will be a Youtube video with more views (on Youtube) than there will be living humans before 2020.","https://elicit.org/binary?binaryQuestions.search=There%20will be a Youtube video with more views (on Youtube) than there will be living humans before 2020.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"63.00%",13,12
|
||||||
|
"Joe Biden dies of coronavirus in 2020","https://elicit.org/binary?binaryQuestions.search=Joe%20Biden dies of coronavirus in 2020&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"4.64%",14,12
|
||||||
|
"In 2060 there will be a human alive with age 140 or older.","https://elicit.org/binary?binaryQuestions.search=In%202060 there will be a human alive with age 140 or older.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"46.07%",14,12
|
||||||
|
"North Korea and South Korea to unify by 2030","https://elicit.org/binary?binaryQuestions.search=North%20Korea and South Korea to unify by 2030&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"20.25%",16,12
|
||||||
|
"The European Union will unite into a single super state by 2030.","https://elicit.org/binary?binaryQuestions.search=The%20European Union will unite into a single super state by 2030.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"17.50%",14,12
|
||||||
|
"the average lifespan will be eighty-five to ninety in 2100. --S. Jay Olshansky","https://elicit.org/binary?binaryQuestions.search=the%20average lifespan will be eighty-five to ninety in 2100. --S. Jay Olshansky&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"7.64%",14,12
|
||||||
|
"No amendments to the United States Constitution will be ratified by 2030.","https://elicit.org/binary?binaryQuestions.search=No%20amendments to the United States Constitution will be ratified by 2030.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"60.83%",12,12
|
||||||
|
"...significantly worsen traffic in San Francisco.","https://elicit.org/binary?binaryQuestions.search=...significantly%20worsen traffic in San Francisco.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"58.67%",12,12
|
||||||
|
"Decision-makers in media and PR, and corporate and government elites generally, have a lower tolerance for verbal conflict and taboo violations than the typical individual.","https://elicit.org/binary?binaryQuestions.search=Decision-makers%20in media and PR, and corporate and government elites generally, have a lower tolerance for verbal conflict and taboo violations than the typical individual.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"79.65%",17,12
|
||||||
|
"Alphabet/Google buys Microsoft","https://elicit.org/binary?binaryQuestions.search=Alphabet/Google%20buys Microsoft&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"7.71%",14,12
|
||||||
|
"We will detect evidence of Intelligent alien life within the next 50 years. ","https://elicit.org/binary?binaryQuestions.search=We%20will detect evidence of Intelligent alien life within the next 50 years. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"24.33%",12,12
|
||||||
|
"“There will be a casino on the moon by 2040.”","https://elicit.org/binary?binaryQuestions.search=“There%20will be a casino on the moon by 2040.”&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"3.83%",12,12
|
||||||
|
"Will first contact cause an existential catastrophe?","https://elicit.org/binary?binaryQuestions.search=Will%20first contact cause an existential catastrophe?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"49.24%",33,12
|
||||||
|
"By 2020, there will be a new World government. --Ray Kurzweil","https://elicit.org/binary?binaryQuestions.search=By%202020, there will be a new World government. --Ray Kurzweil&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"2.73%",15,12
|
||||||
|
"100 million","https://elicit.org/binary?binaryQuestions.search=100%20million&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"0.79%",29,12
|
||||||
|
"Some modes of the Large Hadron collider will never be reached and by 2025 the scientific community will debate in a peer reviewed physics journal with >median impact that this is due to the anthropic principle combined with the danger of those modes.","https://elicit.org/binary?binaryQuestions.search=Some%20modes of the Large Hadron collider will never be reached and by 2025 the scientific community will debate in a peer reviewed physics journal with >median impact that this is due to the anthropic principle combined with the danger of those modes.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"14.33%",15,12
|
||||||
|
"1 year continuous human habitation of the moon","https://elicit.org/binary?binaryQuestions.search=1%20year continuous human habitation of the moon&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"15.93%",14,12
|
||||||
|
"If someone does experience a clogged drainpipe effect, is it possible to ""train it away""? That is, to, with 1000 hours of practice, get to a point where their life largely looks the same as it did before except that they report no longer experiencing the effect (and this is borne out by measures of # of quality-adjusted ideas babbled per time unit, or similar)? (It doesn't count if the only way of doing it is by, say, making sure to write 10 ideas every day, or something similar. I'm wondering if it's possible to change your cognition at a deep level, rather than using particular, deliberate, S2 techniques to sustain an equilibirum which you'd fall out of if you stopped using the techniques)","https://elicit.org/binary?binaryQuestions.search=If%20someone does experience a clogged drainpipe effect, is it possible to ""train it away""? That is, to, with 1000 hours of practice, get to a point where their life largely looks the same as it did before except that they report no longer experiencing the effect (and this is borne out by measures of # of quality-adjusted ideas babbled per time unit, or similar)? (It doesn't count if the only way of doing it is by, say, making sure to write 10 ideas every day, or something similar. I'm wondering if it's possible to change your cognition at a deep level, rather than using particular, deliberate, S2 techniques to sustain an equilibirum which you'd fall out of if you stopped using the techniques)&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"63.15%",26,13
|
||||||
|
"Lab-grown meat on sale at 20 times the price of animal-grown meat or cheaper.","https://elicit.org/binary?binaryQuestions.search=Lab-grown%20meat on sale at 20 times the price of animal-grown meat or cheaper.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"63.33%",15,12
|
||||||
|
"The world’s first lunar tourist by end of 2035","https://elicit.org/binary?binaryQuestions.search=The%20world’s first lunar tourist by end of 2035&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"51.07%",14,12
|
||||||
|
"At the end of the year, all SlateStarCodex archives are rehosted by Scott on SlateStarCodex or some other site (third-party created archives don't count) AND Scott has written at least one new post on SlateStarCodex or this new site","https://elicit.org/binary?binaryQuestions.search=At%20the end of the year, all SlateStarCodex archives are rehosted by Scott on SlateStarCodex or some other site (third-party created archives don't count) AND Scott has written at least one new post on SlateStarCodex or this new site&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"78.92%",13,12
|
||||||
|
"The world’s first lunar tourist by end of 2025","https://elicit.org/binary?binaryQuestions.search=The%20world’s first lunar tourist by end of 2025&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"30.40%",15,12
|
||||||
|
"""Mankind is unlikely to exist in anything like its present form in 2150."" -lukeprog","https://elicit.org/binary?binaryQuestions.search=""Mankind%20is unlikely to exist in anything like its present form in 2150."" -lukeprog&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"66.54%",13,12
|
||||||
|
"Simon Cowell will be cryogenically stored.","https://elicit.org/binary?binaryQuestions.search=Simon%20Cowell will be cryogenically stored.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"18.25%",12,12
|
||||||
|
"Russia will be an Islamic theocracy by 31 December 2050.","https://elicit.org/binary?binaryQuestions.search=Russia%20will be an Islamic theocracy by 31 December 2050.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"1.31%",13,12
|
||||||
|
"Riemann hypothesis proven by 2040. -- Axel Boldt","https://elicit.org/binary?binaryQuestions.search=Riemann%20hypothesis proven by 2040. -- Axel Boldt&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"37.08%",13,12
|
||||||
|
"“By 2030, commercial passengers will routinely fly in pilotless planes.”","https://elicit.org/binary?binaryQuestions.search=“By%202030, commercial passengers will routinely fly in pilotless planes.”&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"35.00%",12,12
|
||||||
|
"Donald Knuth will die before finishing TAOCP.","https://elicit.org/binary?binaryQuestions.search=Donald%20Knuth will die before finishing TAOCP.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"86.83%",12,12
|
||||||
|
"Warren Buffett: All cars on the road will be electric by year 2030","https://elicit.org/binary?binaryQuestions.search=Warren%20Buffett: All cars on the road will be electric by year 2030&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"33.58%",12,12
|
||||||
|
"'By the end of the decade, it will be clear that North Korea never had nuclear weapons under Kim Jong Il.' --Kevin","https://elicit.org/binary?binaryQuestions.search='By%20the end of the decade, it will be clear that North Korea never had nuclear weapons under Kim Jong Il.' --Kevin&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"14.17%",12,12
|
||||||
|
"The effect of First contact is mostly neutral (e.g., invisible, indifferent, uninteresting, mild nuisance )","https://elicit.org/binary?binaryQuestions.search=The%20effect of First contact is mostly neutral (e.g., invisible, indifferent, uninteresting, mild nuisance )&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"55.00%",26,11
|
||||||
|
"The effect of First contact is mostly harmful (e.g., selfish ETI, hazards) ","https://elicit.org/binary?binaryQuestions.search=The%20effect of First contact is mostly harmful (e.g., selfish ETI, hazards) &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"40.82%",22,11
|
||||||
|
"GRRM dies before finishing _A Song of Ice and Fire_","https://elicit.org/binary?binaryQuestions.search=GRRM%20dies before finishing _A Song of Ice and Fire_&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"41.54%",13,11
|
||||||
|
"""within 5 years of leaving office, the Obamas will have a net worth of more than $50 million."" --Dennis Mangan","https://elicit.org/binary?binaryQuestions.search=""within%205 years of leaving office, the Obamas will have a net worth of more than $50 million."" --Dennis Mangan&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"64.82%",11,11
|
||||||
|
"Will any of the NYT Coronavirus vaccine tracker numbers increase between 9am PST Fri 11/20 and 9am PST Sun 11/22?","https://elicit.org/binary?binaryQuestions.search=Will%20any of the NYT Coronavirus vaccine tracker numbers increase between 9am PST Fri 11/20 and 9am PST Sun 11/22?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"76.33%",15,11
|
||||||
|
"Arbital to become a top-1000 site by 2020","https://elicit.org/binary?binaryQuestions.search=Arbital%20to become a top-1000 site by 2020&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"9.00%",12,11
|
||||||
|
"Heterogenity of ETI: Are they all the ""same""? Over millions of years of evolution beyond humanity, have they evolved and converged to some ""final being""?","https://elicit.org/binary?binaryQuestions.search=Heterogenity%20of ETI: Are they all the ""same""? Over millions of years of evolution beyond humanity, have they evolved and converged to some ""final being""?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"26.27%",11,11
|
||||||
|
"The effect of First contact is mostly beneficial (e.g., cooperative or merely detectable)","https://elicit.org/binary?binaryQuestions.search=The%20effect of First contact is mostly beneficial (e.g., cooperative or merely detectable)&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"28.88%",25,11
|
||||||
|
"Will humans (at least one) leave the solar system within 10 years after First Contact?","https://elicit.org/binary?binaryQuestions.search=Will%20humans (at least one) leave the solar system within 10 years after First Contact?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"33.20%",15,11
|
||||||
|
"Will any LessWrong post made on Friday 11/20 get more than 100 karma by 9am PST on Sun 11/22?","https://elicit.org/binary?binaryQuestions.search=Will%20any LessWrong post made on Friday 11/20 get more than 100 karma by 9am PST on Sun 11/22?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"17.54%",13,11
|
||||||
|
"""In the next 10 years, I expect at least five billion people worldwide to own smartphones"" --Marc Andreessen","https://elicit.org/binary?binaryQuestions.search=""In%20the next 10 years, I expect at least five billion people worldwide to own smartphones"" --Marc Andreessen&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"75.17%",12,11
|
||||||
|
"A professional athlete will *not* voluntarily amputate their legs to use prosthetics like Oscar Pistorius, before 2041.","https://elicit.org/binary?binaryQuestions.search=A%20professional athlete will *not* voluntarily amputate their legs to use prosthetics like Oscar Pistorius, before 2041.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"38.64%",11,11
|
||||||
|
"At least 10 percent of people in the U.S. to be vegetarian (or in-vitro-ist) in 2030","https://elicit.org/binary?binaryQuestions.search=At%20least 10 percent of people in the U.S. to be vegetarian (or in-vitro-ist) in 2030&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"29.08%",12,11
|
||||||
|
"Germany to decommission all nuclear reactors by 2023","https://elicit.org/binary?binaryQuestions.search=Germany%20to decommission all nuclear reactors by 2023&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"57.00%",13,11
|
||||||
|
"The EA community has sometimes erred too much on the side of shutting down discussions of biology by turning them into discussions about info-hazards.","https://elicit.org/binary?binaryQuestions.search=The%20EA community has sometimes erred too much on the side of shutting down discussions of biology by turning them into discussions about info-hazards.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"76.77%",13,11
|
||||||
|
"The core cognitive loop that causes progress in accomplished Buddhists is basically cognitive behavioral therapy, supercharged with a mental state more intense than most pharmaceuticals.","https://elicit.org/binary?binaryQuestions.search=The%20core cognitive loop that causes progress in accomplished Buddhists is basically cognitive behavioral therapy, supercharged with a mental state more intense than most pharmaceuticals.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"44.63%",24,11
|
||||||
|
"Will legal factory farming end by January 1st 2100? ","https://elicit.org/binary?binaryQuestions.search=Will%20legal factory farming end by January 1st 2100? &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"23.38%",24,11
|
||||||
|
"“I predict that by 2030, China will lay an ownership claim to the entire moon.”- Kelly L Anderson","https://elicit.org/binary?binaryQuestions.search=“I%20predict that by 2030, China will lay an ownership claim to the entire moon.”- Kelly L Anderson&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"8.00%",11,11
|
||||||
|
"Intel will revolutionize computing by placing the first artificial quantum computer chip on the maket by 2025.","https://elicit.org/binary?binaryQuestions.search=Intel%20will revolutionize computing by placing the first artificial quantum computer chip on the maket by 2025.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"10.00%",14,11
|
||||||
|
"Caffeine will be an illegal substance ... in 60 countries by 2027. ","https://elicit.org/binary?binaryQuestions.search=Caffeine%20will be an illegal substance ... in 60 countries by 2027. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"5.42%",12,11
|
||||||
|
"Goldbach's conjecture proven by 2040. -- Axel Boldt","https://elicit.org/binary?binaryQuestions.search=Goldbach's%20conjecture proven by 2040. -- Axel Boldt&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"31.64%",11,11
|
||||||
|
"Machine translation no worse than human translation by 2040. -- Axel Boldt","https://elicit.org/binary?binaryQuestions.search=Machine%20translation no worse than human translation by 2040. -- Axel Boldt&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"65.93%",14,11
|
||||||
|
"Diagnosing standard medical conditions routinely involves DNA testing by 2040. -- Axel Boldt","https://elicit.org/binary?binaryQuestions.search=Diagnosing%20standard medical conditions routinely involves DNA testing by 2040. -- Axel Boldt&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"68.67%",12,11
|
||||||
|
"The world’s first lunar tourist by end of 2045","https://elicit.org/binary?binaryQuestions.search=The%20world’s first lunar tourist by end of 2045&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"56.86%",14,11
|
||||||
|
"They'll clone a woolly mammoth by 2040","https://elicit.org/binary?binaryQuestions.search=They'll%20clone a woolly mammoth by 2040&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"55.57%",14,11
|
||||||
|
"With the making of the North American Union, a new revolutionary technology will be developed in the attempt to set a colony on Mars. ","https://elicit.org/binary?binaryQuestions.search=With%20the making of the North American Union, a new revolutionary technology will be developed in the attempt to set a colony on Mars. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"8.92%",13,11
|
||||||
|
"Before 2030 organized religions will have no political influence.","https://elicit.org/binary?binaryQuestions.search=Before%202030 organized religions will have no political influence.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"10.29%",14,11
|
||||||
|
"“In the year 2050, there will not be an operating fusion power plant -- a device that generates net energy via a nuclear fusion reaction and transmits it to the electrical grid -- anywhere in the world.”","https://elicit.org/binary?binaryQuestions.search=“In%20the year 2050, there will not be an operating fusion power plant -- a device that generates net energy via a nuclear fusion reaction and transmits it to the electrical grid -- anywhere in the world.”&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"40.91%",11,11
|
||||||
|
"China will land a man on Mars by 2050.","https://elicit.org/binary?binaryQuestions.search=China%20will land a man on Mars by 2050.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"43.08%",13,11
|
||||||
|
"SIAI shuts down or relocates outside the United States before 2021.","https://elicit.org/binary?binaryQuestions.search=SIAI%20shuts down or relocates outside the United States before 2021.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"13.67%",12,11
|
||||||
|
"""At least one human alive in the year 2000 will still be alive in 2150.""","https://elicit.org/binary?binaryQuestions.search=""At%20least one human alive in the year 2000 will still be alive in 2150.""&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"56.21%",14,11
|
||||||
|
"""By March 25, 2033, there will be successful whole brain emulation.""","https://elicit.org/binary?binaryQuestions.search=""By%20March 25, 2033, there will be successful whole brain emulation.""&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"16.33%",12,11
|
||||||
|
"Neutrino communication will be used commercially for high-frequency trading within 10 years.","https://elicit.org/binary?binaryQuestions.search=Neutrino%20communication will be used commercially for high-frequency trading within 10 years.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"10.79%",14,11
|
||||||
|
"Trump will run for president in 2024","https://elicit.org/binary?binaryQuestions.search=Trump%20will run for president in 2024&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"20.38%",13,11
|
||||||
|
"Michelle Obama will run for office before 2021","https://elicit.org/binary?binaryQuestions.search=Michelle%20Obama will run for office before 2021&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"21.27%",11,11
|
||||||
|
"The LW user account ""Grognor"" will make a comment in a thread other than rationality quotes some time in the next ten years.","https://elicit.org/binary?binaryQuestions.search=The%20LW user account ""Grognor"" will make a comment in a thread other than rationality quotes some time in the next ten years.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"45.92%",13,11
|
||||||
|
"The phosphine detected on Venus is widely agreed among the scientific community to be from life.","https://elicit.org/binary?binaryQuestions.search=The%20phosphine detected on Venus is widely agreed among the scientific community to be from life.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"2.42%",12,11
|
||||||
|
"Republicans will win the 2024 presidential election","https://elicit.org/binary?binaryQuestions.search=Republicans%20will win the 2024 presidential election&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"45.69%",13,11
|
||||||
|
"Biden will resign sometime during the presidency conditional on him winning the election","https://elicit.org/binary?binaryQuestions.search=Biden%20will resign sometime during the presidency conditional on him winning the election&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"10.18%",11,11
|
||||||
|
"Trump wins the 2020 election.","https://elicit.org/binary?binaryQuestions.search=Trump%20wins the 2020 election.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"47.54%",13,11
|
||||||
|
"Significant third party challengers will temporally emerge within the next eight years in the USA.","https://elicit.org/binary?binaryQuestions.search=Significant%20third party challengers will temporally emerge within the next eight years in the USA.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"24.75%",12,11
|
||||||
|
"No amendments to the United States Constitution will be ratified by 2025.","https://elicit.org/binary?binaryQuestions.search=No%20amendments to the United States Constitution will be ratified by 2025.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"77.83%",12,11
|
||||||
|
"Joe Biden gets coronavirus in 2020","https://elicit.org/binary?binaryQuestions.search=Joe%20Biden gets coronavirus in 2020&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"28.09%",11,11
|
||||||
|
"50 million","https://elicit.org/binary?binaryQuestions.search=50%20million&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"1.65%",34,11
|
||||||
|
"Jeffrey Epstein was murdered and there is good evidence (e.g. footage or accepted confession or arrest warrant or conviction) that this was the case, before 2022","https://elicit.org/binary?binaryQuestions.search=Jeffrey%20Epstein was murdered and there is good evidence (e.g. footage or accepted confession or arrest warrant or conviction) that this was the case, before 2022&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"3.54%",13,11
|
||||||
|
"In 2033, more than 5% of deaths in China will be the result of state-mandated involuntary euthanasia.","https://elicit.org/binary?binaryQuestions.search=In%202033, more than 5% of deaths in China will be the result of state-mandated involuntary euthanasia.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"1.00%",11,11
|
||||||
|
"Human drivers will be illegal on *some* USA roads by 2030","https://elicit.org/binary?binaryQuestions.search=Human%20drivers will be illegal on *some* USA roads by 2030&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"44.08%",12,11
|
||||||
|
"People will choose virtual-reality clothes/make-up/accessories (like Snapchat filters), that are visible in real life to most people around them. This will be used by >10% of people, walking down the street, on dates, in business contexts.","https://elicit.org/binary?binaryQuestions.search=People%20will choose virtual-reality clothes/make-up/accessories (like Snapchat filters), that are visible in real life to most people around them. This will be used by >10% of people, walking down the street, on dates, in business contexts.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"33.09%",11,11
|
||||||
|
"We will still need human translators for serious translation work by 2040","https://elicit.org/binary?binaryQuestions.search=We%20will still need human translators for serious translation work by 2040&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"52.69%",13,11
|
||||||
|
"some portion of England and the United States will be unified as one country or similar state within 10 years","https://elicit.org/binary?binaryQuestions.search=some%20portion of England and the United States will be unified as one country or similar state within 10 years&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"3.77%",13,11
|
||||||
|
"The US will institute a minimum guaranteed income (aka basic guaranteed income, unconditional basic income, etc.) at a Federal level by 2045.","https://elicit.org/binary?binaryQuestions.search=The%20US will institute a minimum guaranteed income (aka basic guaranteed income, unconditional basic income, etc.) at a Federal level by 2045.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"28.43%",14,11
|
||||||
|
"""there is a 100% chance you will see a private corporation go to war with a small country, and win, within twenty years."" - Scott Adams","https://elicit.org/binary?binaryQuestions.search=""there%20is a 100% chance you will see a private corporation go to war with a small country, and win, within twenty years."" - Scott Adams&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"20.73%",11,11
|
||||||
|
"At least two commercial reactors supplying fusion power to the grid by 2030. ","https://elicit.org/binary?binaryQuestions.search=At%20least two commercial reactors supplying fusion power to the grid by 2030. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"23.67%",12,11
|
||||||
|
"By end of 2030, there will be commercially available self-driving cars in at least one OECD country where it will be legal to use them. ","https://elicit.org/binary?binaryQuestions.search=By%20end of 2030, there will be commercially available self-driving cars in at least one OECD country where it will be legal to use them. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"93.25%",12,11
|
||||||
|
"No fusion scheme will succeed until 2050, when ITER will be the first and only successful fusion scheme. Nothing else will even come close to meeting the triple product, nτT of ITER. There won't be a commercial fusion reactor in 2050 though, just a demo","https://elicit.org/binary?binaryQuestions.search=No%20fusion scheme will succeed until 2050, when ITER will be the first and only successful fusion scheme. Nothing else will even come close to meeting the triple product, nτT of ITER. There won't be a commercial fusion reactor in 2050 though, just a demo&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"45.31%",13,11
|
||||||
|
"By 2025, 20% of all US driving miles to be by self-driving cars. ","https://elicit.org/binary?binaryQuestions.search=By%202025, 20% of all US driving miles to be by self-driving cars. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"31.38%",13,11
|
||||||
|
"'President Mike Pence'","https://elicit.org/binary?binaryQuestions.search='President%20Mike Pence'&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"14.06%",16,11
|
||||||
|
"By 2050, a biologically functional but cosmetic novel body part produced by 3D printing technology will be demonstrated in a human, in vivo. For example: A horn, pointy ears, or an extra thumb. ","https://elicit.org/binary?binaryQuestions.search=By%202050, a biologically functional but cosmetic novel body part produced by 3D printing technology will be demonstrated in a human, in vivo. For example: A horn, pointy ears, or an extra thumb. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"75.09%",11,10
|
||||||
|
"Fewer than 30% of the US Population self-identify as Christians.
|
||||||
|
|
||||||
|
http://www.pewforum.org/2015/05/12/americas-changing-religious-landscape/","https://elicit.org/binary?binaryQuestions.search=Fewer%20than 30% of the US Population self-identify as Christians.
|
||||||
|
|
||||||
|
http://www.pewforum.org/2015/05/12/americas-changing-religious-landscape/&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"19.80%",10,10
|
||||||
|
"Trump dies of Coronavirus in 2020","https://elicit.org/binary?binaryQuestions.search=Trump%20dies of Coronavirus in 2020&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"1.36%",11,10
|
||||||
|
"Google self driving car will get in an accident (involving human injury or property damage > $2k) before end of 2018.","https://elicit.org/binary?binaryQuestions.search=Google%20self driving car will get in an accident (involving human injury or property damage > $2k) before end of 2018.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"48.00%",10,10
|
||||||
|
"Trump Elected and constitutional crisis with US military disobeying direct orders from POTUS","https://elicit.org/binary?binaryQuestions.search=Trump%20Elected and constitutional crisis with US military disobeying direct orders from POTUS&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"11.30%",10,10
|
||||||
|
"WWIII starts before 2030.","https://elicit.org/binary?binaryQuestions.search=WWIII%20starts before 2030.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"8.86%",14,10
|
||||||
|
"Caitlyn Jenner = POTUS","https://elicit.org/binary?binaryQuestions.search=Caitlyn%20Jenner = POTUS&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"4.20%",10,10
|
||||||
|
"Will this question get an answer, within a month, I judge as ""very insightful and directly relevant to how I approach Babble challenges in the future, enabling me to learn and grow faster?""","https://elicit.org/binary?binaryQuestions.search=Will%20this question get an answer, within a month, I judge as ""very insightful and directly relevant to how I approach Babble challenges in the future, enabling me to learn and grow faster?""&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"29.64%",11,10
|
||||||
|
"Airbnb to be acquired by 2025","https://elicit.org/binary?binaryQuestions.search=Airbnb%20to be acquired by 2025&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"34.64%",11,10
|
||||||
|
"Will Rob Wiblin post more than 12 tweets (not including retweets) between 9am PST on Fri 11/20 and 9am PST on Sun 11/22?","https://elicit.org/binary?binaryQuestions.search=Will%20Rob Wiblin post more than 12 tweets (not including retweets) between 9am PST on Fri 11/20 and 9am PST on Sun 11/22?&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"52.69%",13,10
|
||||||
|
"P!=NP, and proven by 2040 --Ken","https://elicit.org/binary?binaryQuestions.search=P!=NP,%20and proven by 2040 --Ken&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"44.17%",12,10
|
||||||
|
"Ecstasy (MDMA) will be legalized for prescription use in the U.S. by 2025. ","https://elicit.org/binary?binaryQuestions.search=Ecstasy%20(MDMA) will be legalized for prescription use in the U.S. by 2025. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"26.10%",10,10
|
||||||
|
"A working brain-to-brain direct communication interface will be demonstrated in human clinical trials by 2025.","https://elicit.org/binary?binaryQuestions.search=A%20working brain-to-brain direct communication interface will be demonstrated in human clinical trials by 2025.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"41.30%",10,10
|
||||||
|
"Advanced cultural skills are not very useful for species with sub-human levels of general cognitive skills and social skills.","https://elicit.org/binary?binaryQuestions.search=Advanced%20cultural skills are not very useful for species with sub-human levels of general cognitive skills and social skills.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"34.38%",16,10
|
||||||
|
"By 2050, there will be at least one person cryonically frozen in space.","https://elicit.org/binary?binaryQuestions.search=By%202050, there will be at least one person cryonically frozen in space.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"15.80%",10,10
|
||||||
|
"“By the year 2150, over 50% of schools in the USA or Western Europe will require classes in defending against robot attacks.”","https://elicit.org/binary?binaryQuestions.search=“By%20the year 2150, over 50% of schools in the USA or Western Europe will require classes in defending against robot attacks.”&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"7.42%",12,10
|
||||||
|
"We ask ETI ""do we live in a simulation""? They answer ""yes"".","https://elicit.org/binary?binaryQuestions.search=We%20ask ETI ""do we live in a simulation""? They answer ""yes"".&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"17.92%",13,10
|
||||||
|
"Robust mouse rejuvenation by 2020 -- Aubrey de Grey","https://elicit.org/binary?binaryQuestions.search=Robust%20mouse rejuvenation by 2020 -- Aubrey de Grey&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"13.14%",14,10
|
||||||
|
"SpaceX will launch a Mars orbit or flyby mission before 2021","https://elicit.org/binary?binaryQuestions.search=SpaceX%20will launch a Mars orbit or flyby mission before 2021&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"70.67%",12,10
|
||||||
|
"Advanced cultural skills are not directly selected for in species with sub-human levels of general cognitive skills and social skills.","https://elicit.org/binary?binaryQuestions.search=Advanced%20cultural skills are not directly selected for in species with sub-human levels of general cognitive skills and social skills.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"46.70%",10,10
|
||||||
|
"Advanced cultural skills are too complex for species with sub-human levels of general cognitive skills and social skills to acquire.","https://elicit.org/binary?binaryQuestions.search=Advanced%20cultural skills are too complex for species with sub-human levels of general cognitive skills and social skills to acquire.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"27.79%",14,10
|
||||||
|
"By 2085 there will be at least one confirmed person who has lived to 150","https://elicit.org/binary?binaryQuestions.search=By%202085 there will be at least one confirmed person who has lived to 150&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"33.46%",13,10
|
||||||
|
"EU to dissolve by 2040.","https://elicit.org/binary?binaryQuestions.search=EU%20to dissolve by 2040.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"39.45%",11,10
|
||||||
|
"Russia and Morocco have joined the European Union, and the EU slowly takes on the character of a nation; it has a common foreign policy and a standing army by 2040. -- Axel Boldt","https://elicit.org/binary?binaryQuestions.search=Russia%20and Morocco have joined the European Union, and the EU slowly takes on the character of a nation; it has a common foreign policy and a standing army by 2040. -- Axel Boldt&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"10.92%",12,10
|
||||||
|
"No human will visit the moon from 2012 to 2032","https://elicit.org/binary?binaryQuestions.search=No%20human will visit the moon from 2012 to 2032&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"52.73%",11,10
|
||||||
|
"By 2035, the general consensus will be that the US federal government orchestrated the 9/11 attacks. ","https://elicit.org/binary?binaryQuestions.search=By%202035, the general consensus will be that the US federal government orchestrated the 9/11 attacks. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"13.08%",12,10
|
||||||
|
"Within the next 1000 years we will discover that the singularity already happened a very long time ago and that we are the AIs that resulted from it.","https://elicit.org/binary?binaryQuestions.search=Within%20the next 1000 years we will discover that the singularity already happened a very long time ago and that we are the AIs that resulted from it.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"15.50%",12,10
|
||||||
|
"HIV will be eradicated by 2040 (Daniel Lemire)","https://elicit.org/binary?binaryQuestions.search=HIV%20will be eradicated by 2040 (Daniel Lemire)&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"56.91%",11,10
|
||||||
|
"A Confirmed SETI detection of an ET technological civilization.","https://elicit.org/binary?binaryQuestions.search=A%20Confirmed SETI detection of an ET technological civilization.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"12.09%",11,10
|
||||||
|
"By the time most of the world’s population has made the transition to a vegan or cultured-meat diet, the rearing of other sentient beings for human consumption will be illegal under international law. -- David Pearce","https://elicit.org/binary?binaryQuestions.search=By%20the time most of the world’s population has made the transition to a vegan or cultured-meat diet, the rearing of other sentient beings for human consumption will be illegal under international law. -- David Pearce&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"16.00%",10,10
|
||||||
|
"The First Domed City will exist before 2040. This will be the first above-ground structure since The third World War (WWIII).","https://elicit.org/binary?binaryQuestions.search=The%20First Domed City will exist before 2040. This will be the first above-ground structure since The third World War (WWIII).&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"6.09%",11,10
|
||||||
|
"HIV will be cured by 2025, but 5 new viruses deadlier than it will replace it.","https://elicit.org/binary?binaryQuestions.search=HIV%20will be cured by 2025, but 5 new viruses deadlier than it will replace it.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"7.09%",11,10
|
||||||
|
"Alien/Time travelling human presence revealed on 27th of March 2022","https://elicit.org/binary?binaryQuestions.search=Alien/Time%20travelling human presence revealed on 27th of March 2022&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"0.50%",10,10
|
||||||
|
"Generic molecular assemblers won't be developed within the next 20 years.
|
||||||
|
|
||||||
|
By “generic” I mean they can build macroscopic (≥ 10 mm³) objects for any reasonable function, and by “molecular” meaning 50%+ of chemical bonds don't come from bulk chemistry.","https://elicit.org/binary?binaryQuestions.search=Generic%20molecular assemblers won't be developed within the next 20 years.
|
||||||
|
|
||||||
|
By “generic” I mean they can build macroscopic (≥ 10 mm³) objects for any reasonable function, and by “molecular” meaning 50%+ of chemical bonds don't come from bulk chemistry.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"77.10%",10,10
|
||||||
|
"More than 50% of all passenger cars on the road are completely autonomous, self-driving vehicles.","https://elicit.org/binary?binaryQuestions.search=More%20than 50% of all passenger cars on the road are completely autonomous, self-driving vehicles.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"26.38%",13,10
|
||||||
|
"The Internet Archive will operate through 2025-07-01","https://elicit.org/binary?binaryQuestions.search=The%20Internet Archive will operate through 2025-07-01&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"78.90%",10,10
|
||||||
|
"“The End of State Sovereignty: By 2030, some form of international federation or global governmental structure will emerge that can exercise ultimate authority over world affairs.”","https://elicit.org/binary?binaryQuestions.search=“The%20End of State Sovereignty: By 2030, some form of international federation or global governmental structure will emerge that can exercise ultimate authority over world affairs.”&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"11.46%",13,10
|
||||||
|
"“China will break apart by 2030”","https://elicit.org/binary?binaryQuestions.search=“China%20will break apart by 2030”&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"24.60%",10,10
|
||||||
|
"Scotland holds another independence referendum in the next 5 years. ","https://elicit.org/binary?binaryQuestions.search=Scotland%20holds another independence referendum in the next 5 years. &binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"55.60%",10,10
|
||||||
|
"In 10 years I will think Reddit/LW-style reputational/karma systems will be a bad thing (compared to non-karma systems like OB).","https://elicit.org/binary?binaryQuestions.search=In%2010 years I will think Reddit/LW-style reputational/karma systems will be a bad thing (compared to non-karma systems like OB).&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"20.40%",10,10
|
||||||
|
"homosexuality criminalized in the US","https://elicit.org/binary?binaryQuestions.search=homosexuality%20criminalized in the US&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"2.50%",10,10
|
||||||
|
"By the end of 2063, the consumption of meat from animals will be illegal in at least one area of Europe or North America with a population of at least 100,000","https://elicit.org/binary?binaryQuestions.search=By%20the end of 2063, the consumption of meat from animals will be illegal in at least one area of Europe or North America with a population of at least 100,000&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"60.36%",11,10
|
||||||
|
"Larry King's brain will be cryopreserved or plastinated within 2 weeks of declaration of death, and this is known before 2070","https://elicit.org/binary?binaryQuestions.search=Larry%20King's brain will be cryopreserved or plastinated within 2 weeks of declaration of death, and this is known before 2070&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"22.08%",12,10
|
||||||
|
""". The revenue for higher ed is falling into a black hole. I predict that by 2021 the whole enterprise will cease to exist in anything resembling its current form."" --Dan King","https://elicit.org/binary?binaryQuestions.search="".%20The revenue for higher ed is falling into a black hole. I predict that by 2021 the whole enterprise will cease to exist in anything resembling its current form."" --Dan King&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"11.46%",13,10
|
||||||
|
"By 2030 the Singularity Institute for Artificial Intelligence will have given up on friendly AI and instead focus on fail-safe mechanisms.","https://elicit.org/binary?binaryQuestions.search=By%202030 the Singularity Institute for Artificial Intelligence will have given up on friendly AI and instead focus on fail-safe mechanisms.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"30.90%",10,10
|
||||||
|
"Reservatrol or a chemically similar compound will be an accepted anti-aging treatment in humans by 2025","https://elicit.org/binary?binaryQuestions.search=Reservatrol%20or a chemically similar compound will be an accepted anti-aging treatment in humans by 2025&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"29.08%",13,10
|
||||||
|
"Elon Musk has sent a crewed mission to Mars","https://elicit.org/binary?binaryQuestions.search=Elon%20Musk has sent a crewed mission to Mars&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"17.30%",10,10
|
||||||
|
"In 2038 the population of the US will be 2 billion, none of them illegal. -Moldbug","https://elicit.org/binary?binaryQuestions.search=In%202038 the population of the US will be 2 billion, none of them illegal. -Moldbug&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"9.36%",14,10
|
||||||
|
"Mars to have detectable non-anthropogenic life on it","https://elicit.org/binary?binaryQuestions.search=Mars%20to have detectable non-anthropogenic life on it&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"21.70%",10,10
|
||||||
|
"1,000,000+ planets will have been cataloged by 2035","https://elicit.org/binary?binaryQuestions.search=1,000,000+%20planets will have been cataloged by 2035&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"41.08%",13,10
|
||||||
|
"At least one self-described ""anarchist"" will be voted into a national office in the United States by 2021.","https://elicit.org/binary?binaryQuestions.search=At%20least one self-described ""anarchist"" will be voted into a national office in the United States by 2021.&binaryQuestions.sortBy=popularity&limit=20&offset=0","Elicit",true,"36.82%",11,10
|
|
3035
data/elicit-questions.json
Normal file
3035
data/elicit-questions.json
Normal file
File diff suppressed because it is too large
Load Diff
116
data/goodjudmentopen-questions.csv
Normal file
116
data/goodjudmentopen-questions.csv
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
"Title","URL","Platform","Binary question?","Percentage","# Forecasts","# Forecasters"
|
||||||
|
"Which NFL team will win Super Bowl LV?","https://www.gjopen.com/questions/1898-which-nfl-team-will-win-super-bowl-lv","Good Judgment Open",false,"none","51","38"
|
||||||
|
"Will North Macedonia announce that it has completed its census before 1 October 2021?","https://www.gjopen.com/questions/1897-will-north-macedonia-announce-that-it-has-completed-its-census-before-1-october-2021","Good Judgment Open",true,"50%","19","17"
|
||||||
|
"Will the New START treaty be extended by Russia and the U.S. before 6 February 2021?","https://www.gjopen.com/questions/1899-will-the-new-start-treaty-be-extended-by-russia-and-the-u-s-before-6-february-2021","Good Judgment Open",true,"95%","68","44"
|
||||||
|
"Will Mexico hold a referendum on President Andrés Manuel López Obrador before 1 September 2021?","https://www.gjopen.com/questions/1895-will-mexico-hold-a-referendum-on-president-andres-manuel-lopez-obrador-before-1-september-2021","Good Judgment Open",false,"none","25","20"
|
||||||
|
"Before 1 October 2021, will any group of Amazon employees in the U.S. vote in the affirmative to form a union?","https://www.gjopen.com/questions/1894-before-1-october-2021-will-any-group-of-amazon-employees-in-the-u-s-vote-in-the-affirmative-to-form-a-union","Good Judgment Open",true,"66%","44","37"
|
||||||
|
"Will the U.S. leveraged loan default rate reach or exceed 5.0% before 1 September 2021?","https://www.gjopen.com/questions/1896-will-the-u-s-leveraged-loan-default-rate-reach-or-exceed-5-0-before-1-september-2021","Good Judgment Open",true,"47%","45","34"
|
||||||
|
"Will Daniel Ortega cease to be the president of Nicaragua before 11 January 2022?","https://www.gjopen.com/questions/1891-will-daniel-ortega-be-cease-to-be-the-president-of-nicaragua-before-11-january-2022","Good Judgment Open",true,"1%","44","27"
|
||||||
|
"Before 15 March 2021, will there be a lethal confrontation between the national military forces of Iran and the United States either in Iran or at sea?","https://www.gjopen.com/questions/1892-before-15-march-2021-will-there-be-a-lethal-confrontation-between-the-national-military-forces-of-iran-and-the-united-states-either-in-iran-or-at-sea","Good Judgment Open",true,"2%","86","78"
|
||||||
|
"When will AMC Entertainment Holdings Inc. (AMC), the parent company of AMC Theatres, file for bankruptcy?","https://www.gjopen.com/questions/1893-when-will-amc-entertainment-holdings-inc-amc-the-parent-company-of-amc-theatres-file-for-bankruptcy","Good Judgment Open",false,"none","40","30"
|
||||||
|
"At close of business on 31 December 2021, will Apple be the most valuable publicly traded company in the world?","https://www.gjopen.com/questions/1884-at-close-of-business-on-31-december-2021-will-apple-be-the-most-valuable-publicly-traded-company-in-the-world","Good Judgment Open",false,"none","76","65"
|
||||||
|
"Which team will win the World Cup qualifying match between Nicaragua and St. Lucia?","https://www.gjopen.com/questions/1885-which-team-will-win-the-world-cup-qualifying-match-between-nicaragua-and-st-lucia","Good Judgment Open",false,"none","63","52"
|
||||||
|
"How many seats in the Legislative Assembly will New Ideas (Nuevas Ideas) win in the 2021 Salvadoran legislative election?","https://www.gjopen.com/questions/1889-how-many-seats-in-the-legislative-assembly-will-new-ideas-nuevas-ideas-win-in-the-2021-salvadoran-legislative-election","Good Judgment Open",false,"none","19","11"
|
||||||
|
"What will be the closing price of Mercado Libre stock on 15 February 2021?","https://www.gjopen.com/questions/1888-what-will-be-the-closing-price-of-mercado-libre-stock-on-15-february-2021","Good Judgment Open",false,"none","57","28"
|
||||||
|
"How many confirmed cases of COVID-19 will have been reported by the World Health Organization (WHO) for the Americas Region as of 1 February 2021?","https://www.gjopen.com/questions/1887-how-many-confirmed-cases-of-covid-19-will-have-been-reported-by-the-world-health-organization-who-for-the-americas-region-as-of-1-february-2021","Good Judgment Open",false,"none","190","83"
|
||||||
|
"How many confirmed cases of COVID-19 will have been reported by the World Health Organization (WHO) for the United Kingdom as of 1 February 2021?","https://www.gjopen.com/questions/1886-how-many-confirmed-cases-of-covid-19-will-have-been-reported-by-the-world-health-organization-who-for-the-united-kingdom-as-of-1-february-2021","Good Judgment Open",false,"none","232","94"
|
||||||
|
"What will be the closing yield for the 30-year U.S. Treasury on 31 December 2021?","https://www.gjopen.com/questions/1883-what-will-be-the-closing-yield-for-the-30-year-u-s-treasury-on-31-december-2021","Good Judgment Open",false,"none","85","50"
|
||||||
|
"Will legislation amending or repealing Section 230 of the Communications Act of 1934 become law before 14 August 2021?","https://www.gjopen.com/questions/1882-will-legislation-amending-or-repealing-section-230-of-the-communications-act-of-1934-become-law-before-14-august-2021","Good Judgment Open",true,"18%","96","62"
|
||||||
|
"When will Mexico’s Chamber of Deputies approve the Federal Law for the Regulation of Cannabis?","https://www.gjopen.com/questions/1890-when-will-mexico-s-chamber-of-deputies-approve-the-federal-law-for-the-regulation-of-cannabis","Good Judgment Open",false,"none","17","15"
|
||||||
|
"On 1 March 2021, how many states will have a number of daily new COVID-19 cases per 100k residents of 75.0 or higher?","https://www.gjopen.com/questions/1881-on-1-march-2021-how-many-states-will-have-a-number-of-daily-new-covid-19-cases-per-100k-residents-of-75-0-or-higher","Good Judgment Open",false,"none","181","83"
|
||||||
|
"On 1 March 2021, how many states will have a COVID-19 positivity rate greater than 10.0%?","https://www.gjopen.com/questions/1880-on-1-march-2021-how-many-states-will-have-a-covid-19-positivity-rate-greater-than-10-0","Good Judgment Open",false,"none","124","67"
|
||||||
|
"Before 1 April 2021, will an election be held for Israel's Knesset?","https://www.gjopen.com/questions/1879-before-1-april-2021-will-an-election-be-held-for-israel-s-knesset","Good Judgment Open",false,"none","166","114"
|
||||||
|
"At close of business on 28 April 2021, will the upper limit of the Federal Reserve's target range for the federal funds rate be lower, the same, or higher than it was at close of business on 17 March 2021?","https://www.gjopen.com/questions/1877-at-close-of-business-on-28-april-2021-will-the-upper-limit-of-the-federal-reserve-s-target-range-for-the-federal-funds-rate-be-lower-the-same-or-higher-than-it-was-at-close-of-business-on-17-march-2021","Good Judgment Open",false,"none","79","68"
|
||||||
|
"Before 1 January 2022, will the Diem Association, co-founded by Facebook, launch a stablecoin?","https://www.gjopen.com/questions/1876-before-1-january-2022-will-the-diem-association-co-founded-by-facebook-launch-a-stablecoin","Good Judgment Open",true,"58%","89","60"
|
||||||
|
"Before 19 June 2021, will the end-of-day closing value for the Turkish lira against the U.S. dollar exceed 9.00?","https://www.gjopen.com/questions/1878-before-19-june-2021-will-the-end-of-day-closing-value-for-the-turkish-lira-against-the-u-s-dollar-exceed-9-00","Good Judgment Open",true,"4%","99","54"
|
||||||
|
"Will the People's Republic of China and the EU sign a Comprehensive Agreement on Investment before 1 January 2022?","https://www.gjopen.com/questions/1875-will-the-people-s-republic-of-china-and-the-eu-sign-a-comprehensive-agreement-on-investment-before-1-january-2022","Good Judgment Open",false,"none","288","158"
|
||||||
|
"Will the U.S. Food and Drug Administration (FDA) and/or the EU's European Medicines Agency (EMA) approve a COVID-19 vaccine from Chinese companies Sinovac or Sinopharm before 1 September 2021?","https://www.gjopen.com/questions/1869-will-the-u-s-food-and-drug-administration-fda-and-or-the-eu-s-european-medicines-agency-ema-approve-a-covid-19-vaccine-from-chinese-companies-sinovac-or-sinopharm-before-1-september-2021","Good Judgment Open",false,"none","220","163"
|
||||||
|
"Before 1 January 2022, will a commercial, open to the public, ride-hailing service that uses autonomous vehicles without back-up drivers nor remote operators be launched in the People's Republic of China?","https://www.gjopen.com/questions/1870-before-1-january-2022-will-a-commercial-open-to-the-public-ride-hailing-service-that-uses-autonomous-vehicles-without-back-up-drivers-nor-remote-operators-be-launched-in-the-people-s-republic-of-china","Good Judgment Open",true,"35%","164","119"
|
||||||
|
"Will the United States and China sign a trade agreement before 1 July 2021?","https://www.gjopen.com/questions/1872-will-the-united-states-and-china-sign-a-trade-agreement-before-1-july-2021","Good Judgment Open",true,"10%","206","169"
|
||||||
|
"Before 14 August 2021, will an executive order be signed or federal legislation become law that would forgive $10,000 or more in principal on federal student loan debts for at least five million student loan borrowers?","https://www.gjopen.com/questions/1873-before-14-august-2021-will-an-executive-order-be-signed-or-federal-legislation-become-law-that-would-forgive-10-000-or-more-in-principal-on-federal-student-loan-debts-for-at-least-five-million-student-loan-borrowers","Good Judgment Open",true,"40%","137","81"
|
||||||
|
"Will the monthly occupancy level of European hotels next reach 50.0% or higher before June 2021, according to Smith Travel Research?","https://www.gjopen.com/questions/1874-will-the-monthly-occupancy-level-of-european-hotels-next-reach-50-0-or-higher-before-june-2021-according-to-smith-travel-research","Good Judgment Open",true,"36%","162","77"
|
||||||
|
"Before 15 July 2021, will Canadians Michael Kovrig and/or Michael Spavor leave China?","https://www.gjopen.com/questions/1867-before-15-july-2021-will-canadians-michael-kovrig-and-or-michael-spavor-leave-china","Good Judgment Open",false,"none","160","89"
|
||||||
|
"Will Japan, the People's Republic of China, and South Korea sign a trilateral free trade agreement before 1 January 2022?","https://www.gjopen.com/questions/1868-will-japan-the-people-s-republic-of-china-and-south-korea-sign-a-trilateral-free-trade-agreement-before-1-january-2022","Good Judgment Open",true,"10%","153","102"
|
||||||
|
"When will a Carnival Cruise Line cruise next depart from the continental U.S.?","https://www.gjopen.com/questions/1866-when-will-a-carnival-cruise-line-cruise-next-depart-from-the-continental-u-s","Good Judgment Open",false,"none","120","72"
|
||||||
|
"Before 1 January 2022, will a release date for The Winds of Winter be announced by the author and/or publisher?","https://www.gjopen.com/questions/1864-before-1-january-2022-will-a-release-date-for-the-winds-of-winter-be-announced-by-the-author-and-or-publisher","Good Judgment Open",true,"58%","54","38"
|
||||||
|
"Before 7 May 2021, will the Bank of England set its Bank Rate to below zero?","https://www.gjopen.com/questions/1861-before-7-may-2021-will-the-bank-of-england-set-its-bank-rate-to-below-zero","Good Judgment Open",true,"10%","202","153"
|
||||||
|
"Will net international migration between the U.S. and abroad for 2021 be higher than the net international migration for 2020?","https://www.gjopen.com/questions/1865-will-net-international-migration-between-the-u-s-and-abroad-for-2021-be-higher-than-the-net-international-migration-for-2020","Good Judgment Open",true,"92%","70","50"
|
||||||
|
"In Cedar Point Nursery v. Hassid, will the Supreme Court rule that California's access regulation, as applied to Cedar Point Nursery, is a per se physical taking under the federal constitution?","https://www.gjopen.com/questions/1863-in-cedar-point-nursery-v-hassid-will-the-supreme-court-rule-that-california-s-access-regulation-as-applied-to-cedar-point-nursery-is-a-per-se-physical-taking-under-the-federal-constitution","Good Judgment Open",true,"66%","35","28"
|
||||||
|
"Before 21 January 2021, will the Federal Housing Finance Agency (FHFA) enter into a consent order that would allow Fannie Mae and Freddie Mac to exit conservatorship?","https://www.gjopen.com/questions/1860-before-21-january-2021-will-the-federal-housing-finance-agency-fhfa-enter-into-a-consent-order-that-would-allow-fannie-mae-and-freddie-mac-to-exit-conservatorship","Good Judgment Open",true,"0%","63","43"
|
||||||
|
"What will be the closing price of natural gas (per MMBtu) on 1 June 2021, according to Bloomberg?","https://www.gjopen.com/questions/1858-what-will-be-the-closing-price-of-natural-gas-per-mmbtu-on-1-june-2021-according-to-bloomberg","Good Judgment Open",false,"none","89","34"
|
||||||
|
"Before 1 July 2021, will presidential and/or parliamentary elections be held in Kyrgyzstan?","https://www.gjopen.com/questions/1854-before-1-july-2021-will-presidential-and-or-parliamentary-elections-be-held-in-kyrgyzstan","Good Judgment Open",false,"none","65","27"
|
||||||
|
"Will the IMF estimate for world GDP growth for 2021 be higher in its April 2021 World Economic Outlook report relative to its October 2020 report?","https://www.gjopen.com/questions/1856-will-the-imf-estimate-for-world-gdp-growth-for-2021-be-higher-in-its-april-2021-world-economic-outlook-report-relative-to-its-october-2020-report","Good Judgment Open",true,"70%","203","140"
|
||||||
|
"Who will win the 2021 presidential election in Peru?","https://www.gjopen.com/questions/1853-who-will-win-the-2021-presidential-election-in-peru","Good Judgment Open",false,"none","78","58"
|
||||||
|
"Before 4 June 2021, will the United Kingdom's Office for National Statistics (ONS) report that the percentage of working adults who ""worked from home exclusively"" fell below 20%?","https://www.gjopen.com/questions/1855-before-4-june-2021-will-the-united-kingdom-s-office-for-national-statistics-ons-report-that-the-percentage-of-working-adults-who-worked-from-home-exclusively-fell-below-20","Good Judgment Open",true,"56%","274","154"
|
||||||
|
"Who will be appointed as the next leader of the Communist Party in Vietnam?","https://www.gjopen.com/questions/1848-who-will-be-appointed-as-the-next-leader-of-the-communist-party-in-vietnam","Good Judgment Open",false,"none","160","88"
|
||||||
|
"What will be China's year-on-year GDP growth rate for the second quarter of 2021?","https://www.gjopen.com/questions/1850-what-will-be-china-s-year-on-year-gdp-growth-rate-for-the-second-quarter-of-2021","Good Judgment Open",false,"none","315","203"
|
||||||
|
"How many COVID-19 vaccines will be approved and/or authorized for emergency use by the U.S. FDA as of 31 March 2021?","https://www.gjopen.com/questions/1849-how-many-covid-19-vaccines-will-be-approved-and-or-authorized-for-emergency-use-by-the-u-s-fda-as-of-31-march-2021","Good Judgment Open",false,"none","640","275"
|
||||||
|
"How many vehicles will Tesla deliver to customers in the first half of 2021?","https://www.gjopen.com/questions/1852-how-many-vehicles-will-tesla-deliver-to-customers-in-the-first-half-of-2021","Good Judgment Open",false,"none","316","177"
|
||||||
|
"Before 1 October 2021, will Jair Bolsonaro cease to be the president of Brazil?","https://www.gjopen.com/questions/1851-before-1-october-2021-will-jair-bolsonaro-cease-to-be-the-president-of-brazil","Good Judgment Open",true,"5%","226","176"
|
||||||
|
"Will the average price of a gallon of gasoline fall below $1.95 for any week before 2 March 2021?","https://www.gjopen.com/questions/1847-will-the-average-price-of-a-gallon-of-gasoline-fall-below-1-95-for-any-week-before-2-march-2021","Good Judgment Open",true,"2%","289","120"
|
||||||
|
"Will Nicolas Maduro cease to be president of Venezuela before 1 April 2021?","https://www.gjopen.com/questions/1843-will-nicolas-maduro-cease-to-be-president-of-venezuela-before-1-april-2021","Good Judgment Open",true,"3%","364","181"
|
||||||
|
"In 2021, will total fire activity in the Amazon exceed the 2020 total count?","https://www.gjopen.com/questions/1842-in-2021-will-total-fire-activity-in-the-amazon-exceed-the-2020-total-count","Good Judgment Open",true,"70%","176","112"
|
||||||
|
"Will the U.S. consume more energy from renewable sources in May 2021 than it did in May 2019, according to the U.S. Energy Information Administration (EIA)?","https://www.gjopen.com/questions/1840-will-the-u-s-consume-more-energy-from-renewable-sources-in-may-2021-than-it-did-in-may-2019-according-to-the-u-s-energy-information-administration-eia","Good Judgment Open",true,"95%","237","163"
|
||||||
|
"On 12 May 2021, will Ethiopia's Tigray region be under a federally-imposed state of emergency?","https://www.gjopen.com/questions/1841-on-12-may-2021-will-ethiopia-s-tigray-region-be-under-a-federally-imposed-state-of-emergency","Good Judgment Open",true,"85%","213","150"
|
||||||
|
"Between 13 November 2020 and 12 February 2021, will the closing price per barrel of WTI crude oil be higher than the closing price per barrel of Brent crude oil?","https://www.gjopen.com/questions/1839-between-13-november-2020-and-12-february-2021-will-the-closing-price-per-barrel-of-wti-crude-oil-be-higher-than-the-closing-price-per-barrel-of-brent-crude-oil","Good Judgment Open",true,"1%","224","101"
|
||||||
|
"When will the World Health Organization (WHO) report more than 20 million confirmed cases of COVID-19 for the South-East Asia Region?","https://www.gjopen.com/questions/1835-when-will-the-world-health-organization-who-report-more-than-20-million-confirmed-cases-of-covid-19-for-the-south-east-asia-region","Good Judgment Open",false,"none","186","82"
|
||||||
|
"Will the People's Republic of China (PRC) officially declare an air-defense identification zone (ADIZ) over any part of the South China Sea before 1 March 2021?","https://www.gjopen.com/questions/1832-will-the-people-s-republic-of-china-prc-officially-declare-an-air-defense-identification-zone-adiz-over-any-part-of-the-south-china-sea-before-1-march-2021","Good Judgment Open",true,"4%","291","194"
|
||||||
|
"Between 9 November 2020 and 28 February 2021, will a country cease to formally recognize Taiwan?","https://www.gjopen.com/questions/1831-between-9-november-2020-and-28-february-2021-will-a-country-cease-to-formally-recognize-taiwan","Good Judgment Open",true,"4%","359","199"
|
||||||
|
"Will Russia and the People's Republic of China (PRC) conduct any joint naval exercises before 1 March 2021?","https://www.gjopen.com/questions/1833-will-russia-and-the-people-s-republic-of-china-prc-conduct-any-joint-naval-exercises-before-1-march-2021","Good Judgment Open",true,"","309","144"
|
||||||
|
"When will the World Health Organization (WHO) report more than 35 million confirmed cases of COVID-19 for the Europe Region?","https://www.gjopen.com/questions/1834-when-will-the-world-health-organization-who-report-more-than-35-million-confirmed-cases-of-covid-19-for-the-europe-region","Good Judgment Open",false,"none","321","91"
|
||||||
|
"At close of business on 17 March 2021, will the upper limit of the Federal Reserve's target range for the federal funds rate be lower, the same, or higher than it was at close of business on 27 January 2021?","https://www.gjopen.com/questions/1824-at-close-of-business-on-17-march-2021-will-the-upper-limit-of-the-federal-reserve-s-target-range-for-the-federal-funds-rate-be-lower-the-same-or-higher-than-it-was-at-close-of-business-on-27-january-2021","Good Judgment Open",false,"none","128","79"
|
||||||
|
"Before 1 May 2021, will Mahmoud Abbas cease to be president of the Palestinian Authority?","https://www.gjopen.com/questions/1825-before-1-may-2021-will-mahmoud-abbas-cease-to-be-president-of-the-palestinian-authority","Good Judgment Open",true,"10%","130","53"
|
||||||
|
"Before 1 January 2022, will Amazon announce that it will spin off Amazon Web Services (AWS)?","https://www.gjopen.com/questions/1822-before-1-january-2022-will-amazon-announce-that-it-will-spin-off-amazon-web-services-aws","Good Judgment Open",true,"4%","216","131"
|
||||||
|
"Will Apple's iPhone net sales be higher in FY 2021 than FY 2019?","https://www.gjopen.com/questions/1823-will-apple-s-iphone-net-sales-be-higher-in-fy-2021-than-fy-2019","Good Judgment Open",true,"90%","210","98"
|
||||||
|
"How many countries will have 100,000 or more deaths attributed to COVID-19 as of 30 April 2021?","https://www.gjopen.com/questions/1819-how-many-countries-will-have-100-000-or-more-deaths-attributed-to-covid-19-as-of-30-april-2021","Good Judgment Open",false,"none","775","163"
|
||||||
|
"Will Prayut Chan-o-cha cease to be the prime minister of Thailand before 23 April 2021?","https://www.gjopen.com/questions/1820-will-prayut-chan-o-cha-cease-to-be-the-prime-minister-of-thailand-before-23-april-2021","Good Judgment Open",true,"","215","59"
|
||||||
|
"Before 1 September 2021, will Egypt, Ethiopia, and Sudan sign an agreement governing the filling of the Grand Ethiopian Renaissance Dam (GERD) reservoir?","https://www.gjopen.com/questions/1815-before-1-september-2021-will-egypt-ethiopia-and-sudan-sign-an-agreement-governing-the-filling-of-the-grand-ethiopian-renaissance-dam-gerd-reservoir","Good Judgment Open",true,"5%","149","57"
|
||||||
|
"Between 16 October 2020 and 31 December 2021, how many successful flight tests of the Common Hypersonic Glide Body (C-HGB) will the United States conduct?","https://www.gjopen.com/questions/1818-between-16-october-2020-and-31-december-2021-how-many-successful-flight-tests-of-the-common-hypersonic-glide-body-c-hgb-will-the-united-states-conduct","Good Judgment Open",false,"none","122","40"
|
||||||
|
"Will Boom Technology's XB-1 supersonic aircraft complete a successful test flight before 2022?","https://www.gjopen.com/questions/1816-will-boom-technology-s-xb-1-supersonic-aircraft-complete-a-successful-test-flight-before-2022","Good Judgment Open",true,"99%","116","52"
|
||||||
|
"When will Canada next permit discretionary travel for foreign nationals arriving from the United States?","https://www.gjopen.com/questions/1817-when-will-canada-next-permit-discretionary-travel-for-foreign-nationals-arriving-from-the-united-states","Good Judgment Open",false,"none","337","138"
|
||||||
|
"Before 21 January 2021, will the House of Representatives, pursuant to the 12th Amendment, vote to choose a president of the United States?","https://www.gjopen.com/questions/1809-before-21-january-2021-will-the-house-of-representatives-pursuant-to-the-12th-amendment-vote-to-choose-a-president-of-the-united-states","Good Judgment Open",true,"","385","232"
|
||||||
|
"For any seven consecutive day period between 9 October 2020 and 15 June 2021, will there be fewer than 50,000 combined total confirmed new cases of COVID-19 in the United States?","https://www.gjopen.com/questions/1806-for-any-seven-consecutive-day-period-between-9-october-2020-and-15-june-2021-will-there-be-fewer-than-50-000-combined-total-confirmed-new-cases-of-covid-19-in-the-united-states","Good Judgment Open",true,"28%","440","143"
|
||||||
|
"What will be the delinquency rate on commercial real estate loans (excluding farmland) in the United States in the second quarter of 2021?","https://www.gjopen.com/questions/1798-what-will-be-the-delinquency-rate-on-commercial-real-estate-loans-excluding-farmland-in-the-united-states-in-the-second-quarter-of-2021","Good Judgment Open",false,"none","187","62"
|
||||||
|
"What will be the annual rate of housing starts for April 2021?","https://www.gjopen.com/questions/1799-what-will-be-the-annual-rate-of-housing-starts-for-april-2021","Good Judgment Open",false,"none","274","78"
|
||||||
|
"When will Lebanon's parliament give a vote of confidence to a new government?","https://www.gjopen.com/questions/1801-when-will-lebanon-s-parliament-give-a-vote-of-confidence-to-a-new-government","Good Judgment Open",false,"none","281","55"
|
||||||
|
"Before 1 March 2021, will there be a lethal confrontation at sea between the forces of India and the People's Republic of China?","https://www.gjopen.com/questions/1795-before-1-march-2021-will-there-be-a-lethal-confrontation-at-sea-between-the-forces-of-india-and-the-people-s-republic-of-china","Good Judgment Open",true,"1%","347","177"
|
||||||
|
"In Fulton v. City of Philadelphia (City), will the Supreme Court rule that the City's requirement that Catholic Social Services (CSS) not discriminate against same-sex couples as a condition for working with the City's foster children is unconstitutional?","https://www.gjopen.com/questions/1796-in-fulton-v-city-of-philadelphia-city-will-the-supreme-court-rule-that-the-city-s-requirement-that-catholic-social-services-css-not-discriminate-against-same-sex-couples-as-a-condition-for-working-with-the-city-s-foster-children-is-unconstitutional","Good Judgment Open",true,"96%","182","64"
|
||||||
|
"Will Recep Tayyip Erdoğan cease to be president of Turkey before 15 July 2021?","https://www.gjopen.com/questions/1792-will-recep-tayyip-erdogan-cease-to-be-president-of-turkey-before-15-july-2021","Good Judgment Open",true,"2%","320","146"
|
||||||
|
"At close of business on 27 January 2021, will the upper limit of the Federal Reserve's target range for the federal funds rate be lower, the same, or higher than it was at close of business on 16 December 2020?","https://www.gjopen.com/questions/1791-at-close-of-business-on-27-january-2021-will-the-upper-limit-of-the-federal-reserve-s-target-range-for-the-federal-funds-rate-be-lower-the-same-or-higher-than-it-was-at-close-of-business-on-16-december-2020","Good Judgment Open",false,"none","178","111"
|
||||||
|
"Which country will the 2020-21 UEFA Champions League final winner be from?","https://www.gjopen.com/questions/1790-which-country-will-the-2020-21-uefa-champions-league-final-winner-be-from","Good Judgment Open",false,"none","214","97"
|
||||||
|
"When will 25,000 or more fans next attend a Premier League match?","https://www.gjopen.com/questions/1788-when-will-25-000-or-more-fans-next-attend-a-premier-league-match","Good Judgment Open",false,"none","488","172"
|
||||||
|
"Before 18 September 2021, will Boris Johnson cease to be prime minister of the United Kingdom?","https://www.gjopen.com/questions/1789-before-18-september-2021-will-boris-johnson-cease-to-be-prime-minister-of-the-united-kingdom","Good Judgment Open",true,"10%","799","389"
|
||||||
|
"Will there be a complex coordinated terrorist attack (CCTA) in the United States either directed or inspired by a foreign terrorist organization before 1 September 2021?","https://www.gjopen.com/questions/1780-will-there-be-a-complex-coordinated-terrorist-attack-ccta-in-the-united-states-either-directed-or-inspired-by-a-foreign-terrorist-organization-before-1-september-2021","Good Judgment Open",true,"5%","299","149"
|
||||||
|
"Will any 2020 California election results be altered by a cyberattack against a voting system?","https://www.gjopen.com/questions/1782-will-any-2020-california-election-results-be-altered-by-a-cyberattack-against-a-voting-system","Good Judgment Open",true,"0%","260","135"
|
||||||
|
"Will there be a complex coordinated terrorist attack (CCTA) in the United States before 1 September 2021?","https://www.gjopen.com/questions/1781-will-there-be-a-complex-coordinated-terrorist-attack-ccta-in-the-united-states-before-1-september-2021","Good Judgment Open",true,"25%","437","133"
|
||||||
|
"When will the Transportation Security Administration (TSA) next screen two million or more travelers in a single day?","https://www.gjopen.com/questions/1776-when-will-the-transportation-security-administration-tsa-next-screen-two-million-or-more-travelers-in-a-single-day","Good Judgment Open",false,"none","604","152"
|
||||||
|
"In Google v. Oracle America, will the Supreme Court rule that the Copyright Act protects the Oracle computer source code that Google copied for its Android operating system?","https://www.gjopen.com/questions/1775-in-google-v-oracle-america-will-the-supreme-court-rule-that-the-copyright-act-protects-the-oracle-computer-source-code-that-google-copied-for-its-android-operating-system","Good Judgment Open",true,"90%","180","71"
|
||||||
|
"In California v. Texas, will the Supreme Court rule that reducing the penalty amount for the individual mandate of the Affordable Care Act (ACA) to zero rendered the individual mandate provision unconstitutional?","https://www.gjopen.com/questions/1774-in-california-v-texas-will-the-supreme-court-rule-that-reducing-the-penalty-amount-for-the-individual-mandate-of-the-affordable-care-act-aca-to-zero-rendered-the-individual-mandate-provision-unconstitutional","Good Judgment Open",true,"","288","72"
|
||||||
|
"Before 1 January 2022, will the United States Olympic Committee announce that it is boycotting the 2022 Winter Olympics?","https://www.gjopen.com/questions/1764-before-1-january-2022-will-the-united-states-olympic-committee-announce-that-it-is-boycotting-the-2022-winter-olympics","Good Judgment Open",true,"4%","438","162"
|
||||||
|
"How many Arab League member states other than Palestine will diplomatically recognize the State of Israel as of 28 August 2021?","https://www.gjopen.com/questions/1763-how-many-arab-league-member-states-other-than-palestine-will-diplomatically-recognize-the-state-of-israel-as-of-28-august-2021","Good Judgment Open",false,"none","428","88"
|
||||||
|
"When will the EU amend its Own Resources Decision to help finance the EU's proposed COVID-19 recovery package?","https://www.gjopen.com/questions/1762-when-will-the-eu-amend-its-own-resources-decision-to-help-finance-the-eu-s-proposed-covid-19-recovery-package","Good Judgment Open",false,"none","176","47"
|
||||||
|
"How many Cybertrucks will Tesla deliver to customers in 2022?","https://www.gjopen.com/questions/1760-how-many-cybertrucks-will-tesla-deliver-to-customers-in-2022","Good Judgment Open",false,"none","247","75"
|
||||||
|
"Before 1 January 2023, will Amazon or a subsidiary use a Zoox autonomous vehicle to deliver a package and/or for a public ride-hailing service?","https://www.gjopen.com/questions/1745-before-1-january-2023-will-amazon-or-a-subsidiary-use-a-zoox-autonomous-vehicle-to-deliver-a-package-and-or-for-a-public-ride-hailing-service","Good Judgment Open",false,"none","182","70"
|
||||||
|
"Before 14 February 2021, will former King Juan Carlos I and/or former Catalan President Carles Puigdemont return to Spain?","https://www.gjopen.com/questions/1740-before-14-february-2021-will-former-king-juan-carlos-i-and-or-former-catalan-president-carles-puigdemont-return-to-spain","Good Judgment Open",false,"none","214","96"
|
||||||
|
"Before 1 January 2023, how many major automakers will debut a passenger vehicle powered by a solid-state battery?","https://www.gjopen.com/questions/1744-before-1-january-2023-how-many-major-automakers-will-debut-a-passenger-vehicle-powered-by-a-solid-state-battery","Good Judgment Open",false,"none","189","52"
|
||||||
|
"When will SpaceX's satellite internet service, Starlink, begin offering commercial service in North America?","https://www.gjopen.com/questions/1741-when-will-spacex-s-satellite-internet-service-starlink-begin-offering-commercial-service-in-north-america","Good Judgment Open",false,"none","432","92"
|
||||||
|
"Between August 2020 and July 2021, will global land and ocean surface temperatures rise 1.5°C or more above the 20th century average for any single month?","https://www.gjopen.com/questions/1715-between-august-2020-and-july-2021-will-global-land-and-ocean-surface-temperatures-rise-1-5-c-or-more-above-the-20th-century-average-for-any-single-month","Good Judgment Open",true,"2%","247","123"
|
||||||
|
"Before 1 January 2022, will the U.S. Senate expand the scope of matters for which a filibuster cannot be used?","https://www.gjopen.com/questions/1718-before-1-january-2022-will-the-u-s-senate-expand-the-scope-of-matters-for-which-a-filibuster-cannot-be-used","Good Judgment Open",true,"3%","473","127"
|
||||||
|
"When will a Carnival Cruise Line cruise next depart from the continental U.S.?","https://www.gjopen.com/questions/1711-when-will-a-carnival-cruise-lines-cruise-next-depart-from-the-continental-u-s","Good Judgment Open",false,"none","818","253"
|
||||||
|
"Between 1 January 2021 and 31 December 2022, will a firm or paid backup driver operating a self-driving vehicle face criminal charges in relation to an accident involving a self-driving vehicle in the U.S.?","https://www.gjopen.com/questions/1696-between-1-january-2021-and-31-december-2022-will-a-firm-or-paid-backup-driver-operating-a-self-driving-vehicle-face-criminal-charges-in-relation-to-an-accident-involving-a-self-driving-vehicle-in-the-u-s","Good Judgment Open",false,"none","177","71"
|
||||||
|
"How many new energy vehicles (NEVs) will be sold in China in 2021 and 2022 combined?","https://www.gjopen.com/questions/1698-how-many-new-energy-vehicles-nevs-will-be-sold-in-china-in-2021-and-2022-combined","Good Judgment Open",false,"none","166","44"
|
||||||
|
"How many public DC fast charge electric vehicle charging stations will be available in the United States by 31 December 2022?","https://www.gjopen.com/questions/1678-how-many-public-dc-fast-charge-electric-vehicle-charging-stations-will-be-available-in-the-united-states-by-31-december-2022","Good Judgment Open",false,"none","159","29"
|
||||||
|
"How many cases of COVID-19 will be reported by the Africa CDC as of 1 April 2021?","https://www.gjopen.com/questions/1674-how-many-cases-of-covid-19-will-be-reported-by-the-africa-cdc-as-of-1-april-2021","Good Judgment Open",false,"none","816","134"
|
||||||
|
"Before 1 May 2021, will it be officially announced that the Tokyo 2020 Summer Olympics and/or Paralympics will be canceled?","https://www.gjopen.com/questions/1668-before-1-may-2021-will-it-be-officially-announced-that-the-tokyo-2020-summer-olympics-and-or-paralympics-will-be-canceled","Good Judgment Open",false,"none","939","343"
|
||||||
|
"Between 1 January 2021 and 31 December 2022, will legislation enabling the creation of federal safety standards for autonomous vehicles (AVs) become law?","https://www.gjopen.com/questions/1659-between-1-january-2021-and-31-december-2022-will-legislation-enabling-the-creation-of-federal-safety-standards-for-autonomous-vehicles-avs-become-law","Good Judgment Open",true,"70%","197","94"
|
||||||
|
"Will there be a lethal confrontation between the national military forces, militia, and/or law enforcement personnel of the People's Republic of China and those of Brunei, Indonesia, Malaysia, the Philippines, Singapore, and/or Vietnam before 1 April 2021?","https://www.gjopen.com/questions/1652-will-there-be-a-lethal-confrontation-between-the-national-military-forces-militia-and-or-law-enforcement-personnel-of-the-people-s-republic-of-china-and-those-of-brunei-indonesia-malaysia-the-philippines-singapore-and-or-vietnam-before-1-april-2021","Good Judgment Open",true,"5%","804","371"
|
||||||
|
"How many total Model 3 and Model Y vehicles will Tesla deliver to customers in 2021 and 2022?","https://www.gjopen.com/questions/1647-how-many-total-model-3-and-model-y-vehicles-will-tesla-deliver-to-customers-in-2021-and-2022","Good Judgment Open",false,"none","219","67"
|
||||||
|
"How many total Fast Charge (>22kW) public charging points for electric vehicles will be installed in the European Union by 31 December 2022?","https://www.gjopen.com/questions/1634-how-many-total-fast-charge-22kw-public-charging-points-for-electric-vehicles-will-be-installed-in-the-european-union-by-31-december-2022","Good Judgment Open",false,"none","216","64"
|
||||||
|
"Before 1 January 2023, how many major automakers will sell a self-driving passenger vehicle manufactured without a steering wheel?","https://www.gjopen.com/questions/1633-before-1-january-2023-how-many-major-automakers-will-sell-a-self-driving-passenger-vehicle-manufactured-without-a-steering-wheel","Good Judgment Open",false,"none","329","181"
|
||||||
|
"Between 1 January 2021 and 31 December 2022, will the European Union delay and/or relax the implementation and/or enforcement of any of its CO2 emission performance standards for new passenger cars and/or new light commercial vehicles?","https://www.gjopen.com/questions/1620-between-1-january-2021-and-31-december-2022-will-the-european-union-delay-and-or-relax-the-implementation-and-or-enforcement-of-any-of-its-co2-emission-performance-standards-for-new-passenger-cars-and-or-new-light-commercial-vehicles","Good Judgment Open",true,"","161","79"
|
||||||
|
"What will be the 2022 industry-wide average cost of Li-ion batteries used in battery-powered electric vehicles?","https://www.gjopen.com/questions/1583-what-will-be-the-2022-industry-wide-average-cost-of-li-ion-batteries-used-in-battery-powered-electric-vehicles","Good Judgment Open",false,"none","217","85"
|
||||||
|
"What total percentage of global vehicle sales in 2022 will be battery electric vehicles (BEVs) and plug-in hybrid electric vehicles (PHEVs)? ","https://www.gjopen.com/questions/1582-what-total-percentage-of-global-vehicle-sales-in-2022-will-be-battery-electric-vehicles-bevs-and-plug-in-hybrid-electric-vehicles-phevs","Good Judgment Open",false,"none","319","130"
|
||||||
|
"Will there be a new prime minister of Italy before 24 January 2021?","https://www.gjopen.com/questions/1502-will-there-be-a-new-prime-minister-of-italy-before-24-january-2021","Good Judgment Open",true,"1%","825","263"
|
||||||
|
"Before 1 July 2021, will the Chilean government pass legislation that caps administrative fees and/or operating profits of the country's pension fund managers?","https://www.gjopen.com/questions/1411-before-1-july-2021-will-the-chilean-government-pass-legislation-that-caps-administrative-fees-and-or-operating-profits-of-the-country-s-pension-fund-managers","Good Judgment Open",true,"2%","247","95"
|
||||||
|
"Before 1 July 2021, will the Chilean government pass legislation nationalizing private pension fund assets?","https://www.gjopen.com/questions/1412-before-1-july-2021-will-the-chilean-government-pass-legislation-nationalizing-private-pension-fund-assets","Good Judgment Open",true,"1%","273","123"
|
||||||
|
"When will Donald Trump cease to be president of the United States?","https://www.gjopen.com/questions/1290-when-will-donald-trump-cease-to-be-president-of-the-united-states","Good Judgment Open",false,"none","6445","2159"
|
|
1037
data/goodjudmentopen-questions.json
Normal file
1037
data/goodjudmentopen-questions.json
Normal file
File diff suppressed because it is too large
Load Diff
1591
data/merged-questions.csv
Normal file
1591
data/merged-questions.csv
Normal file
File diff suppressed because it is too large
Load Diff
13025
data/merged-questions.json
Normal file
13025
data/merged-questions.json
Normal file
File diff suppressed because it is too large
Load Diff
1004
data/metaculus-questions.csv
Normal file
1004
data/metaculus-questions.csv
Normal file
File diff suppressed because it is too large
Load Diff
8018
data/metaculus-questions.json
Normal file
8018
data/metaculus-questions.json
Normal file
File diff suppressed because it is too large
Load Diff
2066
data/polymarket-contract-list.json
Normal file
2066
data/polymarket-contract-list.json
Normal file
File diff suppressed because it is too large
Load Diff
15
data/polymarket-questions.csv
Normal file
15
data/polymarket-questions.csv
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
"Title","URL","Platform","Binary question?","Percentage","# Forecasts","# Forecasters"
|
||||||
|
"Will Trump Pardon Himself in His First Term?","https://polymarket.com/market/will-trump-pardon-himself-in-his-first-term","PolyMarket",true,"37.3707%","1448.00",
|
||||||
|
"Will Donald Trump attend Joe Biden’s inauguration ceremony in person?","https://polymarket.com/market/will-donald-trump-attend-joe-biden-s-inauguration-ceremony-in-person","PolyMarket",true,"6.3134%","904.00",
|
||||||
|
"Will Coinbase delist Ripple (XRP) before they begin publicly trading?","https://polymarket.com/market/will-coinbase-delist-ripple-xrp-before-they-begin-publicly-trading","PolyMarket",true,"93.8756%","373.00",
|
||||||
|
"Will Donald Trump be inaugurated for his second term as President of the USA on Inauguration Day, January 20th, 2021?","https://polymarket.com/market/will-donald-trump-be-inaugurated-for-his-second-term-as-president-of-the-usa-on-inauguration-day-january-20th-2021","PolyMarket",true,"4.4697%","11248.00",
|
||||||
|
"Will Donald Trump pardon Ross Ulbricht?","https://polymarket.com/market/will-donald-trump-pardon-ross-ulbricht","PolyMarket",true,"8.2650%","391.00",
|
||||||
|
"Will Donald Trump pardon Julian Assange?","https://polymarket.com/market/will-donald-trump-pardon-julian-assange","PolyMarket",true,"17.6931%","1291.00",
|
||||||
|
"Will Joe Biden be inaugurated as President of the USA on January 20th, 2021?","https://polymarket.com/market/will-joe-biden-be-inaugurated-as-president-of-the-usa-on-january-20th-2021-1","PolyMarket",true,"90.5629%","3428.00",
|
||||||
|
"Which party will control the senate? (R≡Yes, D≡No)","https://polymarket.com/market/which-party-will-control-the-senate","PolyMarket",true,"6.8794%","1113.00",
|
||||||
|
"Will Donald Trump pardon Edward Snowden?","https://polymarket.com/market/will-donald-trump-pardon-edward-snowden","PolyMarket",true,"13.7089%","117.00",
|
||||||
|
"Will $BTC break $50k before April 1st, 2021?","https://polymarket.com/market/will-btc-break-50k-before-april-1st-2021","PolyMarket",true,"54.4302%","565.00",
|
||||||
|
"Will Trump complete his first term?","https://polymarket.com/market/will-trump-complete-his-first-term","PolyMarket",true,"87.6649%","766.00",
|
||||||
|
"Will Bitcoin or Tesla have a higher market cap on March 1, 2021?","https://polymarket.com/market/will-bitcoin-or-tesla-have-a-higher-market-cap-on-march-1-2021","PolyMarket",true,"39.9523%","120.00",
|
||||||
|
"Will Donald Trump be impeached again before the end of his term?","https://polymarket.com/market/will-donald-trump-be-impeached-again-before-the-end-of-his-term","PolyMarket",true,"91.3797%","716.00",
|
||||||
|
"Who will the world's richest person be on February 27, 2021?","https://polymarket.com/market/who-will-the-world-s-richest-person-be-on-february-27-2021","PolyMarket",false,"none","134.00",
|
|
114
data/polymarket-questions.json
Normal file
114
data/polymarket-questions.json
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Title": "Will Trump Pardon Himself in His First Term?",
|
||||||
|
"URL": "https://polymarket.com/market/will-trump-pardon-himself-in-his-first-term",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "37.3707%",
|
||||||
|
"# Forecasts": "1448.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump attend Joe Biden’s inauguration ceremony in person?",
|
||||||
|
"URL": "https://polymarket.com/market/will-donald-trump-attend-joe-biden-s-inauguration-ceremony-in-person",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "6.3134%",
|
||||||
|
"# Forecasts": "904.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Coinbase delist Ripple (XRP) before they begin publicly trading?",
|
||||||
|
"URL": "https://polymarket.com/market/will-coinbase-delist-ripple-xrp-before-they-begin-publicly-trading",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "93.8756%",
|
||||||
|
"# Forecasts": "373.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump be inaugurated for his second term as President of the USA on Inauguration Day, January 20th, 2021?",
|
||||||
|
"URL": "https://polymarket.com/market/will-donald-trump-be-inaugurated-for-his-second-term-as-president-of-the-usa-on-inauguration-day-january-20th-2021",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "4.4697%",
|
||||||
|
"# Forecasts": "11248.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump pardon Ross Ulbricht?",
|
||||||
|
"URL": "https://polymarket.com/market/will-donald-trump-pardon-ross-ulbricht",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "8.2650%",
|
||||||
|
"# Forecasts": "391.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump pardon Julian Assange?",
|
||||||
|
"URL": "https://polymarket.com/market/will-donald-trump-pardon-julian-assange",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "17.6931%",
|
||||||
|
"# Forecasts": "1291.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Joe Biden be inaugurated as President of the USA on January 20th, 2021?",
|
||||||
|
"URL": "https://polymarket.com/market/will-joe-biden-be-inaugurated-as-president-of-the-usa-on-january-20th-2021-1",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "90.5629%",
|
||||||
|
"# Forecasts": "3428.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will control the senate? (R≡Yes, D≡No)",
|
||||||
|
"URL": "https://polymarket.com/market/which-party-will-control-the-senate",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "6.8794%",
|
||||||
|
"# Forecasts": "1113.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump pardon Edward Snowden?",
|
||||||
|
"URL": "https://polymarket.com/market/will-donald-trump-pardon-edward-snowden",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "13.7089%",
|
||||||
|
"# Forecasts": "117.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will $BTC break $50k before April 1st, 2021?",
|
||||||
|
"URL": "https://polymarket.com/market/will-btc-break-50k-before-april-1st-2021",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "54.4302%",
|
||||||
|
"# Forecasts": "565.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Trump complete his first term?",
|
||||||
|
"URL": "https://polymarket.com/market/will-trump-complete-his-first-term",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "87.6649%",
|
||||||
|
"# Forecasts": "766.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Bitcoin or Tesla have a higher market cap on March 1, 2021?",
|
||||||
|
"URL": "https://polymarket.com/market/will-bitcoin-or-tesla-have-a-higher-market-cap-on-march-1-2021",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "39.9523%",
|
||||||
|
"# Forecasts": "120.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump be impeached again before the end of his term?",
|
||||||
|
"URL": "https://polymarket.com/market/will-donald-trump-be-impeached-again-before-the-end-of-his-term",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "91.3797%",
|
||||||
|
"# Forecasts": "716.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will the world's richest person be on February 27, 2021?",
|
||||||
|
"URL": "https://polymarket.com/market/who-will-the-world-s-richest-person-be-on-february-27-2021",
|
||||||
|
"Platform": "PolyMarket",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none",
|
||||||
|
"# Forecasts": "134.00"
|
||||||
|
}
|
||||||
|
]
|
87
data/predictit-questions.csv
Normal file
87
data/predictit-questions.csv
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
"Title","URL","Platform","Binary question?","Percentage","# Forecasts","# Forecasters"
|
||||||
|
"What will be the balance of power in Congress after the 2020 election?","https://www.predictit.org/markets/detail/4353/What-will-be-the-balance-of-power-in-Congress-after-the-2020-election","PredictIt",false,"none",,
|
||||||
|
"Which party will control the Senate after 2020 election?","https://www.predictit.org/markets/detail/4366/Which-party-will-control-the-Senate-after-2020-election","PredictIt",false,"none",,
|
||||||
|
"Will Donald Trump complete his first term?","https://www.predictit.org/markets/detail/5158/Will-Donald-Trump-complete-his-first-term","PredictIt",true,"86%",,
|
||||||
|
"Will Trump pardon Jeffrey Epstein by Jan. 20, 2021?","https://www.predictit.org/markets/detail/5665/Will-Trump-pardon-Jeffrey-Epstein-by-Jan-20,-2021","PredictIt",true,"1%",,
|
||||||
|
"Which of these 5 European leaders will leave office next?","https://www.predictit.org/markets/detail/5717/Which-of-these-5-European-leaders-will-leave-office-next","PredictIt",false,"none",,
|
||||||
|
"Will the Senate convict Donald Trump on impeachment in his first term?","https://www.predictit.org/markets/detail/5914/Will-the-Senate-convict-Donald-Trump-on-impeachment-in-his-first-term","PredictIt",true,"6%",,
|
||||||
|
"Will Trump resign during his first term?","https://www.predictit.org/markets/detail/6008/Will-Trump-resign-during-his-first-term","PredictIt",true,"12%",,
|
||||||
|
"Will Trump pardon Rudy Giuliani before end of 2020?","https://www.predictit.org/markets/detail/6020/Will-Trump-pardon-Rudy-Giuliani-before-end-of-2020","PredictIt",true,"2%",,
|
||||||
|
"Will NASA find 2020’s global average temperature highest on record?","https://www.predictit.org/markets/detail/6234/Will-NASA-find-2020’s-global-average-temperature-highest-on-record","PredictIt",true,"45%",,
|
||||||
|
"Will Trump pardon himself in his first term?","https://www.predictit.org/markets/detail/6453/Will-Trump-pardon-himself-in-his-first-term","PredictIt",true,"44%",,
|
||||||
|
"What will be the popular vote margin in the 2020 presidential election?","https://www.predictit.org/markets/detail/6663/What-will-be-the-popular-vote-margin-in-the-2020-presidential-election","PredictIt",false,"none",,
|
||||||
|
"What will be the net change in Senate seats, by party?","https://www.predictit.org/markets/detail/6670/What-will-be-the-net-change-in-Senate-seats,-by-party","PredictIt",false,"none",,
|
||||||
|
"Which U.S. Senate race will be won by the smallest margin?","https://www.predictit.org/markets/detail/6737/Which-US-Senate-race-will-be-won-by-the-smallest-margin","PredictIt",false,"none",,
|
||||||
|
"How many women will win election to the U.S. Senate in 2020?","https://www.predictit.org/markets/detail/6765/How-many-women-will-win-election-to-the-US-Senate-in-2020","PredictIt",false,"none",,
|
||||||
|
"Will Democrats win the White House, Senate and House in 2020?","https://www.predictit.org/markets/detail/6770/Will-Democrats-win-the-White-House,-Senate-and-House-in-2020","PredictIt",true,"96%",,
|
||||||
|
"Which party will win the 2020 House race in Iowa's 2nd District?","https://www.predictit.org/markets/detail/6789/Which-party-will-win-the-2020-House-race-in-Iowa's-2nd-District","PredictIt",false,"none",,
|
||||||
|
"What percentage of the presidential vote will not be for the two major parties?","https://www.predictit.org/markets/detail/6809/What-percentage-of-the-presidential-vote-will-not-be-for-the-two-major-parties","PredictIt",false,"none",,
|
||||||
|
"Will Nancy Pelosi become Acting U.S. President on January 20?","https://www.predictit.org/markets/detail/6852/Will-Nancy-Pelosi-become-Acting-US-President-on-January-20","PredictIt",true,"2%",,
|
||||||
|
"Which party will win the 2020 House race in New York's 22nd District?","https://www.predictit.org/markets/detail/6861/Which-party-will-win-the-2020-House-race-in-New-York's-22nd-District","PredictIt",false,"none",,
|
||||||
|
"Which party will win the 2024 U.S. presidential election?","https://www.predictit.org/markets/detail/6867/Which-party-will-win-the-2024-US-presidential-election","PredictIt",false,"none",,
|
||||||
|
"Which party will control the Senate after 2022 election?","https://www.predictit.org/markets/detail/6874/Which-party-will-control-the-Senate-after-2022-election","PredictIt",false,"none",,
|
||||||
|
"How many votes in the 2020 U.S. presidential election?","https://www.predictit.org/markets/detail/6882/How-many-votes-in-the-2020-US-presidential-election","PredictIt",false,"none",,
|
||||||
|
"Which party will win the House in the 2022 election?","https://www.predictit.org/markets/detail/6892/Which-party-will-win-the-House-in-the-2022-election","PredictIt",false,"none",,
|
||||||
|
"How many U.S. House delegations will Republicans win in the 2020 election?","https://www.predictit.org/markets/detail/6925/How-many-US-House-delegations-will-Republicans-win-in-the-2020-election","PredictIt",false,"none",,
|
||||||
|
"How closely will the election results match the polls?","https://www.predictit.org/markets/detail/6936/How-closely-will-the-election-results-match-the-polls","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Secretary of State on Feb. 15?","https://www.predictit.org/markets/detail/6944/Who-will-be-the-Senate-confirmed-Secretary-of-State-on-Feb-15","PredictIt",false,"none",,
|
||||||
|
"Will there be more than 9 Supreme Court justices at any point in 2021?","https://www.predictit.org/markets/detail/6946/Will-there-be-more-than-9-Supreme-Court-justices-at-any-point-in-2021","PredictIt",true,"8%",,
|
||||||
|
"Who will be the Senate-confirmed Secretary of Defense on Mar. 1?","https://www.predictit.org/markets/detail/6949/Who-will-be-the-Senate-confirmed-Secretary-of-Defense-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Secretary of Labor on Mar. 1?","https://www.predictit.org/markets/detail/6951/Who-will-be-the-Senate-confirmed-Secretary-of-Labor-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Attorney General on Mar. 1?","https://www.predictit.org/markets/detail/6952/Who-will-be-the-Senate-confirmed-Attorney-General-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Will Kamala Harris file to run for president before the end of 2022?","https://www.predictit.org/markets/detail/6953/Will-Kamala-Harris-file-to-run-for-president-before-the-end-of-2022","PredictIt",true,"32%",,
|
||||||
|
"Who will be the Senate-confirmed Treasury Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6957/Who-will-be-the-Senate-confirmed-Treasury-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed HUD Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6958/Who-will-be-the-Senate-confirmed-HUD-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"What will be the margin in the Georgia special Senate election runoff?","https://www.predictit.org/markets/detail/6959/What-will-be-the-margin-in-the-Georgia-special-Senate-election-runoff","PredictIt",false,"none",,
|
||||||
|
"What will be the margin in the Georgia regular Senate election runoff?","https://www.predictit.org/markets/detail/6960/What-will-be-the-margin-in-the-Georgia-regular-Senate-election-runoff","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed HHS Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6965/Who-will-be-the-Senate-confirmed-HHS-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Commerce Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6966/Who-will-be-the-Senate-confirmed-Commerce-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Homeland Security Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6971/Who-will-be-the-Senate-confirmed-Homeland-Security-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Energy Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6972/Who-will-be-the-Senate-confirmed-Energy-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Will Mike Pence file to run for president before the end of 2022?","https://www.predictit.org/markets/detail/6975/Will-Mike-Pence-file-to-run-for-president-before-the-end-of-2022","PredictIt",true,"32%",,
|
||||||
|
"Who will be the Senate-confirmed Interior Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6976/Who-will-be-the-Senate-confirmed-Interior-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed CIA Director on Mar. 1?","https://www.predictit.org/markets/detail/6977/Who-will-be-the-Senate-confirmed-CIA-Director-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Secretary of Education on Mar. 1?","https://www.predictit.org/markets/detail/6978/Who-will-be-the-Senate-confirmed-Secretary-of-Education-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Transportation Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6979/Who-will-be-the-Senate-confirmed-Transportation-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Agriculture Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6980/Who-will-be-the-Senate-confirmed-Agriculture-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed EPA Administrator on Mar. 1?","https://www.predictit.org/markets/detail/6981/Who-will-be-the-Senate-confirmed-EPA-Administrator-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Will Alexandria Ocasio-Cortez run in the 2022 Democratic primary in NY-14?","https://www.predictit.org/markets/detail/6983/Will-Alexandria-Ocasio-Cortez-run-in-the-2022-Democratic-primary-in-NY-14","PredictIt",true,"46%",,
|
||||||
|
"Will Pete Buttigieg be confirmed to a Cabinet position by Mar. 1?","https://www.predictit.org/markets/detail/6986/Will-Pete-Buttigieg-be-confirmed-to-a-Cabinet-position-by-Mar-1","PredictIt",true,"85%",,
|
||||||
|
"Who will be the Senate-confirmed Veterans Affairs Secretary on Mar. 1?","https://www.predictit.org/markets/detail/6987/Who-will-be-the-Senate-confirmed-Veterans-Affairs-Secretary-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed Director of National Intelligence on Mar. 1?","https://www.predictit.org/markets/detail/6989/Who-will-be-the-Senate-confirmed-Director-of-National-Intelligence-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Will Amy Klobuchar be confirmed to a Cabinet position by Mar. 1?","https://www.predictit.org/markets/detail/6990/Will-Amy-Klobuchar-be-confirmed-to-a-Cabinet-position-by-Mar-1","PredictIt",true,"2%",,
|
||||||
|
"Will Elizabeth Warren be confirmed to a Cabinet position by Mar. 1?","https://www.predictit.org/markets/detail/6991/Will-Elizabeth-Warren-be-confirmed-to-a-Cabinet-position-by-Mar-1","PredictIt",true,"2%",,
|
||||||
|
"Who will be the Senate-confirmed OMB Director on Mar. 1?","https://www.predictit.org/markets/detail/6992/Who-will-be-the-Senate-confirmed-OMB-Director-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Who will be the Senate-confirmed U.S. Trade Representative on Mar. 1?","https://www.predictit.org/markets/detail/6993/Who-will-be-the-Senate-confirmed-US-Trade-Representative-on-Mar-1","PredictIt",false,"none",,
|
||||||
|
"Will Donald Trump file to run for president before the end of 2021?","https://www.predictit.org/markets/detail/6994/Will-Donald-Trump-file-to-run-for-president-before-the-end-of-2021","PredictIt",true,"33%",,
|
||||||
|
"Which party will win the 2021 New Jersey gubernatorial election?","https://www.predictit.org/markets/detail/7000/Which-party-will-win-the-2021-New-Jersey-gubernatorial-election","PredictIt",false,"none",,
|
||||||
|
"Which party will win the 2021 Virginia gubernatorial election?","https://www.predictit.org/markets/detail/7001/Which-party-will-win-the-2021-Virginia-gubernatorial-election","PredictIt",false,"none",,
|
||||||
|
"Who will be elected New York City mayor in 2021?","https://www.predictit.org/markets/detail/7002/Who-will-be-elected-New-York-City-mayor-in-2021","PredictIt",false,"none",,
|
||||||
|
"Will Andrew Yang run in the 2021 NYC Democratic Mayoral primary?","https://www.predictit.org/markets/detail/7003/Will-Andrew-Yang-run-in-the-2021-NYC-Democratic-Mayoral-primary","PredictIt",true,"95%",,
|
||||||
|
"Will Israel hold national elections for Knesset in 2021?","https://www.predictit.org/markets/detail/7007/Will-Israel-hold-national-elections-for-Knesset-in-2021","PredictIt",true,"98%",,
|
||||||
|
"Which Georgia Senate candidate will win the most runoff votes?","https://www.predictit.org/markets/detail/7008/Which-Georgia-Senate-candidate-will-win-the-most-runoff-votes","PredictIt",false,"none",,
|
||||||
|
"Which Georgia Senate candidate will win the fewest runoff votes?","https://www.predictit.org/markets/detail/7009/Which-Georgia-Senate-candidate-will-win-the-fewest-runoff-votes","PredictIt",false,"none",,
|
||||||
|
"How many votes in the Georgia regular Senate runoff election?","https://www.predictit.org/markets/detail/7011/How-many-votes-in-the-Georgia-regular-Senate-runoff-election","PredictIt",false,"none",,
|
||||||
|
"How many votes in the Georgia special Senate runoff election?","https://www.predictit.org/markets/detail/7012/How-many-votes-in-the-Georgia-special-Senate-runoff-election","PredictIt",false,"none",,
|
||||||
|
"Will a woman be elected U.S. president in 2024?","https://www.predictit.org/markets/detail/7013/Will-a-woman-be-elected-US-president-in-2024","PredictIt",true,"44%",,
|
||||||
|
"Will Alexandria Ocasio-Cortez file to run for president before the end of 2023?","https://www.predictit.org/markets/detail/7014/Will-Alexandria-Ocasio-Cortez-file-to-run-for-president-before-the-end-of-2023","PredictIt",true,"20%",,
|
||||||
|
"Will Alexandria Ocasio-Cortez run in the 2022 NY Democratic Senate primary?","https://www.predictit.org/markets/detail/7015/Will-Alexandria-Ocasio-Cortez-run-in-the-2022-NY-Democratic-Senate-primary","PredictIt",true,"31%",,
|
||||||
|
"Which party will win the U.S. Senate election in Pennsylvania in 2022?","https://www.predictit.org/markets/detail/7016/Which-party-will-win-the-US-Senate-election-in-Pennsylvania-in-2022","PredictIt",false,"none",,
|
||||||
|
"Which party will win the U.S. Senate election in North Carolina in 2022?","https://www.predictit.org/markets/detail/7017/Which-party-will-win-the-US-Senate-election-in-North-Carolina-in-2022","PredictIt",false,"none",,
|
||||||
|
"Will Donald Trump Jr. run in the 2022 Pennsylvania Republican Senate primary?","https://www.predictit.org/markets/detail/7018/Will-Donald-Trump-Jr-run-in-the-2022-Pennsylvania-Republican-Senate-primary","PredictIt",true,"17%",,
|
||||||
|
"Will Lara Trump run in the 2022 North Carolina Republican Senate primary?","https://www.predictit.org/markets/detail/7019/Will-Lara-Trump-run-in-the-2022-North-Carolina-Republican-Senate-primary","PredictIt",true,"30%",,
|
||||||
|
"Who will be the Senate-confirmed USAID Administrator on Mar. 16?","https://www.predictit.org/markets/detail/7020/Who-will-be-the-Senate-confirmed-USAID-Administrator-on-Mar-16","PredictIt",false,"none",,
|
||||||
|
"Will Ivanka Trump run in the 2022 Florida Republican Senate primary?","https://www.predictit.org/markets/detail/7021/Will-Ivanka-Trump-run-in-the-2022-Florida-Republican-Senate-primary","PredictIt",true,"19%",,
|
||||||
|
"Which party will win the U.S. Senate election in Florida in 2022?","https://www.predictit.org/markets/detail/7024/Which-party-will-win-the-US-Senate-election-in-Florida-in-2022","PredictIt",false,"none",,
|
||||||
|
"Who will win the 2021 Virginia Democratic gubernatorial primary?","https://www.predictit.org/markets/detail/7030/Who-will-win-the-2021-Virginia-Democratic-gubernatorial-primary","PredictIt",false,"none",,
|
||||||
|
"Will Benjamin Netanyahu be prime minister of Israel on June 30, 2021?","https://www.predictit.org/markets/detail/7035/Will-Benjamin-Netanyahu-be-prime-minister-of-Israel-on-June-30,-2021","PredictIt",true,"54%",,
|
||||||
|
"How many seats will Israel's Likud Party win in the next Knesset election?","https://www.predictit.org/markets/detail/7036/How-many-seats-will-Israel's-Likud-Party-win-in-the-next-Knesset-election","PredictIt",false,"none",,
|
||||||
|
"Will there be enough signatures by Mar. 17 for a vote on recall of Gov. Newsom?","https://www.predictit.org/markets/detail/7039/Will-there-be-enough-signatures-by-Mar-17-for-a-vote-on-recall-of-Gov-Newsom","PredictIt",true,"71%",,
|
||||||
|
"Who will be chancellor of Germany on Dec. 31?","https://www.predictit.org/markets/detail/7040/Who-will-be-chancellor-of-Germany-on-Dec-31","PredictIt",false,"none",,
|
||||||
|
"Who will win the 2021 Virginia Republican gubernatorial nomination?","https://www.predictit.org/markets/detail/7041/Who-will-win-the-2021-Virginia-Republican-gubernatorial-nomination","PredictIt",false,"none",,
|
||||||
|
"Will there be a statewide recount in either Georgia Senate runoff?","https://www.predictit.org/markets/detail/7043/Will-there-be-a-statewide-recount-in-either-Georgia-Senate-runoff","PredictIt",true,"2%",,
|
||||||
|
"Will Donald Trump be impeached again before the end of his term?","https://www.predictit.org/markets/detail/7044/Will-Donald-Trump-be-impeached-again-before-the-end-of-his-term","PredictIt",true,"92%",,
|
||||||
|
"How many Yea votes for a Trump impeachment resolution before noon Jan. 20?","https://www.predictit.org/markets/detail/7045/How-many-Yea-votes-for-a-Trump-impeachment-resolution-before-noon-Jan-20","PredictIt",false,"none",,
|
||||||
|
"When will Jon Ossoff be sworn in as a U.S. Senator?","https://www.predictit.org/markets/detail/7046/When-will-Jon-Ossoff-be-sworn-in-as-a-US-Senator","PredictIt",false,"none",,
|
||||||
|
"When will Raphael Warnock be sworn in as a U.S. Senator?","https://www.predictit.org/markets/detail/7048/When-will-Raphael-Warnock-be-sworn-in-as-a-US-Senator","PredictIt",false,"none",,
|
||||||
|
"How many Yea votes in House for 25th Amendment resolution by Jan. 13?","https://www.predictit.org/markets/detail/7049/How-many-Yea-votes-in-House-for-25th-Amendment-resolution-by-Jan-13","PredictIt",false,"none",,
|
|
604
data/predictit-questions.json
Normal file
604
data/predictit-questions.json
Normal file
|
@ -0,0 +1,604 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Title": "What will be the balance of power in Congress after the 2020 election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/4353/What-will-be-the-balance-of-power-in-Congress-after-the-2020-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will control the Senate after 2020 election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/4366/Which-party-will-control-the-Senate-after-2020-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump complete his first term?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/5158/Will-Donald-Trump-complete-his-first-term",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "86%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Trump pardon Jeffrey Epstein by Jan. 20, 2021?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/5665/Will-Trump-pardon-Jeffrey-Epstein-by-Jan-20,-2021",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "1%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which of these 5 European leaders will leave office next?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/5717/Which-of-these-5-European-leaders-will-leave-office-next",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will the Senate convict Donald Trump on impeachment in his first term?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/5914/Will-the-Senate-convict-Donald-Trump-on-impeachment-in-his-first-term",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "6%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Trump resign during his first term?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6008/Will-Trump-resign-during-his-first-term",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "12%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Trump pardon Rudy Giuliani before end of 2020?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6020/Will-Trump-pardon-Rudy-Giuliani-before-end-of-2020",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "2%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will NASA find 2020’s global average temperature highest on record?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6234/Will-NASA-find-2020’s-global-average-temperature-highest-on-record",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "45%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Trump pardon himself in his first term?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6453/Will-Trump-pardon-himself-in-his-first-term",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "44%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will be the popular vote margin in the 2020 presidential election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6663/What-will-be-the-popular-vote-margin-in-the-2020-presidential-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will be the net change in Senate seats, by party?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6670/What-will-be-the-net-change-in-Senate-seats,-by-party",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which U.S. Senate race will be won by the smallest margin?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6737/Which-US-Senate-race-will-be-won-by-the-smallest-margin",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many women will win election to the U.S. Senate in 2020?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6765/How-many-women-will-win-election-to-the-US-Senate-in-2020",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Democrats win the White House, Senate and House in 2020?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6770/Will-Democrats-win-the-White-House,-Senate-and-House-in-2020",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "96%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will win the 2020 House race in Iowa's 2nd District?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6789/Which-party-will-win-the-2020-House-race-in-Iowa's-2nd-District",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What percentage of the presidential vote will not be for the two major parties?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6809/What-percentage-of-the-presidential-vote-will-not-be-for-the-two-major-parties",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Nancy Pelosi become Acting U.S. President on January 20?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6852/Will-Nancy-Pelosi-become-Acting-US-President-on-January-20",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "2%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will win the 2020 House race in New York's 22nd District?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6861/Which-party-will-win-the-2020-House-race-in-New-York's-22nd-District",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will win the 2024 U.S. presidential election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6867/Which-party-will-win-the-2024-US-presidential-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will control the Senate after 2022 election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6874/Which-party-will-control-the-Senate-after-2022-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many votes in the 2020 U.S. presidential election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6882/How-many-votes-in-the-2020-US-presidential-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will win the House in the 2022 election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6892/Which-party-will-win-the-House-in-the-2022-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many U.S. House delegations will Republicans win in the 2020 election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6925/How-many-US-House-delegations-will-Republicans-win-in-the-2020-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How closely will the election results match the polls?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6936/How-closely-will-the-election-results-match-the-polls",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Secretary of State on Feb. 15?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6944/Who-will-be-the-Senate-confirmed-Secretary-of-State-on-Feb-15",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will there be more than 9 Supreme Court justices at any point in 2021?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6946/Will-there-be-more-than-9-Supreme-Court-justices-at-any-point-in-2021",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "8%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Secretary of Defense on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6949/Who-will-be-the-Senate-confirmed-Secretary-of-Defense-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Secretary of Labor on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6951/Who-will-be-the-Senate-confirmed-Secretary-of-Labor-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Attorney General on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6952/Who-will-be-the-Senate-confirmed-Attorney-General-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Kamala Harris file to run for president before the end of 2022?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6953/Will-Kamala-Harris-file-to-run-for-president-before-the-end-of-2022",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "32%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Treasury Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6957/Who-will-be-the-Senate-confirmed-Treasury-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed HUD Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6958/Who-will-be-the-Senate-confirmed-HUD-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will be the margin in the Georgia special Senate election runoff?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6959/What-will-be-the-margin-in-the-Georgia-special-Senate-election-runoff",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "What will be the margin in the Georgia regular Senate election runoff?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6960/What-will-be-the-margin-in-the-Georgia-regular-Senate-election-runoff",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed HHS Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6965/Who-will-be-the-Senate-confirmed-HHS-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Commerce Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6966/Who-will-be-the-Senate-confirmed-Commerce-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Homeland Security Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6971/Who-will-be-the-Senate-confirmed-Homeland-Security-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Energy Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6972/Who-will-be-the-Senate-confirmed-Energy-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Mike Pence file to run for president before the end of 2022?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6975/Will-Mike-Pence-file-to-run-for-president-before-the-end-of-2022",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "32%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Interior Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6976/Who-will-be-the-Senate-confirmed-Interior-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed CIA Director on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6977/Who-will-be-the-Senate-confirmed-CIA-Director-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Secretary of Education on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6978/Who-will-be-the-Senate-confirmed-Secretary-of-Education-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Transportation Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6979/Who-will-be-the-Senate-confirmed-Transportation-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Agriculture Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6980/Who-will-be-the-Senate-confirmed-Agriculture-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed EPA Administrator on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6981/Who-will-be-the-Senate-confirmed-EPA-Administrator-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Alexandria Ocasio-Cortez run in the 2022 Democratic primary in NY-14?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6983/Will-Alexandria-Ocasio-Cortez-run-in-the-2022-Democratic-primary-in-NY-14",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "46%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Pete Buttigieg be confirmed to a Cabinet position by Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6986/Will-Pete-Buttigieg-be-confirmed-to-a-Cabinet-position-by-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "85%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Veterans Affairs Secretary on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6987/Who-will-be-the-Senate-confirmed-Veterans-Affairs-Secretary-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed Director of National Intelligence on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6989/Who-will-be-the-Senate-confirmed-Director-of-National-Intelligence-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Amy Klobuchar be confirmed to a Cabinet position by Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6990/Will-Amy-Klobuchar-be-confirmed-to-a-Cabinet-position-by-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "2%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Elizabeth Warren be confirmed to a Cabinet position by Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6991/Will-Elizabeth-Warren-be-confirmed-to-a-Cabinet-position-by-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "2%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed OMB Director on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6992/Who-will-be-the-Senate-confirmed-OMB-Director-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed U.S. Trade Representative on Mar. 1?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6993/Who-will-be-the-Senate-confirmed-US-Trade-Representative-on-Mar-1",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump file to run for president before the end of 2021?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/6994/Will-Donald-Trump-file-to-run-for-president-before-the-end-of-2021",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "33%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will win the 2021 New Jersey gubernatorial election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7000/Which-party-will-win-the-2021-New-Jersey-gubernatorial-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will win the 2021 Virginia gubernatorial election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7001/Which-party-will-win-the-2021-Virginia-gubernatorial-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be elected New York City mayor in 2021?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7002/Who-will-be-elected-New-York-City-mayor-in-2021",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Andrew Yang run in the 2021 NYC Democratic Mayoral primary?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7003/Will-Andrew-Yang-run-in-the-2021-NYC-Democratic-Mayoral-primary",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "95%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Israel hold national elections for Knesset in 2021?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7007/Will-Israel-hold-national-elections-for-Knesset-in-2021",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "98%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which Georgia Senate candidate will win the most runoff votes?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7008/Which-Georgia-Senate-candidate-will-win-the-most-runoff-votes",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which Georgia Senate candidate will win the fewest runoff votes?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7009/Which-Georgia-Senate-candidate-will-win-the-fewest-runoff-votes",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many votes in the Georgia regular Senate runoff election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7011/How-many-votes-in-the-Georgia-regular-Senate-runoff-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many votes in the Georgia special Senate runoff election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7012/How-many-votes-in-the-Georgia-special-Senate-runoff-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will a woman be elected U.S. president in 2024?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7013/Will-a-woman-be-elected-US-president-in-2024",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "44%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Alexandria Ocasio-Cortez file to run for president before the end of 2023?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7014/Will-Alexandria-Ocasio-Cortez-file-to-run-for-president-before-the-end-of-2023",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "20%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Alexandria Ocasio-Cortez run in the 2022 NY Democratic Senate primary?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7015/Will-Alexandria-Ocasio-Cortez-run-in-the-2022-NY-Democratic-Senate-primary",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "31%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will win the U.S. Senate election in Pennsylvania in 2022?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7016/Which-party-will-win-the-US-Senate-election-in-Pennsylvania-in-2022",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will win the U.S. Senate election in North Carolina in 2022?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7017/Which-party-will-win-the-US-Senate-election-in-North-Carolina-in-2022",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump Jr. run in the 2022 Pennsylvania Republican Senate primary?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7018/Will-Donald-Trump-Jr-run-in-the-2022-Pennsylvania-Republican-Senate-primary",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "17%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Lara Trump run in the 2022 North Carolina Republican Senate primary?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7019/Will-Lara-Trump-run-in-the-2022-North-Carolina-Republican-Senate-primary",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "30%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be the Senate-confirmed USAID Administrator on Mar. 16?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7020/Who-will-be-the-Senate-confirmed-USAID-Administrator-on-Mar-16",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Ivanka Trump run in the 2022 Florida Republican Senate primary?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7021/Will-Ivanka-Trump-run-in-the-2022-Florida-Republican-Senate-primary",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "19%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Which party will win the U.S. Senate election in Florida in 2022?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7024/Which-party-will-win-the-US-Senate-election-in-Florida-in-2022",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will win the 2021 Virginia Democratic gubernatorial primary?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7030/Who-will-win-the-2021-Virginia-Democratic-gubernatorial-primary",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Benjamin Netanyahu be prime minister of Israel on June 30, 2021?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7035/Will-Benjamin-Netanyahu-be-prime-minister-of-Israel-on-June-30,-2021",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "54%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many seats will Israel's Likud Party win in the next Knesset election?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7036/How-many-seats-will-Israel's-Likud-Party-win-in-the-next-Knesset-election",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will there be enough signatures by Mar. 17 for a vote on recall of Gov. Newsom?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7039/Will-there-be-enough-signatures-by-Mar-17-for-a-vote-on-recall-of-Gov-Newsom",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "71%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will be chancellor of Germany on Dec. 31?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7040/Who-will-be-chancellor-of-Germany-on-Dec-31",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Who will win the 2021 Virginia Republican gubernatorial nomination?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7041/Who-will-win-the-2021-Virginia-Republican-gubernatorial-nomination",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will there be a statewide recount in either Georgia Senate runoff?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7043/Will-there-be-a-statewide-recount-in-either-Georgia-Senate-runoff",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "2%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "Will Donald Trump be impeached again before the end of his term?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7044/Will-Donald-Trump-be-impeached-again-before-the-end-of-his-term",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "92%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many Yea votes for a Trump impeachment resolution before noon Jan. 20?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7045/How-many-Yea-votes-for-a-Trump-impeachment-resolution-before-noon-Jan-20",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "When will Jon Ossoff be sworn in as a U.S. Senator?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7046/When-will-Jon-Ossoff-be-sworn-in-as-a-US-Senator",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "When will Raphael Warnock be sworn in as a U.S. Senator?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7048/When-will-Raphael-Warnock-be-sworn-in-as-a-US-Senator",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Title": "How many Yea votes in House for 25th Amendment resolution by Jan. 13?",
|
||||||
|
"URL": "https://www.predictit.org/markets/detail/7049/How-many-Yea-votes-in-House-for-25th-Amendment-resolution-by-Jan-13",
|
||||||
|
"Platform": "PredictIt",
|
||||||
|
"Binary question?": false,
|
||||||
|
"Percentage": "none"
|
||||||
|
}
|
||||||
|
]
|
2
data/template-questions.csv
Normal file
2
data/template-questions.csv
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
"Title","URL","Platform","Binary question?","Percentage","# Forecasts","# Forecasters"
|
||||||
|
"Some title","someurl.com","some platform",true,"X%/none",15,10
|
|
10
data/template-questions.json
Normal file
10
data/template-questions.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[ {
|
||||||
|
"Title": "Some title",
|
||||||
|
"URL": "someurl.com",
|
||||||
|
"Platform": "some platform",
|
||||||
|
"Binary question?": true,
|
||||||
|
"Percentage": "X%/none",
|
||||||
|
"# Forecasts": 15,
|
||||||
|
"# Forecasters": 10
|
||||||
|
}
|
||||||
|
]
|
1
node_modules/.bin/is-docker
generated
vendored
Symbolic link
1
node_modules/.bin/is-docker
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../is-docker/cli.js
|
1
node_modules/.bin/json2csv
generated
vendored
Symbolic link
1
node_modules/.bin/json2csv
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../json2csv/bin/json2csv.js
|
123
node_modules/.package-lock.json
generated
vendored
Normal file
123
node_modules/.package-lock.json
generated
vendored
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
{
|
||||||
|
"name": "metaforecasts",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"node_modules/axios": {
|
||||||
|
"version": "0.21.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||||
|
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/commander": {
|
||||||
|
"version": "6.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
|
||||||
|
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/follow-redirects": {
|
||||||
|
"version": "1.13.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
|
||||||
|
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fs": {
|
||||||
|
"version": "0.0.1-security",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||||
|
"integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ="
|
||||||
|
},
|
||||||
|
"node_modules/is-docker": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==",
|
||||||
|
"bin": {
|
||||||
|
"is-docker": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-wsl": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
|
||||||
|
"dependencies": {
|
||||||
|
"is-docker": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/json2csv": {
|
||||||
|
"version": "5.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/json2csv/-/json2csv-5.0.5.tgz",
|
||||||
|
"integrity": "sha512-/UyvnfuUghRM+C/AiQ02X0LS+/AKfugcwaWo/gAz1pi203v29sUMrMSNEC088i+h0EG39eSsmeL9Z0iK+9MM0A==",
|
||||||
|
"dependencies": {
|
||||||
|
"commander": "^6.1.0",
|
||||||
|
"jsonparse": "^1.3.1",
|
||||||
|
"lodash.get": "^4.4.2"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"json2csv": "bin/json2csv.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10",
|
||||||
|
"npm": ">= 6.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/jsonparse": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz",
|
||||||
|
"integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=",
|
||||||
|
"engines": [
|
||||||
|
"node >= 0.2.0"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node_modules/lodash.get": {
|
||||||
|
"version": "4.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||||
|
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
||||||
|
},
|
||||||
|
"node_modules/open": {
|
||||||
|
"version": "7.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/open/-/open-7.3.1.tgz",
|
||||||
|
"integrity": "sha512-f2wt9DCBKKjlFbjzGb8MOAW8LH8F0mrs1zc7KTjAJ9PZNQbfenzWbNP1VZJvw6ICMG9r14Ah6yfwPn7T7i646A==",
|
||||||
|
"dependencies": {
|
||||||
|
"is-docker": "^2.0.0",
|
||||||
|
"is-wsl": "^2.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/papaparse": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-Lb7jN/4bTpiuGPrYy4tkKoUS8sTki8zacB5ke1p5zolhcSE4TlWgrlsxjrDTbG/dFVh07ck7X36hUf/b5V68pg=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
685
node_modules/axios/CHANGELOG.md
generated
vendored
Normal file
685
node_modules/axios/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,685 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
### 0.21.1 (December 21, 2020)
|
||||||
|
|
||||||
|
Fixes and Functionality:
|
||||||
|
|
||||||
|
- Hotfix: Prevent SSRF (#3410)
|
||||||
|
- Protocol not parsed when setting proxy config from env vars (#3070)
|
||||||
|
- Updating axios in types to be lower case (#2797)
|
||||||
|
- Adding a type guard for `AxiosError` (#2949)
|
||||||
|
|
||||||
|
Internal and Tests:
|
||||||
|
|
||||||
|
- Remove the skipping of the `socket` http test (#3364)
|
||||||
|
- Use different socket for Win32 test (#3375)
|
||||||
|
|
||||||
|
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
||||||
|
|
||||||
|
- Daniel Lopretto <timemachine3030@users.noreply.github.com>
|
||||||
|
- Jason Kwok <JasonHK@users.noreply.github.com>
|
||||||
|
- Jay <jasonsaayman@gmail.com>
|
||||||
|
- Jonathan Foster <jonathan@jonathanfoster.io>
|
||||||
|
- Remco Haszing <remcohaszing@gmail.com>
|
||||||
|
- Xianming Zhong <chinesedfan@qq.com>
|
||||||
|
|
||||||
|
### 0.21.0 (October 23, 2020)
|
||||||
|
|
||||||
|
Fixes and Functionality:
|
||||||
|
|
||||||
|
- Fixing requestHeaders.Authorization ([#3287](https://github.com/axios/axios/pull/3287))
|
||||||
|
- Fixing node types ([#3237](https://github.com/axios/axios/pull/3237))
|
||||||
|
- Fixing axios.delete ignores config.data ([#3282](https://github.com/axios/axios/pull/3282))
|
||||||
|
- Revert "Fixing overwrite Blob/File type as Content-Type in browser. (#1773)" ([#3289](https://github.com/axios/axios/pull/3289))
|
||||||
|
- Fixing an issue that type 'null' and 'undefined' is not assignable to validateStatus when typescript strict option is enabled ([#3200](https://github.com/axios/axios/pull/3200))
|
||||||
|
|
||||||
|
Internal and Tests:
|
||||||
|
|
||||||
|
- Lock travis to not use node v15 ([#3361](https://github.com/axios/axios/pull/3361))
|
||||||
|
|
||||||
|
Documentation:
|
||||||
|
|
||||||
|
- Fixing simple typo, existant -> existent ([#3252](https://github.com/axios/axios/pull/3252))
|
||||||
|
- Fixing typos ([#3309](https://github.com/axios/axios/pull/3309))
|
||||||
|
|
||||||
|
Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
|
||||||
|
|
||||||
|
- Allan Cruz <57270969+Allanbcruz@users.noreply.github.com>
|
||||||
|
- George Cheng <Gerhut@GMail.com>
|
||||||
|
- Jay <jasonsaayman@gmail.com>
|
||||||
|
- Kevin Kirsche <Kev.Kirsche+GitHub@gmail.com>
|
||||||
|
- Remco Haszing <remcohaszing@gmail.com>
|
||||||
|
- Taemin Shin <cprayer13@gmail.com>
|
||||||
|
- Tim Gates <tim.gates@iress.com>
|
||||||
|
- Xianming Zhong <chinesedfan@qq.com>
|
||||||
|
|
||||||
|
### 0.20.0 (August 20, 2020)
|
||||||
|
|
||||||
|
Release of 0.20.0-pre as a full release with no other changes.
|
||||||
|
|
||||||
|
### 0.20.0-pre (July 15, 2020)
|
||||||
|
|
||||||
|
Fixes and Functionality:
|
||||||
|
|
||||||
|
- Fixing response with utf-8 BOM can not parse to json ([#2419](https://github.com/axios/axios/pull/2419))
|
||||||
|
- fix: remove byte order marker (UTF-8 BOM) when transform response
|
||||||
|
- fix: remove BOM only utf-8
|
||||||
|
- test: utf-8 BOM
|
||||||
|
- fix: incorrect param name
|
||||||
|
- Refactor mergeConfig without utils.deepMerge ([#2844](https://github.com/axios/axios/pull/2844))
|
||||||
|
- Adding failing test
|
||||||
|
- Fixing #2587 default custom config persisting
|
||||||
|
- Adding Concat keys and filter duplicates
|
||||||
|
- Fixed value from CPE
|
||||||
|
- update for review feedbacks
|
||||||
|
- no deepMerge
|
||||||
|
- only merge between plain objects
|
||||||
|
- fix rename
|
||||||
|
- always merge config by mergeConfig
|
||||||
|
- extract function mergeDeepProperties
|
||||||
|
- refactor mergeConfig with all keys, and add special logic for validateStatus
|
||||||
|
- add test for resetting headers
|
||||||
|
- add lots of tests and fix a bug
|
||||||
|
- should not inherit `data`
|
||||||
|
- use simple toString
|
||||||
|
- Fixing overwrite Blob/File type as Content-Type in browser. ([#1773](https://github.com/axios/axios/pull/1773))
|
||||||
|
- Fixing an issue that type 'null' is not assignable to validateStatus ([#2773](https://github.com/axios/axios/pull/2773))
|
||||||
|
- Fixing special char encoding ([#1671](https://github.com/axios/axios/pull/1671))
|
||||||
|
- removing @ character from replacement list since it is a reserved character
|
||||||
|
- Updating buildURL test to not include the @ character
|
||||||
|
- Removing console logs
|
||||||
|
- Fixing password encoding with special characters in basic authentication ([#1492](https://github.com/axios/axios/pull/1492))
|
||||||
|
- Fixing password encoding with special characters in basic authentication
|
||||||
|
- Adding test to check if password with non-Latin1 characters pass
|
||||||
|
- Fixing 'Network Error' in react native android ([#1487](https://github.com/axios/axios/pull/1487))
|
||||||
|
There is a bug in react native Android platform when using get method. It will trigger a 'Network Error' when passing the requestData which is an empty string to request.send function. So if the requestData is an empty string we can set it to null as well to fix the bug.
|
||||||
|
- Fixing Cookie Helper with Asyc Components ([#1105](https://github.com/axios/axios/pull/1105)) ([#1107](https://github.com/axios/axios/pull/1107))
|
||||||
|
- Fixing 'progressEvent' type ([#2851](https://github.com/axios/axios/pull/2851))
|
||||||
|
- Fix 'progressEvent' type
|
||||||
|
- Update axios.ts
|
||||||
|
- Fixing getting local files (file://) failed ([#2470](https://github.com/axios/axios/pull/2470))
|
||||||
|
- fix issue #2416, #2396
|
||||||
|
- fix Eslint warn
|
||||||
|
- Modify judgment conditions
|
||||||
|
- add unit test
|
||||||
|
- update unit test
|
||||||
|
- update unit test
|
||||||
|
- Allow PURGE method in typings ([#2191](https://github.com/axios/axios/pull/2191))
|
||||||
|
- Adding option to disable automatic decompression ([#2661](https://github.com/axios/axios/pull/2661))
|
||||||
|
- Adding ability to disable auto decompression
|
||||||
|
- Updating decompress documentation in README
|
||||||
|
- Fixing test\unit\adapters\http.js lint errors
|
||||||
|
- Adding test for disabling auto decompression
|
||||||
|
- Removing changes that fixed lint errors in tests
|
||||||
|
- Removing formatting change to unit test
|
||||||
|
- Add independent `maxBodyLength` option ([#2781](https://github.com/axios/axios/pull/2781))
|
||||||
|
- Add independent option to set the maximum size of the request body
|
||||||
|
- Remove maxBodyLength check
|
||||||
|
- Update README
|
||||||
|
- Assert for error code and message
|
||||||
|
- Adding responseEncoding to mergeConfig ([#1745](https://github.com/axios/axios/pull/1745))
|
||||||
|
- Compatible with follow-redirect aborts the request ([#2689](https://github.com/axios/axios/pull/2689))
|
||||||
|
- Compatible with follow-redirect aborts the request
|
||||||
|
- Use the error code
|
||||||
|
- Fix merging of params ([#2656](https://github.com/axios/axios/pull/2656))
|
||||||
|
- Name function to avoid ESLint func-names warning
|
||||||
|
- Switch params config to merge list and update tests
|
||||||
|
- Restore testing of both false and null
|
||||||
|
- Restore test cases for keys without defaults
|
||||||
|
- Include test for non-object values that aren't false-y.
|
||||||
|
- Revert `finally` as `then` ([#2683](https://github.com/axios/axios/pull/2683))
|
||||||
|
|
||||||
|
Internal and Tests:
|
||||||
|
|
||||||
|
- Fix stale bot config ([#3049](https://github.com/axios/axios/pull/3049))
|
||||||
|
- fix stale bot config
|
||||||
|
- fix multiple lines
|
||||||
|
- Add days and change name to work ([#3035](https://github.com/axios/axios/pull/3035))
|
||||||
|
- Update close-issues.yml ([#3031](https://github.com/axios/axios/pull/3031))
|
||||||
|
- Update close-issues.yml
|
||||||
|
Update close message to read better 😄
|
||||||
|
- Fix use of quotations
|
||||||
|
Use single quotes as per other .yml files
|
||||||
|
- Remove user name form message
|
||||||
|
- Add GitHub actions to close stale issues/prs ([#3029](https://github.com/axios/axios/pull/3029))
|
||||||
|
- prepare stale actions
|
||||||
|
- update messages
|
||||||
|
- Add exempt labels and lighten up comments
|
||||||
|
- Add GitHub actions to close invalid issues ([#3022](https://github.com/axios/axios/pull/3022))
|
||||||
|
- add close actions
|
||||||
|
- fix with checkout
|
||||||
|
- update issue templates
|
||||||
|
- add reminder
|
||||||
|
- update close message
|
||||||
|
- Add test with Node.js 12 ([#2860](https://github.com/axios/axios/pull/2860))
|
||||||
|
- test with Node.js 12
|
||||||
|
- test with latest
|
||||||
|
- Adding console log on sandbox server startup ([#2210](https://github.com/axios/axios/pull/2210))
|
||||||
|
- Adding console log on sandbox server startup
|
||||||
|
- Update server.js
|
||||||
|
Add server error handling
|
||||||
|
- Update server.js
|
||||||
|
Better error message, remove retry.
|
||||||
|
- Adding tests for method `options` type definitions ([#1996](https://github.com/axios/axios/pull/1996))
|
||||||
|
Update tests.
|
||||||
|
- Add test for redirecting with too large response ([#2695](https://github.com/axios/axios/pull/2695))
|
||||||
|
- Fixing unit test failure in Windows OS ([#2601](https://github.com/axios/axios/pull/2601))
|
||||||
|
- Fixing issue for HEAD method and gzipped response ([#2666](https://github.com/axios/axios/pull/2666))
|
||||||
|
- Fix tests in browsers ([#2748](https://github.com/axios/axios/pull/2748))
|
||||||
|
- chore: add `jsdelivr` and `unpkg` support ([#2443](https://github.com/axios/axios/pull/2443))
|
||||||
|
|
||||||
|
Documentation:
|
||||||
|
|
||||||
|
- Adding support for URLSearchParams in node ([#1900](https://github.com/axios/axios/pull/1900))
|
||||||
|
- Adding support for URLSearchParams in node
|
||||||
|
- Remove un-needed code
|
||||||
|
- Update utils.js
|
||||||
|
- Make changes as suggested
|
||||||
|
- Adding table of content (preview) ([#3050](https://github.com/axios/axios/pull/3050))
|
||||||
|
- add toc (preview)
|
||||||
|
- remove toc in toc
|
||||||
|
Signed-off-by: Moni <usmoni@gmail.com>
|
||||||
|
- fix sublinks
|
||||||
|
- fix indentation
|
||||||
|
- remove redundant table links
|
||||||
|
- update caps and indent
|
||||||
|
- remove axios
|
||||||
|
- Replace 'blacklist' with 'blocklist' ([#3006](https://github.com/axios/axios/pull/3006))
|
||||||
|
- docs(): Detailed config options environment. ([#2088](https://github.com/axios/axios/pull/2088))
|
||||||
|
- docs(): Detailed config options environment.
|
||||||
|
- Update README.md
|
||||||
|
- Include axios-data-unpacker in ECOSYSTEM.md ([#2080](https://github.com/axios/axios/pull/2080))
|
||||||
|
- Allow opening examples in Gitpod ([#1958](https://github.com/axios/axios/pull/1958))
|
||||||
|
- Remove axios.all() and axios.spread() from Readme.md ([#2727](https://github.com/axios/axios/pull/2727))
|
||||||
|
- remove axios.all(), axios.spread()
|
||||||
|
- replace example
|
||||||
|
- axios.all() -> Promise.all()
|
||||||
|
- axios.spread(function (acct, perms)) -> function (acct, perms)
|
||||||
|
- add deprecated mark
|
||||||
|
- Update README.md ([#2887](https://github.com/axios/axios/pull/2887))
|
||||||
|
Small change to the data attribute doc of the config. A request body can also be set for DELETE methods but this wasn't mentioned in the documentation (it only mentioned POST, PUT and PATCH). Took my some 10-20 minutes until I realized that I don't need to manipulate the request body with transformRequest in the case of DELETE.
|
||||||
|
- Include swagger-taxos-codegen in ECOSYSTEM.md ([#2162](https://github.com/axios/axios/pull/2162))
|
||||||
|
- Add CDNJS version badge in README.md ([#878](https://github.com/axios/axios/pull/878))
|
||||||
|
This badge will show the version on CDNJS!
|
||||||
|
- Documentation update to clear up ambiguity in code examples ([#2928](https://github.com/axios/axios/pull/2928))
|
||||||
|
- Made an adjustment to the documentation to clear up any ambiguity around the use of "fs". This should help clear up that the code examples with "fs" cannot be used on the client side.
|
||||||
|
- Update README.md about validateStatus ([#2912](https://github.com/axios/axios/pull/2912))
|
||||||
|
Rewrote the comment from "Reject only if the status code is greater than or equal to 500" to "Resolve only if the status code is less than 500"
|
||||||
|
- Updating documentation for usage form-data ([#2805](https://github.com/axios/axios/pull/2805))
|
||||||
|
Closes #2049
|
||||||
|
- Fixing CHANGELOG.md issue link ([#2784](https://github.com/axios/axios/pull/2784))
|
||||||
|
- Include axios-hooks in ECOSYSTEM.md ([#2003](https://github.com/axios/axios/pull/2003))
|
||||||
|
- Added Response header access instructions ([#1901](https://github.com/axios/axios/pull/1901))
|
||||||
|
- Added Response header access instructions
|
||||||
|
- Added note about using bracket notation
|
||||||
|
- Add `onUploadProgress` and `onDownloadProgress` are browser only ([#2763](https://github.com/axios/axios/pull/2763))
|
||||||
|
Saw in #928 and #1966 that `onUploadProgress` and `onDownloadProgress` only work in the browser and was missing that from the README.
|
||||||
|
- Update ' sign to ` in proxy spec ([#2778](https://github.com/axios/axios/pull/2778))
|
||||||
|
- Adding jsDelivr link in README ([#1110](https://github.com/axios/axios/pull/1110))
|
||||||
|
- Adding jsDelivr link
|
||||||
|
- Add SRI
|
||||||
|
- Remove SRI
|
||||||
|
|
||||||
|
Huge thanks to everyone who contributed to this release via code (authors listed
|
||||||
|
below) or via reviews and triaging on GitHub:
|
||||||
|
|
||||||
|
- Alan Wang <wp_scut@163.com>
|
||||||
|
- Alexandru Ungureanu <khakcarot@gmail.com>
|
||||||
|
- Anubhav Srivastava <anubhav.srivastava00@gmail.com>
|
||||||
|
- Benny Neugebauer <bn@bennyn.de>
|
||||||
|
- Cr <631807682@qq.com>
|
||||||
|
- David <cygnidavid@gmail.com>
|
||||||
|
- David Ko <david.ko@pvtmethod.com>
|
||||||
|
- David Tanner <david.tanner@lifeomic.com>
|
||||||
|
- Emily Morehouse <emilyemorehouse@gmail.com>
|
||||||
|
- Felipe Martins <felipewmartins@gmail.com>
|
||||||
|
- Fonger <5862369+Fonger@users.noreply.github.com>
|
||||||
|
- Frostack <soulburn007@gmail.com>
|
||||||
|
- George Cheng <Gerhut@GMail.com>
|
||||||
|
- grumblerchester <grumblerchester@users.noreply.github.com>
|
||||||
|
- Gustavo López <gualopezb@gmail.com>
|
||||||
|
- hexaez <45806662+hexaez@users.noreply.github.com>
|
||||||
|
- huangzuizui <huangzuizui@gmail.com>
|
||||||
|
- Ian Wijma <ian@wij.ma>
|
||||||
|
- Jay <jasonsaayman@gmail.com>
|
||||||
|
- jeffjing <zgayjjf@qq.com>
|
||||||
|
- jennynju <46782518+jennynju@users.noreply.github.com>
|
||||||
|
- Jimmy Liao <52391190+jimmy-liao-gogoro@users.noreply.github.com>
|
||||||
|
- Jonathan Sharpe <j.r.sharpe@gmail.com>
|
||||||
|
- JounQin <admin@1stg.me>
|
||||||
|
- Justin Beckwith <justin.beckwith@gmail.com>
|
||||||
|
- Kamil Posiadała <3dcreator.pl@gmail.com>
|
||||||
|
- Lukas Drgon <lukas.drgon@gmail.com>
|
||||||
|
- marcinx <mail@marcinx.com>
|
||||||
|
- Martti Laine <martti@codeclown.net>
|
||||||
|
- Michał Zarach <michal.m.zarach@gmail.com>
|
||||||
|
- Moni <usmoni@gmail.com>
|
||||||
|
- Motonori Iwata <121048+iwata@users.noreply.github.com>
|
||||||
|
- Nikita Galkin <nikita@galk.in>
|
||||||
|
- Petr Mares <petr@mares.tw>
|
||||||
|
- Philippe Recto <precto1285@gmal.com>
|
||||||
|
- Remco Haszing <remcohaszing@gmail.com>
|
||||||
|
- rockcs1992 <chengshi1219@gmail.com>
|
||||||
|
- Ryan Bown <rbown@niftee.com.au>
|
||||||
|
- Samina Fu <sufuf3@gmail.com>
|
||||||
|
- Simone Busoli <simone.busoli@gmail.com>
|
||||||
|
- Spencer von der Ohe <s.vonderohe40@gmail.com>
|
||||||
|
- Sven Efftinge <sven.efftinge@typefox.io>
|
||||||
|
- Taegyeoung Oh <otk1090@naver.com>
|
||||||
|
- Taemin Shin <cprayer13@gmail.com>
|
||||||
|
- Thibault Ehrhart <1208424+ehrhart@users.noreply.github.com>
|
||||||
|
- Xianming Zhong <chinesedfan@qq.com>
|
||||||
|
- Yasu Flores <carlosyasu91@gmail.com>
|
||||||
|
- Zac Delventhal <delventhalz@gmail.com>
|
||||||
|
|
||||||
|
### 0.19.2 (Jan 20, 2020)
|
||||||
|
|
||||||
|
- Remove unnecessary XSS check ([#2679](https://github.com/axios/axios/pull/2679)) (see ([#2646](https://github.com/axios/axios/issues/2646)) for discussion)
|
||||||
|
|
||||||
|
### 0.19.1 (Jan 7, 2020)
|
||||||
|
|
||||||
|
Fixes and Functionality:
|
||||||
|
|
||||||
|
- Fixing invalid agent issue ([#1904](https://github.com/axios/axios/pull/1904))
|
||||||
|
- Fix ignore set withCredentials false ([#2582](https://github.com/axios/axios/pull/2582))
|
||||||
|
- Delete useless default to hash ([#2458](https://github.com/axios/axios/pull/2458))
|
||||||
|
- Fix HTTP/HTTPs agents passing to follow-redirect ([#1904](https://github.com/axios/axios/pull/1904))
|
||||||
|
- Fix ignore set withCredentials false ([#2582](https://github.com/axios/axios/pull/2582))
|
||||||
|
- Fix CI build failure ([#2570](https://github.com/axios/axios/pull/2570))
|
||||||
|
- Remove dependency on is-buffer from package.json ([#1816](https://github.com/axios/axios/pull/1816))
|
||||||
|
- Adding options typings ([#2341](https://github.com/axios/axios/pull/2341))
|
||||||
|
- Adding Typescript HTTP method definition for LINK and UNLINK. ([#2444](https://github.com/axios/axios/pull/2444))
|
||||||
|
- Update dist with newest changes, fixes Custom Attributes issue
|
||||||
|
- Change syntax to see if build passes ([#2488](https://github.com/axios/axios/pull/2488))
|
||||||
|
- Update Webpack + deps, remove now unnecessary polyfills ([#2410](https://github.com/axios/axios/pull/2410))
|
||||||
|
- Fix to prevent XSS, throw an error when the URL contains a JS script ([#2464](https://github.com/axios/axios/pull/2464))
|
||||||
|
- Add custom timeout error copy in config ([#2275](https://github.com/axios/axios/pull/2275))
|
||||||
|
- Add error toJSON example ([#2466](https://github.com/axios/axios/pull/2466))
|
||||||
|
- Fixing Vulnerability A Fortify Scan finds a critical Cross-Site Scrip… ([#2451](https://github.com/axios/axios/pull/2451))
|
||||||
|
- Fixing subdomain handling on no_proxy ([#2442](https://github.com/axios/axios/pull/2442))
|
||||||
|
- Make redirection from HTTP to HTTPS work ([#2426](https://github.com/axios/axios/pull/2426)) and ([#2547](https://github.com/axios/axios/pull/2547))
|
||||||
|
- Add toJSON property to AxiosError type ([#2427](https://github.com/axios/axios/pull/2427))
|
||||||
|
- Fixing socket hang up error on node side for slow response. ([#1752](https://github.com/axios/axios/pull/1752))
|
||||||
|
- Alternative syntax to send data into the body ([#2317](https://github.com/axios/axios/pull/2317))
|
||||||
|
- Fixing custom config options ([#2207](https://github.com/axios/axios/pull/2207))
|
||||||
|
- Fixing set `config.method` after mergeConfig for Axios.prototype.request ([#2383](https://github.com/axios/axios/pull/2383))
|
||||||
|
- Axios create url bug ([#2290](https://github.com/axios/axios/pull/2290))
|
||||||
|
- Do not modify config.url when using a relative baseURL (resolves [#1628](https://github.com/axios/axios/issues/1098)) ([#2391](https://github.com/axios/axios/pull/2391))
|
||||||
|
- Add typescript HTTP method definition for LINK and UNLINK ([#2444](https://github.com/axios/axios/pull/2444))
|
||||||
|
|
||||||
|
Internal:
|
||||||
|
|
||||||
|
- Revert "Update Webpack + deps, remove now unnecessary polyfills" ([#2479](https://github.com/axios/axios/pull/2479))
|
||||||
|
- Order of if/else blocks is causing unit tests mocking XHR. ([#2201](https://github.com/axios/axios/pull/2201))
|
||||||
|
- Add license badge ([#2446](https://github.com/axios/axios/pull/2446))
|
||||||
|
- Fix travis CI build [#2386](https://github.com/axios/axios/pull/2386)
|
||||||
|
- Fix cancellation error on build master. #2290 #2207 ([#2407](https://github.com/axios/axios/pull/2407))
|
||||||
|
|
||||||
|
Documentation:
|
||||||
|
|
||||||
|
- Fixing typo in CHANGELOG.md: s/Functionallity/Functionality ([#2639](https://github.com/axios/axios/pull/2639))
|
||||||
|
- Fix badge, use master branch ([#2538](https://github.com/axios/axios/pull/2538))
|
||||||
|
- Fix typo in changelog [#2193](https://github.com/axios/axios/pull/2193)
|
||||||
|
- Document fix ([#2514](https://github.com/axios/axios/pull/2514))
|
||||||
|
- Update docs with no_proxy change, issue #2484 ([#2513](https://github.com/axios/axios/pull/2513))
|
||||||
|
- Fixing missing words in docs template ([#2259](https://github.com/axios/axios/pull/2259))
|
||||||
|
- 🐛Fix request finally documentation in README ([#2189](https://github.com/axios/axios/pull/2189))
|
||||||
|
- updating spelling and adding link to docs ([#2212](https://github.com/axios/axios/pull/2212))
|
||||||
|
- docs: minor tweak ([#2404](https://github.com/axios/axios/pull/2404))
|
||||||
|
- Update response interceptor docs ([#2399](https://github.com/axios/axios/pull/2399))
|
||||||
|
- Update README.md ([#2504](https://github.com/axios/axios/pull/2504))
|
||||||
|
- Fix word 'sintaxe' to 'syntax' in README.md ([#2432](https://github.com/axios/axios/pull/2432))
|
||||||
|
- updating README: notes on CommonJS autocomplete ([#2256](https://github.com/axios/axios/pull/2256))
|
||||||
|
- Fix grammar in README.md ([#2271](https://github.com/axios/axios/pull/2271))
|
||||||
|
- Doc fixes, minor examples cleanup ([#2198](https://github.com/axios/axios/pull/2198))
|
||||||
|
|
||||||
|
### 0.19.0 (May 30, 2019)
|
||||||
|
|
||||||
|
Fixes and Functionality:
|
||||||
|
|
||||||
|
- Added support for no_proxy env variable ([#1693](https://github.com/axios/axios/pull/1693/files)) - Chance Dickson
|
||||||
|
- Unzip response body only for statuses != 204 ([#1129](https://github.com/axios/axios/pull/1129)) - drawski
|
||||||
|
- Destroy stream on exceeding maxContentLength (fixes [#1098](https://github.com/axios/axios/issues/1098)) ([#1485](https://github.com/axios/axios/pull/1485)) - Gadzhi Gadzhiev
|
||||||
|
- Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama
|
||||||
|
- Fixing Mocha tests by locking follow-redirects version to 1.5.10 ([#1993](https://github.com/axios/axios/pull/1993)) - grumblerchester
|
||||||
|
- Allow uppercase methods in typings. ([#1781](https://github.com/axios/axios/pull/1781)) - Ken Powers
|
||||||
|
- Fixing building url with hash mark ([#1771](https://github.com/axios/axios/pull/1771)) - Anatoly Ryabov
|
||||||
|
- This commit fix building url with hash map (fragment identifier) when parameters are present: they must not be added after `#`, because client cut everything after `#`
|
||||||
|
- Preserve HTTP method when following redirect ([#1758](https://github.com/axios/axios/pull/1758)) - Rikki Gibson
|
||||||
|
- Add `getUri` signature to TypeScript definition. ([#1736](https://github.com/axios/axios/pull/1736)) - Alexander Trauzzi
|
||||||
|
- Adding isAxiosError flag to errors thrown by axios ([#1419](https://github.com/axios/axios/pull/1419)) - Ayush Gupta
|
||||||
|
|
||||||
|
Internal:
|
||||||
|
|
||||||
|
- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel
|
||||||
|
- Fix failing SauceLabs tests by updating configuration - Emily Morehouse
|
||||||
|
- Add issue templates - Emily Morehouse
|
||||||
|
|
||||||
|
Documentation:
|
||||||
|
|
||||||
|
- Consistent coding style in README ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez
|
||||||
|
- Add information about auth parameter to README ([#2166](https://github.com/axios/axios/pull/2166)) - xlaguna
|
||||||
|
- Add DELETE to list of methods that allow data as a config option ([#2169](https://github.com/axios/axios/pull/2169)) - Daniela Borges Matos de Carvalho
|
||||||
|
- Update ECOSYSTEM.md - Add Axios Endpoints ([#2176](https://github.com/axios/axios/pull/2176)) - Renan
|
||||||
|
- Add r2curl in ECOSYSTEM ([#2141](https://github.com/axios/axios/pull/2141)) - 유용우 / CX
|
||||||
|
- Update README.md - Add instructions for installing with yarn ([#2036](https://github.com/axios/axios/pull/2036)) - Victor Hermes
|
||||||
|
- Fixing spacing for README.md ([#2066](https://github.com/axios/axios/pull/2066)) - Josh McCarty
|
||||||
|
- Update README.md. - Change `.then` to `.finally` in example code ([#2090](https://github.com/axios/axios/pull/2090)) - Omar Cai
|
||||||
|
- Clarify what values responseType can have in Node ([#2121](https://github.com/axios/axios/pull/2121)) - Tyler Breisacher
|
||||||
|
- docs(ECOSYSTEM): add axios-api-versioning ([#2020](https://github.com/axios/axios/pull/2020)) - Weffe
|
||||||
|
- It seems that `responseType: 'blob'` doesn't actually work in Node (when I tried using it, response.data was a string, not a Blob, since Node doesn't have Blobs), so this clarifies that this option should only be used in the browser
|
||||||
|
- Update README.md. - Add Querystring library note ([#1896](https://github.com/axios/axios/pull/1896)) - Dmitriy Eroshenko
|
||||||
|
- Add react-hooks-axios to Libraries section of ECOSYSTEM.md ([#1925](https://github.com/axios/axios/pull/1925)) - Cody Chan
|
||||||
|
- Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer
|
||||||
|
|
||||||
|
### 0.19.0-beta.1 (Aug 9, 2018)
|
||||||
|
|
||||||
|
**NOTE:** This is a beta version of this release. There may be functionality that is broken in
|
||||||
|
certain browsers, though we suspect that builds are hanging and not erroring. See
|
||||||
|
https://saucelabs.com/u/axios for the most up-to-date information.
|
||||||
|
|
||||||
|
New Functionality:
|
||||||
|
|
||||||
|
- Add getUri method ([#1712](https://github.com/axios/axios/issues/1712))
|
||||||
|
- Add support for no_proxy env variable ([#1693](https://github.com/axios/axios/issues/1693))
|
||||||
|
- Add toJSON to decorated Axios errors to facilitate serialization ([#1625](https://github.com/axios/axios/issues/1625))
|
||||||
|
- Add second then on axios call ([#1623](https://github.com/axios/axios/issues/1623))
|
||||||
|
- Typings: allow custom return types
|
||||||
|
- Add option to specify character set in responses (with http adapter)
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
|
||||||
|
- Fix Keep defaults local to instance ([#385](https://github.com/axios/axios/issues/385))
|
||||||
|
- Correctly catch exception in http test ([#1475](https://github.com/axios/axios/issues/1475))
|
||||||
|
- Fix accept header normalization ([#1698](https://github.com/axios/axios/issues/1698))
|
||||||
|
- Fix http adapter to allow HTTPS connections via HTTP ([#959](https://github.com/axios/axios/issues/959))
|
||||||
|
- Fix Removes usage of deprecated Buffer constructor. ([#1555](https://github.com/axios/axios/issues/1555), [#1622](https://github.com/axios/axios/issues/1622))
|
||||||
|
- Fix defaults to use httpAdapter if available ([#1285](https://github.com/axios/axios/issues/1285))
|
||||||
|
- Fixing defaults to use httpAdapter if available
|
||||||
|
- Use a safer, cross-platform method to detect the Node environment
|
||||||
|
- Fix Reject promise if request is cancelled by the browser ([#537](https://github.com/axios/axios/issues/537))
|
||||||
|
- [Typescript] Fix missing type parameters on delete/head methods
|
||||||
|
- [NS]: Send `false` flag isStandardBrowserEnv for Nativescript
|
||||||
|
- Fix missing type parameters on delete/head
|
||||||
|
- Fix Default method for an instance always overwritten by get
|
||||||
|
- Fix type error when socketPath option in AxiosRequestConfig
|
||||||
|
- Capture errors on request data streams
|
||||||
|
- Decorate resolve and reject to clear timeout in all cases
|
||||||
|
|
||||||
|
Huge thanks to everyone who contributed to this release via code (authors listed
|
||||||
|
below) or via reviews and triaging on GitHub:
|
||||||
|
|
||||||
|
- Andrew Scott <ascott18@gmail.com>
|
||||||
|
- Anthony Gauthier <antho325@hotmail.com>
|
||||||
|
- arpit <arpit2438735@gmail.com>
|
||||||
|
- ascott18
|
||||||
|
- Benedikt Rötsch <axe312ger@users.noreply.github.com>
|
||||||
|
- Chance Dickson <me@chancedickson.com>
|
||||||
|
- Dave Stewart <info@davestewart.co.uk>
|
||||||
|
- Deric Cain <deric.cain@gmail.com>
|
||||||
|
- Guillaume Briday <guillaumebriday@gmail.com>
|
||||||
|
- Jacob Wejendorp <jacob@wejendorp.dk>
|
||||||
|
- Jim Lynch <mrdotjim@gmail.com>
|
||||||
|
- johntron
|
||||||
|
- Justin Beckwith <beckwith@google.com>
|
||||||
|
- Justin Beckwith <justin.beckwith@gmail.com>
|
||||||
|
- Khaled Garbaya <khaledgarbaya@gmail.com>
|
||||||
|
- Lim Jing Rong <jjingrong@users.noreply.github.com>
|
||||||
|
- Mark van den Broek <mvdnbrk@gmail.com>
|
||||||
|
- Martti Laine <martti@codeclown.net>
|
||||||
|
- mattridley
|
||||||
|
- mattridley <matt.r@joinblink.com>
|
||||||
|
- Nicolas Del Valle <nicolas.delvalle@gmail.com>
|
||||||
|
- Nilegfx
|
||||||
|
- pbarbiero
|
||||||
|
- Rikki Gibson <rikkigibson@gmail.com>
|
||||||
|
- Sako Hartounian <sakohartounian@yahoo.com>
|
||||||
|
- Shane Fitzpatrick <fitzpasd@gmail.com>
|
||||||
|
- Stephan Schneider <stephanschndr@gmail.com>
|
||||||
|
- Steven <steven@ceriously.com>
|
||||||
|
- Tim Garthwaite <tim.garthwaite@jibo.com>
|
||||||
|
- Tim Johns <timjohns@yahoo.com>
|
||||||
|
- Yutaro Miyazaki <yutaro@studio-rubbish.com>
|
||||||
|
|
||||||
|
### 0.18.0 (Feb 19, 2018)
|
||||||
|
|
||||||
|
- Adding support for UNIX Sockets when running with Node.js ([#1070](https://github.com/axios/axios/pull/1070))
|
||||||
|
- Fixing typings ([#1177](https://github.com/axios/axios/pull/1177)):
|
||||||
|
- AxiosRequestConfig.proxy: allows type false
|
||||||
|
- AxiosProxyConfig: added auth field
|
||||||
|
- Adding function signature in AxiosInstance interface so AxiosInstance can be invoked ([#1192](https://github.com/axios/axios/pull/1192), [#1254](https://github.com/axios/axios/pull/1254))
|
||||||
|
- Allowing maxContentLength to pass through to redirected calls as maxBodyLength in follow-redirects config ([#1287](https://github.com/axios/axios/pull/1287))
|
||||||
|
- Fixing configuration when using an instance - method can now be set ([#1342](https://github.com/axios/axios/pull/1342))
|
||||||
|
|
||||||
|
### 0.17.1 (Nov 11, 2017)
|
||||||
|
|
||||||
|
- Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160))
|
||||||
|
- Allowing overriding transport ([#1080](https://github.com/axios/axios/pull/1080))
|
||||||
|
- Updating TypeScript typings ([#1165](https://github.com/axios/axios/pull/1165), [#1125](https://github.com/axios/axios/pull/1125), [#1131](https://github.com/axios/axios/pull/1131))
|
||||||
|
|
||||||
|
### 0.17.0 (Oct 21, 2017)
|
||||||
|
|
||||||
|
- **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950))
|
||||||
|
- **BREAKING** Improving handing of duplicate headers ([#874](https://github.com/axios/axios/pull/874))
|
||||||
|
- Adding support for disabling proxies ([#691](https://github.com/axios/axios/pull/691))
|
||||||
|
- Updating TypeScript typings with generic type parameters ([#1061](https://github.com/axios/axios/pull/1061))
|
||||||
|
|
||||||
|
### 0.16.2 (Jun 3, 2017)
|
||||||
|
|
||||||
|
- Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887))
|
||||||
|
- Including underlying request in errors ([#830](https://github.com/axios/axios/pull/830))
|
||||||
|
- Convert `method` to lowercase ([#930](https://github.com/axios/axios/pull/930))
|
||||||
|
|
||||||
|
### 0.16.1 (Apr 8, 2017)
|
||||||
|
|
||||||
|
- Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828))
|
||||||
|
- Updating `follow-redirects` dependency ([#829](https://github.com/axios/axios/pull/829))
|
||||||
|
- Adding support for passing `Buffer` in node ([#773](https://github.com/axios/axios/pull/773))
|
||||||
|
|
||||||
|
### 0.16.0 (Mar 31, 2017)
|
||||||
|
|
||||||
|
- **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480))
|
||||||
|
- Adding `options` shortcut method ([#461](https://github.com/axios/axios/pull/461))
|
||||||
|
- Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/axios/axios/pull/654))
|
||||||
|
- Improving React Native detection ([#731](https://github.com/axios/axios/pull/731))
|
||||||
|
- Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/axios/axios/pull/581))
|
||||||
|
- Removing `PROTECTION_PREFIX` support ([#561](https://github.com/axios/axios/pull/561))
|
||||||
|
|
||||||
|
### 0.15.3 (Nov 27, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443))
|
||||||
|
- Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/axios/axios/issues/519))
|
||||||
|
- Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/axios/axios/issues/509))
|
||||||
|
- Fixing issue with `btoa` and IE ([#507](https://github.com/axios/axios/issues/507))
|
||||||
|
- Adding support for proxy authentication ([#483](https://github.com/axios/axios/pull/483))
|
||||||
|
- Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/axios/axios/pull/493))
|
||||||
|
- Fixing proxy issues ([#491](https://github.com/axios/axios/pull/491))
|
||||||
|
|
||||||
|
### 0.15.2 (Oct 17, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/axios/axios/issues/482))
|
||||||
|
|
||||||
|
### 0.15.1 (Oct 14, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485))
|
||||||
|
|
||||||
|
### 0.15.0 (Oct 10, 2016)
|
||||||
|
|
||||||
|
- Adding cancellation support ([#452](https://github.com/axios/axios/pull/452))
|
||||||
|
- Moving default adapter to global defaults ([#437](https://github.com/axios/axios/pull/437))
|
||||||
|
- Fixing issue with `file` URI scheme ([#440](https://github.com/axios/axios/pull/440))
|
||||||
|
- Fixing issue with `params` objects that have no prototype ([#445](https://github.com/axios/axios/pull/445))
|
||||||
|
|
||||||
|
### 0.14.0 (Aug 27, 2016)
|
||||||
|
|
||||||
|
- **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419))
|
||||||
|
- **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/axios/axios/pull/387))
|
||||||
|
- **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/axios/axios/pull/423))
|
||||||
|
- Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/axios/axios/pull/366))
|
||||||
|
- Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/axios/axios/pull/397))
|
||||||
|
- Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/axios/axios/pull/406))
|
||||||
|
|
||||||
|
### 0.13.1 (Jul 16, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with response data not being transformed on error ([#378](https://github.com/axios/axios/issues/378))
|
||||||
|
|
||||||
|
### 0.13.0 (Jul 13, 2016)
|
||||||
|
|
||||||
|
- **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345))
|
||||||
|
- **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e))
|
||||||
|
- **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a))
|
||||||
|
- Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/axios/axios/issues/343))
|
||||||
|
- Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/axios/axios/issues/352))
|
||||||
|
- Fixing custom instance defaults ([#341](https://github.com/axios/axios/issues/341))
|
||||||
|
- Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/axios/axios/issues/217))
|
||||||
|
|
||||||
|
### 0.12.0 (May 31, 2016)
|
||||||
|
|
||||||
|
- Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317))
|
||||||
|
- Adding `maxRedirects` option ([#307](https://github.com/axios/axios/pull/307))
|
||||||
|
|
||||||
|
### 0.11.1 (May 17, 2016)
|
||||||
|
|
||||||
|
- Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313))
|
||||||
|
- Fixing detection of `FormData` ([#325](https://github.com/axios/axios/pull/325))
|
||||||
|
- Adding `Axios` class to exports ([#321](https://github.com/axios/axios/pull/321))
|
||||||
|
|
||||||
|
### 0.11.0 (Apr 26, 2016)
|
||||||
|
|
||||||
|
- Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296))
|
||||||
|
- Adding support for custom HTTP status code error ranges ([#308](https://github.com/axios/axios/pull/308))
|
||||||
|
- Fixing issue with ArrayBuffer ([#299](https://github.com/axios/axios/pull/299))
|
||||||
|
|
||||||
|
### 0.10.0 (Apr 20, 2016)
|
||||||
|
|
||||||
|
- Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250))
|
||||||
|
- Fixing basic auth for HTTP adapter ([#252](https://github.com/axios/axios/pull/252))
|
||||||
|
- Fixing request timeout for XHR adapter ([#227](https://github.com/axios/axios/pull/227))
|
||||||
|
- Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/axios/axios/pull/249))
|
||||||
|
- Fixing IE9 cross domain requests ([#251](https://github.com/axios/axios/pull/251))
|
||||||
|
- Adding `maxContentLength` option ([#275](https://github.com/axios/axios/pull/275))
|
||||||
|
- Fixing XHR support for WebWorker environment ([#279](https://github.com/axios/axios/pull/279))
|
||||||
|
- Adding request instance to response ([#200](https://github.com/axios/axios/pull/200))
|
||||||
|
|
||||||
|
### 0.9.1 (Jan 24, 2016)
|
||||||
|
|
||||||
|
- Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124))
|
||||||
|
- Fixing network errors not rejecting ([#205](https://github.com/axios/axios/pull/205))
|
||||||
|
- Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/axios/axios/issues/201))
|
||||||
|
- Fixing host/port when following redirects ([#198](https://github.com/axios/axios/pull/198))
|
||||||
|
|
||||||
|
### 0.9.0 (Jan 18, 2016)
|
||||||
|
|
||||||
|
- Adding support for custom adapters
|
||||||
|
- Fixing Content-Type header being removed when data is false ([#195](https://github.com/axios/axios/pull/195))
|
||||||
|
- Improving XDomainRequest implementation ([#185](https://github.com/axios/axios/pull/185))
|
||||||
|
- Improving config merging and order of precedence ([#183](https://github.com/axios/axios/pull/183))
|
||||||
|
- Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/axios/axios/pull/182))
|
||||||
|
|
||||||
|
### 0.8.1 (Dec 14, 2015)
|
||||||
|
|
||||||
|
- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168))
|
||||||
|
- Fixing error with format of basic auth header ([#178](https://github.com/axios/axios/pull/173))
|
||||||
|
- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/axios/axios/pull/174))
|
||||||
|
|
||||||
|
### 0.8.0 (Dec 11, 2015)
|
||||||
|
|
||||||
|
- Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123))
|
||||||
|
- Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/axios/axios/pull/128))
|
||||||
|
- Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/axios/axios/pull/121))
|
||||||
|
- Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/axios/axios/pull/127))
|
||||||
|
- Adding support for following redirects in node ([#146](https://github.com/axios/axios/pull/146))
|
||||||
|
- Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/axios/axios/pull/149))
|
||||||
|
- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/axios/axios/pull/140))
|
||||||
|
- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/axios/axios/pull/167))
|
||||||
|
- Adding support for baseURL option ([#160](https://github.com/axios/axios/pull/160))
|
||||||
|
|
||||||
|
### 0.7.0 (Sep 29, 2015)
|
||||||
|
|
||||||
|
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87))
|
||||||
|
- Adding support for passing agent in node ([#102](https://github.com/axios/axios/pull/102))
|
||||||
|
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/axios/axios/pull/106))
|
||||||
|
- Fixing typescript definition ([#105](https://github.com/axios/axios/pull/105))
|
||||||
|
- Fixing default timeout config for node ([#112](https://github.com/axios/axios/pull/112))
|
||||||
|
- Adding support for use in web workers, and react-native ([#70](https://github.com/axios/axios/issue/70)), ([#98](https://github.com/axios/axios/pull/98))
|
||||||
|
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/axios/axios/issues/116))
|
||||||
|
|
||||||
|
### 0.6.0 (Sep 21, 2015)
|
||||||
|
|
||||||
|
- Removing deprecated success/error aliases
|
||||||
|
- Fixing issue with array params not being properly encoded ([#49](https://github.com/axios/axios/pull/49))
|
||||||
|
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/axios/axios/issues/69))
|
||||||
|
- Adding support for timeout config ([#56](https://github.com/axios/axios/issues/56))
|
||||||
|
- Removing es6-promise dependency
|
||||||
|
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/axios/axios/pull/91))
|
||||||
|
- Fixing issue with IE8 ([#85](https://github.com/axios/axios/pull/85))
|
||||||
|
- Converting build to UMD
|
||||||
|
|
||||||
|
### 0.5.4 (Apr 08, 2015)
|
||||||
|
|
||||||
|
- Fixing issue with FormData not being sent ([#53](https://github.com/axios/axios/issues/53))
|
||||||
|
|
||||||
|
### 0.5.3 (Apr 07, 2015)
|
||||||
|
|
||||||
|
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55))
|
||||||
|
|
||||||
|
### 0.5.2 (Mar 13, 2015)
|
||||||
|
|
||||||
|
- Adding support for `statusText` in response ([#46](https://github.com/axios/axios/issues/46))
|
||||||
|
|
||||||
|
### 0.5.1 (Mar 10, 2015)
|
||||||
|
|
||||||
|
- Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45))
|
||||||
|
- Fixing issue with standalone build ([#47](https://github.com/axios/axios/issues/47))
|
||||||
|
|
||||||
|
### 0.5.0 (Jan 23, 2015)
|
||||||
|
|
||||||
|
- Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14))
|
||||||
|
- Updating es6-promise dependency
|
||||||
|
|
||||||
|
### 0.4.2 (Dec 10, 2014)
|
||||||
|
|
||||||
|
- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22))
|
||||||
|
- Adding support for TypeScript ([#25](https://github.com/axios/axios/issues/25))
|
||||||
|
- Fixing issue with standalone build ([#29](https://github.com/axios/axios/issues/29))
|
||||||
|
- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/axios/axios/issues/30))
|
||||||
|
|
||||||
|
### 0.4.1 (Oct 15, 2014)
|
||||||
|
|
||||||
|
- Adding error handling to request for node.js ([#18](https://github.com/axios/axios/issues/18))
|
||||||
|
|
||||||
|
### 0.4.0 (Oct 03, 2014)
|
||||||
|
|
||||||
|
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10))
|
||||||
|
- Adding support for utf-8 for node.js ([#13](https://github.com/axios/axios/issues/13))
|
||||||
|
- Adding support for SSL for node.js ([#12](https://github.com/axios/axios/issues/12))
|
||||||
|
- Fixing incorrect `Content-Type` header ([#9](https://github.com/axios/axios/issues/9))
|
||||||
|
- Adding standalone build without bundled es6-promise ([#11](https://github.com/axios/axios/issues/11))
|
||||||
|
- Deprecating `success`/`error` in favor of `then`/`catch`
|
||||||
|
|
||||||
|
### 0.3.1 (Sep 16, 2014)
|
||||||
|
|
||||||
|
- Fixing missing post body when using node.js ([#3](https://github.com/axios/axios/issues/3))
|
||||||
|
|
||||||
|
### 0.3.0 (Sep 16, 2014)
|
||||||
|
|
||||||
|
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8))
|
||||||
|
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/axios/axios/issues/6))
|
||||||
|
- Fixing issue with `all` not working ([#7](https://github.com/axios/axios/issues/7))
|
||||||
|
|
||||||
|
### 0.2.2 (Sep 14, 2014)
|
||||||
|
|
||||||
|
- Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4))
|
||||||
|
|
||||||
|
### 0.2.1 (Sep 12, 2014)
|
||||||
|
|
||||||
|
- Fixing build problem causing ridiculous file sizes
|
||||||
|
|
||||||
|
### 0.2.0 (Sep 12, 2014)
|
||||||
|
|
||||||
|
- Adding support for `all` and `spread`
|
||||||
|
- Adding support for node.js ([#1](https://github.com/axios/axios/issues/1))
|
||||||
|
|
||||||
|
### 0.1.0 (Aug 29, 2014)
|
||||||
|
|
||||||
|
- Initial release
|
19
node_modules/axios/LICENSE
generated
vendored
Normal file
19
node_modules/axios/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2014-present Matt Zabriskie
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
800
node_modules/axios/README.md
generated
vendored
Executable file
800
node_modules/axios/README.md
generated
vendored
Executable file
|
@ -0,0 +1,800 @@
|
||||||
|
# axios
|
||||||
|
|
||||||
|
[![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
|
||||||
|
[![CDNJS](https://img.shields.io/cdnjs/v/axios.svg?style=flat-square)](https://cdnjs.com/libraries/axios)
|
||||||
|
[![build status](https://img.shields.io/travis/axios/axios/master.svg?style=flat-square)](https://travis-ci.org/axios/axios)
|
||||||
|
[![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
|
||||||
|
[![install size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios)
|
||||||
|
[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](http://npm-stat.com/charts.html?package=axios)
|
||||||
|
[![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
|
||||||
|
[![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
|
||||||
|
|
||||||
|
Promise based HTTP client for the browser and node.js
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
- [Features](#features)
|
||||||
|
- [Browser Support](#browser-support)
|
||||||
|
- [Installing](#installing)
|
||||||
|
- [Example](#example)
|
||||||
|
- [Axios API](#axios-api)
|
||||||
|
- [Request method aliases](#request-method-aliases)
|
||||||
|
- [Concurrency (Deprecated)](#concurrency-deprecated)
|
||||||
|
- [Creating an instance](#creating-an-instance)
|
||||||
|
- [Instance methods](#instance-methods)
|
||||||
|
- [Request Config](#request-config)
|
||||||
|
- [Response Schema](#response-schema)
|
||||||
|
- [Config Defaults](#config-defaults)
|
||||||
|
- [Global axios defaults](#global-axios-defaults)
|
||||||
|
- [Custom instance defaults](#custom-instance-defaults)
|
||||||
|
- [Config order of precedence](#config-order-of-precedence)
|
||||||
|
- [Interceptors](#interceptors)
|
||||||
|
- [Handling Errors](#handling-errors)
|
||||||
|
- [Cancellation](#cancellation)
|
||||||
|
- [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
|
||||||
|
- [Browser](#browser)
|
||||||
|
- [Node.js](#nodejs)
|
||||||
|
- [Query string](#query-string)
|
||||||
|
- [Form data](#form-data)
|
||||||
|
- [Semver](#semver)
|
||||||
|
- [Promises](#promises)
|
||||||
|
- [TypeScript](#typescript)
|
||||||
|
- [Resources](#resources)
|
||||||
|
- [Credits](#credits)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser
|
||||||
|
- Make [http](http://nodejs.org/api/http.html) requests from node.js
|
||||||
|
- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API
|
||||||
|
- Intercept request and response
|
||||||
|
- Transform request and response data
|
||||||
|
- Cancel requests
|
||||||
|
- Automatic transforms for JSON data
|
||||||
|
- Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
|
||||||
|
|
||||||
|
## Browser Support
|
||||||
|
|
||||||
|
![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
|
||||||
|
--- | --- | --- | --- | --- | --- |
|
||||||
|
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
|
||||||
|
|
||||||
|
[![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install axios
|
||||||
|
```
|
||||||
|
|
||||||
|
Using bower:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ bower install axios
|
||||||
|
```
|
||||||
|
|
||||||
|
Using yarn:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ yarn add axios
|
||||||
|
```
|
||||||
|
|
||||||
|
Using jsDelivr CDN:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
Using unpkg CDN:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
### note: CommonJS usage
|
||||||
|
In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()` use the following approach:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const axios = require('axios').default;
|
||||||
|
|
||||||
|
// axios.<method> will now provide autocomplete and parameter typings
|
||||||
|
```
|
||||||
|
|
||||||
|
Performing a `GET` request
|
||||||
|
|
||||||
|
```js
|
||||||
|
const axios = require('axios');
|
||||||
|
|
||||||
|
// Make a request for a user with a given ID
|
||||||
|
axios.get('/user?ID=12345')
|
||||||
|
.then(function (response) {
|
||||||
|
// handle success
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
// handle error
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
// always executed
|
||||||
|
});
|
||||||
|
|
||||||
|
// Optionally the request above could also be done as
|
||||||
|
axios.get('/user', {
|
||||||
|
params: {
|
||||||
|
ID: 12345
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
// always executed
|
||||||
|
});
|
||||||
|
|
||||||
|
// Want to use async/await? Add the `async` keyword to your outer function/method.
|
||||||
|
async function getUser() {
|
||||||
|
try {
|
||||||
|
const response = await axios.get('/user?ID=12345');
|
||||||
|
console.log(response);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> **NOTE:** `async/await` is part of ECMAScript 2017 and is not supported in Internet
|
||||||
|
> Explorer and older browsers, so use with caution.
|
||||||
|
|
||||||
|
Performing a `POST` request
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.post('/user', {
|
||||||
|
firstName: 'Fred',
|
||||||
|
lastName: 'Flintstone'
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Performing multiple concurrent requests
|
||||||
|
|
||||||
|
```js
|
||||||
|
function getUserAccount() {
|
||||||
|
return axios.get('/user/12345');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUserPermissions() {
|
||||||
|
return axios.get('/user/12345/permissions');
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.all([getUserAccount(), getUserPermissions()])
|
||||||
|
.then(function (results) {
|
||||||
|
const acct = results[0];
|
||||||
|
const perm = results[1];
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## axios API
|
||||||
|
|
||||||
|
Requests can be made by passing the relevant config to `axios`.
|
||||||
|
|
||||||
|
##### axios(config)
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Send a POST request
|
||||||
|
axios({
|
||||||
|
method: 'post',
|
||||||
|
url: '/user/12345',
|
||||||
|
data: {
|
||||||
|
firstName: 'Fred',
|
||||||
|
lastName: 'Flintstone'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// GET request for remote image in node.js
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: 'http://bit.ly/2mTM3nY',
|
||||||
|
responseType: 'stream'
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
##### axios(url[, config])
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Send a GET request (default method)
|
||||||
|
axios('/user/12345');
|
||||||
|
```
|
||||||
|
|
||||||
|
### Request method aliases
|
||||||
|
|
||||||
|
For convenience aliases have been provided for all supported request methods.
|
||||||
|
|
||||||
|
##### axios.request(config)
|
||||||
|
##### axios.get(url[, config])
|
||||||
|
##### axios.delete(url[, config])
|
||||||
|
##### axios.head(url[, config])
|
||||||
|
##### axios.options(url[, config])
|
||||||
|
##### axios.post(url[, data[, config]])
|
||||||
|
##### axios.put(url[, data[, config]])
|
||||||
|
##### axios.patch(url[, data[, config]])
|
||||||
|
|
||||||
|
###### NOTE
|
||||||
|
When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
|
||||||
|
|
||||||
|
### Concurrency (Deprecated)
|
||||||
|
Please use `Promise.all` to replace the below functions.
|
||||||
|
|
||||||
|
Helper functions for dealing with concurrent requests.
|
||||||
|
|
||||||
|
axios.all(iterable)
|
||||||
|
axios.spread(callback)
|
||||||
|
|
||||||
|
### Creating an instance
|
||||||
|
|
||||||
|
You can create a new instance of axios with a custom config.
|
||||||
|
|
||||||
|
##### axios.create([config])
|
||||||
|
|
||||||
|
```js
|
||||||
|
const instance = axios.create({
|
||||||
|
baseURL: 'https://some-domain.com/api/',
|
||||||
|
timeout: 1000,
|
||||||
|
headers: {'X-Custom-Header': 'foobar'}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Instance methods
|
||||||
|
|
||||||
|
The available instance methods are listed below. The specified config will be merged with the instance config.
|
||||||
|
|
||||||
|
##### axios#request(config)
|
||||||
|
##### axios#get(url[, config])
|
||||||
|
##### axios#delete(url[, config])
|
||||||
|
##### axios#head(url[, config])
|
||||||
|
##### axios#options(url[, config])
|
||||||
|
##### axios#post(url[, data[, config]])
|
||||||
|
##### axios#put(url[, data[, config]])
|
||||||
|
##### axios#patch(url[, data[, config]])
|
||||||
|
##### axios#getUri([config])
|
||||||
|
|
||||||
|
## Request Config
|
||||||
|
|
||||||
|
These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// `url` is the server URL that will be used for the request
|
||||||
|
url: '/user',
|
||||||
|
|
||||||
|
// `method` is the request method to be used when making the request
|
||||||
|
method: 'get', // default
|
||||||
|
|
||||||
|
// `baseURL` will be prepended to `url` unless `url` is absolute.
|
||||||
|
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
|
||||||
|
// to methods of that instance.
|
||||||
|
baseURL: 'https://some-domain.com/api/',
|
||||||
|
|
||||||
|
// `transformRequest` allows changes to the request data before it is sent to the server
|
||||||
|
// This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
|
||||||
|
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
|
||||||
|
// FormData or Stream
|
||||||
|
// You may modify the headers object.
|
||||||
|
transformRequest: [function (data, headers) {
|
||||||
|
// Do whatever you want to transform the data
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
// `transformResponse` allows changes to the response data to be made before
|
||||||
|
// it is passed to then/catch
|
||||||
|
transformResponse: [function (data) {
|
||||||
|
// Do whatever you want to transform the data
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
// `headers` are custom headers to be sent
|
||||||
|
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||||
|
|
||||||
|
// `params` are the URL parameters to be sent with the request
|
||||||
|
// Must be a plain object or a URLSearchParams object
|
||||||
|
params: {
|
||||||
|
ID: 12345
|
||||||
|
},
|
||||||
|
|
||||||
|
// `paramsSerializer` is an optional function in charge of serializing `params`
|
||||||
|
// (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
|
||||||
|
paramsSerializer: function (params) {
|
||||||
|
return Qs.stringify(params, {arrayFormat: 'brackets'})
|
||||||
|
},
|
||||||
|
|
||||||
|
// `data` is the data to be sent as the request body
|
||||||
|
// Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH'
|
||||||
|
// When no `transformRequest` is set, must be of one of the following types:
|
||||||
|
// - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
|
||||||
|
// - Browser only: FormData, File, Blob
|
||||||
|
// - Node only: Stream, Buffer
|
||||||
|
data: {
|
||||||
|
firstName: 'Fred'
|
||||||
|
},
|
||||||
|
|
||||||
|
// syntax alternative to send data into the body
|
||||||
|
// method post
|
||||||
|
// only the value is sent, not the key
|
||||||
|
data: 'Country=Brasil&City=Belo Horizonte',
|
||||||
|
|
||||||
|
// `timeout` specifies the number of milliseconds before the request times out.
|
||||||
|
// If the request takes longer than `timeout`, the request will be aborted.
|
||||||
|
timeout: 1000, // default is `0` (no timeout)
|
||||||
|
|
||||||
|
// `withCredentials` indicates whether or not cross-site Access-Control requests
|
||||||
|
// should be made using credentials
|
||||||
|
withCredentials: false, // default
|
||||||
|
|
||||||
|
// `adapter` allows custom handling of requests which makes testing easier.
|
||||||
|
// Return a promise and supply a valid response (see lib/adapters/README.md).
|
||||||
|
adapter: function (config) {
|
||||||
|
/* ... */
|
||||||
|
},
|
||||||
|
|
||||||
|
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
|
||||||
|
// This will set an `Authorization` header, overwriting any existing
|
||||||
|
// `Authorization` custom headers you have set using `headers`.
|
||||||
|
// Please note that only HTTP Basic auth is configurable through this parameter.
|
||||||
|
// For Bearer tokens and such, use `Authorization` custom headers instead.
|
||||||
|
auth: {
|
||||||
|
username: 'janedoe',
|
||||||
|
password: 's00pers3cret'
|
||||||
|
},
|
||||||
|
|
||||||
|
// `responseType` indicates the type of data that the server will respond with
|
||||||
|
// options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
|
||||||
|
// browser only: 'blob'
|
||||||
|
responseType: 'json', // default
|
||||||
|
|
||||||
|
// `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
|
||||||
|
// Note: Ignored for `responseType` of 'stream' or client-side requests
|
||||||
|
responseEncoding: 'utf8', // default
|
||||||
|
|
||||||
|
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
|
||||||
|
xsrfCookieName: 'XSRF-TOKEN', // default
|
||||||
|
|
||||||
|
// `xsrfHeaderName` is the name of the http header that carries the xsrf token value
|
||||||
|
xsrfHeaderName: 'X-XSRF-TOKEN', // default
|
||||||
|
|
||||||
|
// `onUploadProgress` allows handling of progress events for uploads
|
||||||
|
// browser only
|
||||||
|
onUploadProgress: function (progressEvent) {
|
||||||
|
// Do whatever you want with the native progress event
|
||||||
|
},
|
||||||
|
|
||||||
|
// `onDownloadProgress` allows handling of progress events for downloads
|
||||||
|
// browser only
|
||||||
|
onDownloadProgress: function (progressEvent) {
|
||||||
|
// Do whatever you want with the native progress event
|
||||||
|
},
|
||||||
|
|
||||||
|
// `maxContentLength` defines the max size of the http response content in bytes allowed in node.js
|
||||||
|
maxContentLength: 2000,
|
||||||
|
|
||||||
|
// `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed
|
||||||
|
maxBodyLength: 2000,
|
||||||
|
|
||||||
|
// `validateStatus` defines whether to resolve or reject the promise for a given
|
||||||
|
// HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
|
||||||
|
// or `undefined`), the promise will be resolved; otherwise, the promise will be
|
||||||
|
// rejected.
|
||||||
|
validateStatus: function (status) {
|
||||||
|
return status >= 200 && status < 300; // default
|
||||||
|
},
|
||||||
|
|
||||||
|
// `maxRedirects` defines the maximum number of redirects to follow in node.js.
|
||||||
|
// If set to 0, no redirects will be followed.
|
||||||
|
maxRedirects: 5, // default
|
||||||
|
|
||||||
|
// `socketPath` defines a UNIX Socket to be used in node.js.
|
||||||
|
// e.g. '/var/run/docker.sock' to send requests to the docker daemon.
|
||||||
|
// Only either `socketPath` or `proxy` can be specified.
|
||||||
|
// If both are specified, `socketPath` is used.
|
||||||
|
socketPath: null, // default
|
||||||
|
|
||||||
|
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
|
||||||
|
// and https requests, respectively, in node.js. This allows options to be added like
|
||||||
|
// `keepAlive` that are not enabled by default.
|
||||||
|
httpAgent: new http.Agent({ keepAlive: true }),
|
||||||
|
httpsAgent: new https.Agent({ keepAlive: true }),
|
||||||
|
|
||||||
|
// `proxy` defines the hostname, port, and protocol of the proxy server.
|
||||||
|
// You can also define your proxy using the conventional `http_proxy` and
|
||||||
|
// `https_proxy` environment variables. If you are using environment variables
|
||||||
|
// for your proxy configuration, you can also define a `no_proxy` environment
|
||||||
|
// variable as a comma-separated list of domains that should not be proxied.
|
||||||
|
// Use `false` to disable proxies, ignoring environment variables.
|
||||||
|
// `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
|
||||||
|
// supplies credentials.
|
||||||
|
// This will set an `Proxy-Authorization` header, overwriting any existing
|
||||||
|
// `Proxy-Authorization` custom headers you have set using `headers`.
|
||||||
|
// If the proxy server uses HTTPS, then you must set the protocol to `https`.
|
||||||
|
proxy: {
|
||||||
|
protocol: 'https',
|
||||||
|
host: '127.0.0.1',
|
||||||
|
port: 9000,
|
||||||
|
auth: {
|
||||||
|
username: 'mikeymike',
|
||||||
|
password: 'rapunz3l'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// `cancelToken` specifies a cancel token that can be used to cancel the request
|
||||||
|
// (see Cancellation section below for details)
|
||||||
|
cancelToken: new CancelToken(function (cancel) {
|
||||||
|
}),
|
||||||
|
|
||||||
|
// `decompress` indicates whether or not the response body should be decompressed
|
||||||
|
// automatically. If set to `true` will also remove the 'content-encoding' header
|
||||||
|
// from the responses objects of all decompressed responses
|
||||||
|
// - Node only (XHR cannot turn off decompression)
|
||||||
|
decompress: true // default
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Response Schema
|
||||||
|
|
||||||
|
The response for a request contains the following information.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// `data` is the response that was provided by the server
|
||||||
|
data: {},
|
||||||
|
|
||||||
|
// `status` is the HTTP status code from the server response
|
||||||
|
status: 200,
|
||||||
|
|
||||||
|
// `statusText` is the HTTP status message from the server response
|
||||||
|
statusText: 'OK',
|
||||||
|
|
||||||
|
// `headers` the HTTP headers that the server responded with
|
||||||
|
// All header names are lower cased and can be accessed using the bracket notation.
|
||||||
|
// Example: `response.headers['content-type']`
|
||||||
|
headers: {},
|
||||||
|
|
||||||
|
// `config` is the config that was provided to `axios` for the request
|
||||||
|
config: {},
|
||||||
|
|
||||||
|
// `request` is the request that generated this response
|
||||||
|
// It is the last ClientRequest instance in node.js (in redirects)
|
||||||
|
// and an XMLHttpRequest instance in the browser
|
||||||
|
request: {}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
When using `then`, you will receive the response as follows:
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('/user/12345')
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
console.log(response.status);
|
||||||
|
console.log(response.statusText);
|
||||||
|
console.log(response.headers);
|
||||||
|
console.log(response.config);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
|
||||||
|
|
||||||
|
## Config Defaults
|
||||||
|
|
||||||
|
You can specify config defaults that will be applied to every request.
|
||||||
|
|
||||||
|
### Global axios defaults
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.defaults.baseURL = 'https://api.example.com';
|
||||||
|
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
||||||
|
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||||
|
```
|
||||||
|
|
||||||
|
### Custom instance defaults
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Set config defaults when creating the instance
|
||||||
|
const instance = axios.create({
|
||||||
|
baseURL: 'https://api.example.com'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Alter defaults after instance has been created
|
||||||
|
instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Config order of precedence
|
||||||
|
|
||||||
|
Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Create an instance using the config defaults provided by the library
|
||||||
|
// At this point the timeout config value is `0` as is the default for the library
|
||||||
|
const instance = axios.create();
|
||||||
|
|
||||||
|
// Override timeout default for the library
|
||||||
|
// Now all requests using this instance will wait 2.5 seconds before timing out
|
||||||
|
instance.defaults.timeout = 2500;
|
||||||
|
|
||||||
|
// Override timeout for this request as it's known to take a long time
|
||||||
|
instance.get('/longRequest', {
|
||||||
|
timeout: 5000
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Interceptors
|
||||||
|
|
||||||
|
You can intercept requests or responses before they are handled by `then` or `catch`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Add a request interceptor
|
||||||
|
axios.interceptors.request.use(function (config) {
|
||||||
|
// Do something before request is sent
|
||||||
|
return config;
|
||||||
|
}, function (error) {
|
||||||
|
// Do something with request error
|
||||||
|
return Promise.reject(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add a response interceptor
|
||||||
|
axios.interceptors.response.use(function (response) {
|
||||||
|
// Any status code that lie within the range of 2xx cause this function to trigger
|
||||||
|
// Do something with response data
|
||||||
|
return response;
|
||||||
|
}, function (error) {
|
||||||
|
// Any status codes that falls outside the range of 2xx cause this function to trigger
|
||||||
|
// Do something with response error
|
||||||
|
return Promise.reject(error);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
If you need to remove an interceptor later you can.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
|
||||||
|
axios.interceptors.request.eject(myInterceptor);
|
||||||
|
```
|
||||||
|
|
||||||
|
You can add interceptors to a custom instance of axios.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const instance = axios.create();
|
||||||
|
instance.interceptors.request.use(function () {/*...*/});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Handling Errors
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('/user/12345')
|
||||||
|
.catch(function (error) {
|
||||||
|
if (error.response) {
|
||||||
|
// The request was made and the server responded with a status code
|
||||||
|
// that falls out of the range of 2xx
|
||||||
|
console.log(error.response.data);
|
||||||
|
console.log(error.response.status);
|
||||||
|
console.log(error.response.headers);
|
||||||
|
} else if (error.request) {
|
||||||
|
// The request was made but no response was received
|
||||||
|
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
||||||
|
// http.ClientRequest in node.js
|
||||||
|
console.log(error.request);
|
||||||
|
} else {
|
||||||
|
// Something happened in setting up the request that triggered an Error
|
||||||
|
console.log('Error', error.message);
|
||||||
|
}
|
||||||
|
console.log(error.config);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Using the `validateStatus` config option, you can define HTTP code(s) that should throw an error.
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('/user/12345', {
|
||||||
|
validateStatus: function (status) {
|
||||||
|
return status < 500; // Resolve only if the status code is less than 500
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Using `toJSON` you get an object with more information about the HTTP error.
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('/user/12345')
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error.toJSON());
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cancellation
|
||||||
|
|
||||||
|
You can cancel a request using a *cancel token*.
|
||||||
|
|
||||||
|
> The axios cancel token API is based on the withdrawn [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
|
||||||
|
|
||||||
|
You can create a cancel token using the `CancelToken.source` factory as shown below:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const CancelToken = axios.CancelToken;
|
||||||
|
const source = CancelToken.source();
|
||||||
|
|
||||||
|
axios.get('/user/12345', {
|
||||||
|
cancelToken: source.token
|
||||||
|
}).catch(function (thrown) {
|
||||||
|
if (axios.isCancel(thrown)) {
|
||||||
|
console.log('Request canceled', thrown.message);
|
||||||
|
} else {
|
||||||
|
// handle error
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
axios.post('/user/12345', {
|
||||||
|
name: 'new name'
|
||||||
|
}, {
|
||||||
|
cancelToken: source.token
|
||||||
|
})
|
||||||
|
|
||||||
|
// cancel the request (the message parameter is optional)
|
||||||
|
source.cancel('Operation canceled by the user.');
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const CancelToken = axios.CancelToken;
|
||||||
|
let cancel;
|
||||||
|
|
||||||
|
axios.get('/user/12345', {
|
||||||
|
cancelToken: new CancelToken(function executor(c) {
|
||||||
|
// An executor function receives a cancel function as a parameter
|
||||||
|
cancel = c;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// cancel the request
|
||||||
|
cancel();
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note: you can cancel several requests with the same cancel token.
|
||||||
|
|
||||||
|
## Using application/x-www-form-urlencoded format
|
||||||
|
|
||||||
|
By default, axios serializes JavaScript objects to `JSON`. To send data in the `application/x-www-form-urlencoded` format instead, you can use one of the following options.
|
||||||
|
|
||||||
|
### Browser
|
||||||
|
|
||||||
|
In a browser, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API as follows:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
params.append('param1', 'value1');
|
||||||
|
params.append('param2', 'value2');
|
||||||
|
axios.post('/foo', params);
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note that `URLSearchParams` is not supported by all browsers (see [caniuse.com](http://www.caniuse.com/#feat=urlsearchparams)), but there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
|
||||||
|
|
||||||
|
Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const qs = require('qs');
|
||||||
|
axios.post('/foo', qs.stringify({ 'bar': 123 }));
|
||||||
|
```
|
||||||
|
|
||||||
|
Or in another way (ES6),
|
||||||
|
|
||||||
|
```js
|
||||||
|
import qs from 'qs';
|
||||||
|
const data = { 'bar': 123 };
|
||||||
|
const options = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||||
|
data: qs.stringify(data),
|
||||||
|
url,
|
||||||
|
};
|
||||||
|
axios(options);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Node.js
|
||||||
|
|
||||||
|
#### Query string
|
||||||
|
|
||||||
|
In node.js, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const querystring = require('querystring');
|
||||||
|
axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
|
||||||
|
```
|
||||||
|
|
||||||
|
or ['URLSearchParams'](https://nodejs.org/api/url.html#url_class_urlsearchparams) from ['url module'](https://nodejs.org/api/url.html) as follows:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const url = require('url');
|
||||||
|
const params = new url.URLSearchParams({ foo: 'bar' });
|
||||||
|
axios.post('http://something.com/', params.toString());
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use the [`qs`](https://github.com/ljharb/qs) library.
|
||||||
|
|
||||||
|
###### NOTE
|
||||||
|
The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has known issues with that use case (https://github.com/nodejs/node-v0.x-archive/issues/1665).
|
||||||
|
|
||||||
|
#### Form data
|
||||||
|
|
||||||
|
In node.js, you can use the [`form-data`](https://github.com/form-data/form-data) library as follows:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const FormData = require('form-data');
|
||||||
|
|
||||||
|
const form = new FormData();
|
||||||
|
form.append('my_field', 'my value');
|
||||||
|
form.append('my_buffer', new Buffer(10));
|
||||||
|
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
|
||||||
|
|
||||||
|
axios.post('https://example.com', form, { headers: form.getHeaders() })
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, use an interceptor:
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.interceptors.request.use(config => {
|
||||||
|
if (config.data instanceof FormData) {
|
||||||
|
Object.assign(config.headers, config.data.getHeaders());
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Semver
|
||||||
|
|
||||||
|
Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes.
|
||||||
|
|
||||||
|
## Promises
|
||||||
|
|
||||||
|
axios depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
|
||||||
|
If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
|
||||||
|
|
||||||
|
## TypeScript
|
||||||
|
axios includes [TypeScript](http://typescriptlang.org) definitions.
|
||||||
|
```typescript
|
||||||
|
import axios from 'axios';
|
||||||
|
axios.get('/user?ID=12345');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
* [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
|
||||||
|
* [Upgrade Guide](https://github.com/axios/axios/blob/master/UPGRADE_GUIDE.md)
|
||||||
|
* [Ecosystem](https://github.com/axios/axios/blob/master/ECOSYSTEM.md)
|
||||||
|
* [Contributing Guide](https://github.com/axios/axios/blob/master/CONTRIBUTING.md)
|
||||||
|
* [Code of Conduct](https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md)
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [Angular](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of Angular.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
162
node_modules/axios/UPGRADE_GUIDE.md
generated
vendored
Normal file
162
node_modules/axios/UPGRADE_GUIDE.md
generated
vendored
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
# Upgrade Guide
|
||||||
|
|
||||||
|
### 0.15.x -> 0.16.0
|
||||||
|
|
||||||
|
#### `Promise` Type Declarations
|
||||||
|
|
||||||
|
The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details.
|
||||||
|
|
||||||
|
### 0.13.x -> 0.14.0
|
||||||
|
|
||||||
|
#### TypeScript Definitions
|
||||||
|
|
||||||
|
The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.
|
||||||
|
|
||||||
|
Please use the following `import` statement to import axios in TypeScript:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
axios.get('/foo')
|
||||||
|
.then(response => console.log(response))
|
||||||
|
.catch(error => console.log(error));
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `agent` Config Option
|
||||||
|
|
||||||
|
The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// Define a custom agent for HTTP
|
||||||
|
httpAgent: new http.Agent({ keepAlive: true }),
|
||||||
|
// Define a custom agent for HTTPS
|
||||||
|
httpsAgent: new https.Agent({ keepAlive: true })
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `progress` Config Option
|
||||||
|
|
||||||
|
The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
// Define a handler for upload progress events
|
||||||
|
onUploadProgress: function (progressEvent) {
|
||||||
|
// ...
|
||||||
|
},
|
||||||
|
|
||||||
|
// Define a handler for download progress events
|
||||||
|
onDownloadProgress: function (progressEvent) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 0.12.x -> 0.13.0
|
||||||
|
|
||||||
|
The `0.13.0` release contains several changes to custom adapters and error handling.
|
||||||
|
|
||||||
|
#### Error Handling
|
||||||
|
|
||||||
|
Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response.
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('/user/12345')
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error.message);
|
||||||
|
console.log(error.code); // Not always specified
|
||||||
|
console.log(error.config); // The config that was used to make the request
|
||||||
|
console.log(error.response); // Only available if response was received from the server
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Request Adapters
|
||||||
|
|
||||||
|
This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.
|
||||||
|
|
||||||
|
1. Response transformer is now called outside of adapter.
|
||||||
|
2. Request adapter returns a `Promise`.
|
||||||
|
|
||||||
|
This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter.
|
||||||
|
|
||||||
|
Previous code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
function myAdapter(resolve, reject, config) {
|
||||||
|
var response = {
|
||||||
|
data: transformData(
|
||||||
|
responseData,
|
||||||
|
responseHeaders,
|
||||||
|
config.transformResponse
|
||||||
|
),
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders
|
||||||
|
};
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
New code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
function myAdapter(config) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
var response = {
|
||||||
|
data: responseData,
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders
|
||||||
|
};
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See the related commits for more details:
|
||||||
|
- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
|
||||||
|
- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
|
||||||
|
|
||||||
|
### 0.5.x -> 0.6.0
|
||||||
|
|
||||||
|
The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
|
||||||
|
|
||||||
|
#### ES6 Promise Polyfill
|
||||||
|
|
||||||
|
Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it.
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('es6-promise').polyfill();
|
||||||
|
var axios = require('axios');
|
||||||
|
```
|
||||||
|
|
||||||
|
This will polyfill the global environment, and only needs to be done once.
|
||||||
|
|
||||||
|
#### `axios.success`/`axios.error`
|
||||||
|
|
||||||
|
The `success`, and `error` aliases were deprecated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively.
|
||||||
|
|
||||||
|
```js
|
||||||
|
axios.get('some/url')
|
||||||
|
.then(function (res) {
|
||||||
|
/* ... */
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
/* ... */
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### UMD
|
||||||
|
|
||||||
|
Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// AMD
|
||||||
|
require(['bower_components/axios/dist/axios'], function (axios) {
|
||||||
|
/* ... */
|
||||||
|
});
|
||||||
|
|
||||||
|
// CommonJS
|
||||||
|
var axios = require('axios/dist/axios');
|
||||||
|
```
|
1756
node_modules/axios/dist/axios.js
generated
vendored
Normal file
1756
node_modules/axios/dist/axios.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/axios/dist/axios.map
generated
vendored
Normal file
1
node_modules/axios/dist/axios.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/axios/dist/axios.min.js
generated
vendored
Normal file
3
node_modules/axios/dist/axios.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/axios/dist/axios.min.map
generated
vendored
Normal file
1
node_modules/axios/dist/axios.min.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
161
node_modules/axios/index.d.ts
generated
vendored
Normal file
161
node_modules/axios/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,161 @@
|
||||||
|
export interface AxiosTransformer {
|
||||||
|
(data: any, headers?: any): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosAdapter {
|
||||||
|
(config: AxiosRequestConfig): AxiosPromise<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosBasicCredentials {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosProxyConfig {
|
||||||
|
host: string;
|
||||||
|
port: number;
|
||||||
|
auth?: {
|
||||||
|
username: string;
|
||||||
|
password:string;
|
||||||
|
};
|
||||||
|
protocol?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Method =
|
||||||
|
| 'get' | 'GET'
|
||||||
|
| 'delete' | 'DELETE'
|
||||||
|
| 'head' | 'HEAD'
|
||||||
|
| 'options' | 'OPTIONS'
|
||||||
|
| 'post' | 'POST'
|
||||||
|
| 'put' | 'PUT'
|
||||||
|
| 'patch' | 'PATCH'
|
||||||
|
| 'purge' | 'PURGE'
|
||||||
|
| 'link' | 'LINK'
|
||||||
|
| 'unlink' | 'UNLINK'
|
||||||
|
|
||||||
|
export type ResponseType =
|
||||||
|
| 'arraybuffer'
|
||||||
|
| 'blob'
|
||||||
|
| 'document'
|
||||||
|
| 'json'
|
||||||
|
| 'text'
|
||||||
|
| 'stream'
|
||||||
|
|
||||||
|
export interface AxiosRequestConfig {
|
||||||
|
url?: string;
|
||||||
|
method?: Method;
|
||||||
|
baseURL?: string;
|
||||||
|
transformRequest?: AxiosTransformer | AxiosTransformer[];
|
||||||
|
transformResponse?: AxiosTransformer | AxiosTransformer[];
|
||||||
|
headers?: any;
|
||||||
|
params?: any;
|
||||||
|
paramsSerializer?: (params: any) => string;
|
||||||
|
data?: any;
|
||||||
|
timeout?: number;
|
||||||
|
timeoutErrorMessage?: string;
|
||||||
|
withCredentials?: boolean;
|
||||||
|
adapter?: AxiosAdapter;
|
||||||
|
auth?: AxiosBasicCredentials;
|
||||||
|
responseType?: ResponseType;
|
||||||
|
xsrfCookieName?: string;
|
||||||
|
xsrfHeaderName?: string;
|
||||||
|
onUploadProgress?: (progressEvent: any) => void;
|
||||||
|
onDownloadProgress?: (progressEvent: any) => void;
|
||||||
|
maxContentLength?: number;
|
||||||
|
validateStatus?: ((status: number) => boolean) | null;
|
||||||
|
maxBodyLength?: number;
|
||||||
|
maxRedirects?: number;
|
||||||
|
socketPath?: string | null;
|
||||||
|
httpAgent?: any;
|
||||||
|
httpsAgent?: any;
|
||||||
|
proxy?: AxiosProxyConfig | false;
|
||||||
|
cancelToken?: CancelToken;
|
||||||
|
decompress?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosResponse<T = any> {
|
||||||
|
data: T;
|
||||||
|
status: number;
|
||||||
|
statusText: string;
|
||||||
|
headers: any;
|
||||||
|
config: AxiosRequestConfig;
|
||||||
|
request?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosError<T = any> extends Error {
|
||||||
|
config: AxiosRequestConfig;
|
||||||
|
code?: string;
|
||||||
|
request?: any;
|
||||||
|
response?: AxiosResponse<T>;
|
||||||
|
isAxiosError: boolean;
|
||||||
|
toJSON: () => object;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelStatic {
|
||||||
|
new (message?: string): Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Cancel {
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Canceler {
|
||||||
|
(message?: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelTokenStatic {
|
||||||
|
new (executor: (cancel: Canceler) => void): CancelToken;
|
||||||
|
source(): CancelTokenSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelToken {
|
||||||
|
promise: Promise<Cancel>;
|
||||||
|
reason?: Cancel;
|
||||||
|
throwIfRequested(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelTokenSource {
|
||||||
|
token: CancelToken;
|
||||||
|
cancel: Canceler;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosInterceptorManager<V> {
|
||||||
|
use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number;
|
||||||
|
eject(id: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosInstance {
|
||||||
|
(config: AxiosRequestConfig): AxiosPromise;
|
||||||
|
(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
||||||
|
defaults: AxiosRequestConfig;
|
||||||
|
interceptors: {
|
||||||
|
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
||||||
|
response: AxiosInterceptorManager<AxiosResponse>;
|
||||||
|
};
|
||||||
|
getUri(config?: AxiosRequestConfig): string;
|
||||||
|
request<T = any, R = AxiosResponse<T>> (config: AxiosRequestConfig): Promise<R>;
|
||||||
|
get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
delete<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
head<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
options<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosStatic extends AxiosInstance {
|
||||||
|
create(config?: AxiosRequestConfig): AxiosInstance;
|
||||||
|
Cancel: CancelStatic;
|
||||||
|
CancelToken: CancelTokenStatic;
|
||||||
|
isCancel(value: any): boolean;
|
||||||
|
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
|
||||||
|
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
||||||
|
isAxiosError(payload: any): payload is AxiosError;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const axios: AxiosStatic;
|
||||||
|
|
||||||
|
export default axios;
|
1
node_modules/axios/index.js
generated
vendored
Normal file
1
node_modules/axios/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./lib/axios');
|
37
node_modules/axios/lib/adapters/README.md
generated
vendored
Normal file
37
node_modules/axios/lib/adapters/README.md
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# axios // adapters
|
||||||
|
|
||||||
|
The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
var settle = require('./../core/settle');
|
||||||
|
|
||||||
|
module.exports = function myAdapter(config) {
|
||||||
|
// At this point:
|
||||||
|
// - config has been merged with defaults
|
||||||
|
// - request transformers have already run
|
||||||
|
// - request interceptors have already run
|
||||||
|
|
||||||
|
// Make the request using config provided
|
||||||
|
// Upon response settle the Promise
|
||||||
|
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
|
||||||
|
var response = {
|
||||||
|
data: responseData,
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders,
|
||||||
|
config: config,
|
||||||
|
request: request
|
||||||
|
};
|
||||||
|
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
|
||||||
|
// From here:
|
||||||
|
// - response transformers will run
|
||||||
|
// - response interceptors will run
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
303
node_modules/axios/lib/adapters/http.js
generated
vendored
Executable file
303
node_modules/axios/lib/adapters/http.js
generated
vendored
Executable file
|
@ -0,0 +1,303 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var settle = require('./../core/settle');
|
||||||
|
var buildFullPath = require('../core/buildFullPath');
|
||||||
|
var buildURL = require('./../helpers/buildURL');
|
||||||
|
var http = require('http');
|
||||||
|
var https = require('https');
|
||||||
|
var httpFollow = require('follow-redirects').http;
|
||||||
|
var httpsFollow = require('follow-redirects').https;
|
||||||
|
var url = require('url');
|
||||||
|
var zlib = require('zlib');
|
||||||
|
var pkg = require('./../../package.json');
|
||||||
|
var createError = require('../core/createError');
|
||||||
|
var enhanceError = require('../core/enhanceError');
|
||||||
|
|
||||||
|
var isHttps = /https:?/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {http.ClientRequestArgs} options
|
||||||
|
* @param {AxiosProxyConfig} proxy
|
||||||
|
* @param {string} location
|
||||||
|
*/
|
||||||
|
function setProxy(options, proxy, location) {
|
||||||
|
options.hostname = proxy.host;
|
||||||
|
options.host = proxy.host;
|
||||||
|
options.port = proxy.port;
|
||||||
|
options.path = location;
|
||||||
|
|
||||||
|
// Basic proxy authorization
|
||||||
|
if (proxy.auth) {
|
||||||
|
var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
|
||||||
|
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If a proxy is used, any redirects must also pass through the proxy
|
||||||
|
options.beforeRedirect = function beforeRedirect(redirection) {
|
||||||
|
redirection.headers.host = redirection.host;
|
||||||
|
setProxy(redirection, proxy, redirection.href);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/*eslint consistent-return:0*/
|
||||||
|
module.exports = function httpAdapter(config) {
|
||||||
|
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
||||||
|
var resolve = function resolve(value) {
|
||||||
|
resolvePromise(value);
|
||||||
|
};
|
||||||
|
var reject = function reject(value) {
|
||||||
|
rejectPromise(value);
|
||||||
|
};
|
||||||
|
var data = config.data;
|
||||||
|
var headers = config.headers;
|
||||||
|
|
||||||
|
// Set User-Agent (required by some servers)
|
||||||
|
// Only set header if it hasn't been set in config
|
||||||
|
// See https://github.com/axios/axios/issues/69
|
||||||
|
if (!headers['User-Agent'] && !headers['user-agent']) {
|
||||||
|
headers['User-Agent'] = 'axios/' + pkg.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data && !utils.isStream(data)) {
|
||||||
|
if (Buffer.isBuffer(data)) {
|
||||||
|
// Nothing to do...
|
||||||
|
} else if (utils.isArrayBuffer(data)) {
|
||||||
|
data = Buffer.from(new Uint8Array(data));
|
||||||
|
} else if (utils.isString(data)) {
|
||||||
|
data = Buffer.from(data, 'utf-8');
|
||||||
|
} else {
|
||||||
|
return reject(createError(
|
||||||
|
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
||||||
|
config
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Content-Length header if data exists
|
||||||
|
headers['Content-Length'] = data.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTP basic authentication
|
||||||
|
var auth = undefined;
|
||||||
|
if (config.auth) {
|
||||||
|
var username = config.auth.username || '';
|
||||||
|
var password = config.auth.password || '';
|
||||||
|
auth = username + ':' + password;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse url
|
||||||
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
||||||
|
var parsed = url.parse(fullPath);
|
||||||
|
var protocol = parsed.protocol || 'http:';
|
||||||
|
|
||||||
|
if (!auth && parsed.auth) {
|
||||||
|
var urlAuth = parsed.auth.split(':');
|
||||||
|
var urlUsername = urlAuth[0] || '';
|
||||||
|
var urlPassword = urlAuth[1] || '';
|
||||||
|
auth = urlUsername + ':' + urlPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auth) {
|
||||||
|
delete headers.Authorization;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isHttpsRequest = isHttps.test(protocol);
|
||||||
|
var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
|
||||||
|
method: config.method.toUpperCase(),
|
||||||
|
headers: headers,
|
||||||
|
agent: agent,
|
||||||
|
agents: { http: config.httpAgent, https: config.httpsAgent },
|
||||||
|
auth: auth
|
||||||
|
};
|
||||||
|
|
||||||
|
if (config.socketPath) {
|
||||||
|
options.socketPath = config.socketPath;
|
||||||
|
} else {
|
||||||
|
options.hostname = parsed.hostname;
|
||||||
|
options.port = parsed.port;
|
||||||
|
}
|
||||||
|
|
||||||
|
var proxy = config.proxy;
|
||||||
|
if (!proxy && proxy !== false) {
|
||||||
|
var proxyEnv = protocol.slice(0, -1) + '_proxy';
|
||||||
|
var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
|
||||||
|
if (proxyUrl) {
|
||||||
|
var parsedProxyUrl = url.parse(proxyUrl);
|
||||||
|
var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
|
||||||
|
var shouldProxy = true;
|
||||||
|
|
||||||
|
if (noProxyEnv) {
|
||||||
|
var noProxy = noProxyEnv.split(',').map(function trim(s) {
|
||||||
|
return s.trim();
|
||||||
|
});
|
||||||
|
|
||||||
|
shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
|
||||||
|
if (!proxyElement) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (proxyElement === '*') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (proxyElement[0] === '.' &&
|
||||||
|
parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsed.hostname === proxyElement;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldProxy) {
|
||||||
|
proxy = {
|
||||||
|
host: parsedProxyUrl.hostname,
|
||||||
|
port: parsedProxyUrl.port,
|
||||||
|
protocol: parsedProxyUrl.protocol
|
||||||
|
};
|
||||||
|
|
||||||
|
if (parsedProxyUrl.auth) {
|
||||||
|
var proxyUrlAuth = parsedProxyUrl.auth.split(':');
|
||||||
|
proxy.auth = {
|
||||||
|
username: proxyUrlAuth[0],
|
||||||
|
password: proxyUrlAuth[1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proxy) {
|
||||||
|
options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
|
||||||
|
setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
var transport;
|
||||||
|
var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
|
||||||
|
if (config.transport) {
|
||||||
|
transport = config.transport;
|
||||||
|
} else if (config.maxRedirects === 0) {
|
||||||
|
transport = isHttpsProxy ? https : http;
|
||||||
|
} else {
|
||||||
|
if (config.maxRedirects) {
|
||||||
|
options.maxRedirects = config.maxRedirects;
|
||||||
|
}
|
||||||
|
transport = isHttpsProxy ? httpsFollow : httpFollow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.maxBodyLength > -1) {
|
||||||
|
options.maxBodyLength = config.maxBodyLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the request
|
||||||
|
var req = transport.request(options, function handleResponse(res) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
|
||||||
|
// uncompress the response body transparently if required
|
||||||
|
var stream = res;
|
||||||
|
|
||||||
|
// return the last request in case of redirects
|
||||||
|
var lastRequest = res.req || req;
|
||||||
|
|
||||||
|
|
||||||
|
// if no content, is HEAD request or decompress disabled we should not decompress
|
||||||
|
if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
|
||||||
|
switch (res.headers['content-encoding']) {
|
||||||
|
/*eslint default-case:0*/
|
||||||
|
case 'gzip':
|
||||||
|
case 'compress':
|
||||||
|
case 'deflate':
|
||||||
|
// add the unzipper to the body stream processing pipeline
|
||||||
|
stream = stream.pipe(zlib.createUnzip());
|
||||||
|
|
||||||
|
// remove the content-encoding in order to not confuse downstream operations
|
||||||
|
delete res.headers['content-encoding'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = {
|
||||||
|
status: res.statusCode,
|
||||||
|
statusText: res.statusMessage,
|
||||||
|
headers: res.headers,
|
||||||
|
config: config,
|
||||||
|
request: lastRequest
|
||||||
|
};
|
||||||
|
|
||||||
|
if (config.responseType === 'stream') {
|
||||||
|
response.data = stream;
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
} else {
|
||||||
|
var responseBuffer = [];
|
||||||
|
stream.on('data', function handleStreamData(chunk) {
|
||||||
|
responseBuffer.push(chunk);
|
||||||
|
|
||||||
|
// make sure the content length is not over the maxContentLength if specified
|
||||||
|
if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
|
||||||
|
stream.destroy();
|
||||||
|
reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
||||||
|
config, null, lastRequest));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
stream.on('error', function handleStreamError(err) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
reject(enhanceError(err, config, null, lastRequest));
|
||||||
|
});
|
||||||
|
|
||||||
|
stream.on('end', function handleStreamEnd() {
|
||||||
|
var responseData = Buffer.concat(responseBuffer);
|
||||||
|
if (config.responseType !== 'arraybuffer') {
|
||||||
|
responseData = responseData.toString(config.responseEncoding);
|
||||||
|
if (!config.responseEncoding || config.responseEncoding === 'utf8') {
|
||||||
|
responseData = utils.stripBOM(responseData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
response.data = responseData;
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle errors
|
||||||
|
req.on('error', function handleRequestError(err) {
|
||||||
|
if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
|
||||||
|
reject(enhanceError(err, config, null, req));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle request timeout
|
||||||
|
if (config.timeout) {
|
||||||
|
// Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
|
||||||
|
// And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
|
||||||
|
// At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
|
||||||
|
// And then these socket which be hang up will devoring CPU little by little.
|
||||||
|
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
|
||||||
|
req.setTimeout(config.timeout, function handleRequestTimeout() {
|
||||||
|
req.abort();
|
||||||
|
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.cancelToken) {
|
||||||
|
// Handle cancellation
|
||||||
|
config.cancelToken.promise.then(function onCanceled(cancel) {
|
||||||
|
if (req.aborted) return;
|
||||||
|
|
||||||
|
req.abort();
|
||||||
|
reject(cancel);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the request
|
||||||
|
if (utils.isStream(data)) {
|
||||||
|
data.on('error', function handleStreamError(err) {
|
||||||
|
reject(enhanceError(err, config, null, req));
|
||||||
|
}).pipe(req);
|
||||||
|
} else {
|
||||||
|
req.end(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
179
node_modules/axios/lib/adapters/xhr.js
generated
vendored
Normal file
179
node_modules/axios/lib/adapters/xhr.js
generated
vendored
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var settle = require('./../core/settle');
|
||||||
|
var cookies = require('./../helpers/cookies');
|
||||||
|
var buildURL = require('./../helpers/buildURL');
|
||||||
|
var buildFullPath = require('../core/buildFullPath');
|
||||||
|
var parseHeaders = require('./../helpers/parseHeaders');
|
||||||
|
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
|
||||||
|
var createError = require('../core/createError');
|
||||||
|
|
||||||
|
module.exports = function xhrAdapter(config) {
|
||||||
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||||
|
var requestData = config.data;
|
||||||
|
var requestHeaders = config.headers;
|
||||||
|
|
||||||
|
if (utils.isFormData(requestData)) {
|
||||||
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
|
||||||
|
// HTTP basic authentication
|
||||||
|
if (config.auth) {
|
||||||
|
var username = config.auth.username || '';
|
||||||
|
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
||||||
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
||||||
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
||||||
|
|
||||||
|
// Set the request timeout in MS
|
||||||
|
request.timeout = config.timeout;
|
||||||
|
|
||||||
|
// Listen for ready state
|
||||||
|
request.onreadystatechange = function handleLoad() {
|
||||||
|
if (!request || request.readyState !== 4) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The request errored out and we didn't get a response, this will be
|
||||||
|
// handled by onerror instead
|
||||||
|
// With one exception: request that using file: protocol, most browsers
|
||||||
|
// will return status as 0 even though it's a successful request
|
||||||
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare the response
|
||||||
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
||||||
|
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
|
||||||
|
var response = {
|
||||||
|
data: responseData,
|
||||||
|
status: request.status,
|
||||||
|
statusText: request.statusText,
|
||||||
|
headers: responseHeaders,
|
||||||
|
config: config,
|
||||||
|
request: request
|
||||||
|
};
|
||||||
|
|
||||||
|
settle(resolve, reject, response);
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle browser request cancellation (as opposed to a manual cancellation)
|
||||||
|
request.onabort = function handleAbort() {
|
||||||
|
if (!request) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle low level network errors
|
||||||
|
request.onerror = function handleError() {
|
||||||
|
// Real errors are hidden from us by the browser
|
||||||
|
// onerror should only fire if it's a network error
|
||||||
|
reject(createError('Network Error', config, null, request));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle timeout
|
||||||
|
request.ontimeout = function handleTimeout() {
|
||||||
|
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
||||||
|
if (config.timeoutErrorMessage) {
|
||||||
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
||||||
|
}
|
||||||
|
reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
|
||||||
|
request));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add xsrf header
|
||||||
|
// This is only done if running in a standard browser environment.
|
||||||
|
// Specifically not if we're in a web worker, or react-native.
|
||||||
|
if (utils.isStandardBrowserEnv()) {
|
||||||
|
// Add xsrf header
|
||||||
|
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
||||||
|
cookies.read(config.xsrfCookieName) :
|
||||||
|
undefined;
|
||||||
|
|
||||||
|
if (xsrfValue) {
|
||||||
|
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add headers to the request
|
||||||
|
if ('setRequestHeader' in request) {
|
||||||
|
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
||||||
|
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
||||||
|
// Remove Content-Type if data is undefined
|
||||||
|
delete requestHeaders[key];
|
||||||
|
} else {
|
||||||
|
// Otherwise add header to the request
|
||||||
|
request.setRequestHeader(key, val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add withCredentials to request if needed
|
||||||
|
if (!utils.isUndefined(config.withCredentials)) {
|
||||||
|
request.withCredentials = !!config.withCredentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add responseType to request if needed
|
||||||
|
if (config.responseType) {
|
||||||
|
try {
|
||||||
|
request.responseType = config.responseType;
|
||||||
|
} catch (e) {
|
||||||
|
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
|
||||||
|
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
|
||||||
|
if (config.responseType !== 'json') {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle progress if needed
|
||||||
|
if (typeof config.onDownloadProgress === 'function') {
|
||||||
|
request.addEventListener('progress', config.onDownloadProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not all browsers support upload events
|
||||||
|
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
||||||
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.cancelToken) {
|
||||||
|
// Handle cancellation
|
||||||
|
config.cancelToken.promise.then(function onCanceled(cancel) {
|
||||||
|
if (!request) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.abort();
|
||||||
|
reject(cancel);
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!requestData) {
|
||||||
|
requestData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the request
|
||||||
|
request.send(requestData);
|
||||||
|
});
|
||||||
|
};
|
56
node_modules/axios/lib/axios.js
generated
vendored
Normal file
56
node_modules/axios/lib/axios.js
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./utils');
|
||||||
|
var bind = require('./helpers/bind');
|
||||||
|
var Axios = require('./core/Axios');
|
||||||
|
var mergeConfig = require('./core/mergeConfig');
|
||||||
|
var defaults = require('./defaults');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an instance of Axios
|
||||||
|
*
|
||||||
|
* @param {Object} defaultConfig The default config for the instance
|
||||||
|
* @return {Axios} A new instance of Axios
|
||||||
|
*/
|
||||||
|
function createInstance(defaultConfig) {
|
||||||
|
var context = new Axios(defaultConfig);
|
||||||
|
var instance = bind(Axios.prototype.request, context);
|
||||||
|
|
||||||
|
// Copy axios.prototype to instance
|
||||||
|
utils.extend(instance, Axios.prototype, context);
|
||||||
|
|
||||||
|
// Copy context to instance
|
||||||
|
utils.extend(instance, context);
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the default instance to be exported
|
||||||
|
var axios = createInstance(defaults);
|
||||||
|
|
||||||
|
// Expose Axios class to allow class inheritance
|
||||||
|
axios.Axios = Axios;
|
||||||
|
|
||||||
|
// Factory for creating new instances
|
||||||
|
axios.create = function create(instanceConfig) {
|
||||||
|
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
||||||
|
};
|
||||||
|
|
||||||
|
// Expose Cancel & CancelToken
|
||||||
|
axios.Cancel = require('./cancel/Cancel');
|
||||||
|
axios.CancelToken = require('./cancel/CancelToken');
|
||||||
|
axios.isCancel = require('./cancel/isCancel');
|
||||||
|
|
||||||
|
// Expose all/spread
|
||||||
|
axios.all = function all(promises) {
|
||||||
|
return Promise.all(promises);
|
||||||
|
};
|
||||||
|
axios.spread = require('./helpers/spread');
|
||||||
|
|
||||||
|
// Expose isAxiosError
|
||||||
|
axios.isAxiosError = require('./helpers/isAxiosError');
|
||||||
|
|
||||||
|
module.exports = axios;
|
||||||
|
|
||||||
|
// Allow use of default import syntax in TypeScript
|
||||||
|
module.exports.default = axios;
|
19
node_modules/axios/lib/cancel/Cancel.js
generated
vendored
Normal file
19
node_modules/axios/lib/cancel/Cancel.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A `Cancel` is an object that is thrown when an operation is canceled.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @param {string=} message The message.
|
||||||
|
*/
|
||||||
|
function Cancel(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cancel.prototype.toString = function toString() {
|
||||||
|
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
||||||
|
};
|
||||||
|
|
||||||
|
Cancel.prototype.__CANCEL__ = true;
|
||||||
|
|
||||||
|
module.exports = Cancel;
|
57
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
Normal file
57
node_modules/axios/lib/cancel/CancelToken.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var Cancel = require('./Cancel');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @param {Function} executor The executor function.
|
||||||
|
*/
|
||||||
|
function CancelToken(executor) {
|
||||||
|
if (typeof executor !== 'function') {
|
||||||
|
throw new TypeError('executor must be a function.');
|
||||||
|
}
|
||||||
|
|
||||||
|
var resolvePromise;
|
||||||
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
||||||
|
resolvePromise = resolve;
|
||||||
|
});
|
||||||
|
|
||||||
|
var token = this;
|
||||||
|
executor(function cancel(message) {
|
||||||
|
if (token.reason) {
|
||||||
|
// Cancellation has already been requested
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
token.reason = new Cancel(message);
|
||||||
|
resolvePromise(token.reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws a `Cancel` if cancellation has been requested.
|
||||||
|
*/
|
||||||
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
||||||
|
if (this.reason) {
|
||||||
|
throw this.reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
||||||
|
* cancels the `CancelToken`.
|
||||||
|
*/
|
||||||
|
CancelToken.source = function source() {
|
||||||
|
var cancel;
|
||||||
|
var token = new CancelToken(function executor(c) {
|
||||||
|
cancel = c;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
token: token,
|
||||||
|
cancel: cancel
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = CancelToken;
|
5
node_modules/axios/lib/cancel/isCancel.js
generated
vendored
Normal file
5
node_modules/axios/lib/cancel/isCancel.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function isCancel(value) {
|
||||||
|
return !!(value && value.__CANCEL__);
|
||||||
|
};
|
95
node_modules/axios/lib/core/Axios.js
generated
vendored
Normal file
95
node_modules/axios/lib/core/Axios.js
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var buildURL = require('../helpers/buildURL');
|
||||||
|
var InterceptorManager = require('./InterceptorManager');
|
||||||
|
var dispatchRequest = require('./dispatchRequest');
|
||||||
|
var mergeConfig = require('./mergeConfig');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new instance of Axios
|
||||||
|
*
|
||||||
|
* @param {Object} instanceConfig The default config for the instance
|
||||||
|
*/
|
||||||
|
function Axios(instanceConfig) {
|
||||||
|
this.defaults = instanceConfig;
|
||||||
|
this.interceptors = {
|
||||||
|
request: new InterceptorManager(),
|
||||||
|
response: new InterceptorManager()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a request
|
||||||
|
*
|
||||||
|
* @param {Object} config The config specific for this request (merged with this.defaults)
|
||||||
|
*/
|
||||||
|
Axios.prototype.request = function request(config) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
// Allow for axios('example/url'[, config]) a la fetch API
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
config = arguments[1] || {};
|
||||||
|
config.url = arguments[0];
|
||||||
|
} else {
|
||||||
|
config = config || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
config = mergeConfig(this.defaults, config);
|
||||||
|
|
||||||
|
// Set config.method
|
||||||
|
if (config.method) {
|
||||||
|
config.method = config.method.toLowerCase();
|
||||||
|
} else if (this.defaults.method) {
|
||||||
|
config.method = this.defaults.method.toLowerCase();
|
||||||
|
} else {
|
||||||
|
config.method = 'get';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook up interceptors middleware
|
||||||
|
var chain = [dispatchRequest, undefined];
|
||||||
|
var promise = Promise.resolve(config);
|
||||||
|
|
||||||
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
||||||
|
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
||||||
|
chain.push(interceptor.fulfilled, interceptor.rejected);
|
||||||
|
});
|
||||||
|
|
||||||
|
while (chain.length) {
|
||||||
|
promise = promise.then(chain.shift(), chain.shift());
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
Axios.prototype.getUri = function getUri(config) {
|
||||||
|
config = mergeConfig(this.defaults, config);
|
||||||
|
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Provide aliases for supported request methods
|
||||||
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
||||||
|
/*eslint func-names:0*/
|
||||||
|
Axios.prototype[method] = function(url, config) {
|
||||||
|
return this.request(mergeConfig(config || {}, {
|
||||||
|
method: method,
|
||||||
|
url: url,
|
||||||
|
data: (config || {}).data
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||||
|
/*eslint func-names:0*/
|
||||||
|
Axios.prototype[method] = function(url, data, config) {
|
||||||
|
return this.request(mergeConfig(config || {}, {
|
||||||
|
method: method,
|
||||||
|
url: url,
|
||||||
|
data: data
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = Axios;
|
52
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
Normal file
52
node_modules/axios/lib/core/InterceptorManager.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
function InterceptorManager() {
|
||||||
|
this.handlers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new interceptor to the stack
|
||||||
|
*
|
||||||
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
||||||
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
||||||
|
*
|
||||||
|
* @return {Number} An ID used to remove interceptor later
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
||||||
|
this.handlers.push({
|
||||||
|
fulfilled: fulfilled,
|
||||||
|
rejected: rejected
|
||||||
|
});
|
||||||
|
return this.handlers.length - 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an interceptor from the stack
|
||||||
|
*
|
||||||
|
* @param {Number} id The ID that was returned by `use`
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.eject = function eject(id) {
|
||||||
|
if (this.handlers[id]) {
|
||||||
|
this.handlers[id] = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate over all the registered interceptors
|
||||||
|
*
|
||||||
|
* This method is particularly useful for skipping over any
|
||||||
|
* interceptors that may have become `null` calling `eject`.
|
||||||
|
*
|
||||||
|
* @param {Function} fn The function to call for each interceptor
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.forEach = function forEach(fn) {
|
||||||
|
utils.forEach(this.handlers, function forEachHandler(h) {
|
||||||
|
if (h !== null) {
|
||||||
|
fn(h);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = InterceptorManager;
|
7
node_modules/axios/lib/core/README.md
generated
vendored
Normal file
7
node_modules/axios/lib/core/README.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# axios // core
|
||||||
|
|
||||||
|
The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are:
|
||||||
|
|
||||||
|
- Dispatching requests
|
||||||
|
- Managing interceptors
|
||||||
|
- Handling config
|
20
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
Normal file
20
node_modules/axios/lib/core/buildFullPath.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var isAbsoluteURL = require('../helpers/isAbsoluteURL');
|
||||||
|
var combineURLs = require('../helpers/combineURLs');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new URL by combining the baseURL with the requestedURL,
|
||||||
|
* only when the requestedURL is not already an absolute URL.
|
||||||
|
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
||||||
|
*
|
||||||
|
* @param {string} baseURL The base URL
|
||||||
|
* @param {string} requestedURL Absolute or relative URL to combine
|
||||||
|
* @returns {string} The combined full path
|
||||||
|
*/
|
||||||
|
module.exports = function buildFullPath(baseURL, requestedURL) {
|
||||||
|
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
||||||
|
return combineURLs(baseURL, requestedURL);
|
||||||
|
}
|
||||||
|
return requestedURL;
|
||||||
|
};
|
18
node_modules/axios/lib/core/createError.js
generated
vendored
Normal file
18
node_modules/axios/lib/core/createError.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var enhanceError = require('./enhanceError');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Error with the specified message, config, error code, request and response.
|
||||||
|
*
|
||||||
|
* @param {string} message The error message.
|
||||||
|
* @param {Object} config The config.
|
||||||
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
||||||
|
* @param {Object} [request] The request.
|
||||||
|
* @param {Object} [response] The response.
|
||||||
|
* @returns {Error} The created error.
|
||||||
|
*/
|
||||||
|
module.exports = function createError(message, config, code, request, response) {
|
||||||
|
var error = new Error(message);
|
||||||
|
return enhanceError(error, config, code, request, response);
|
||||||
|
};
|
79
node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
Normal file
79
node_modules/axios/lib/core/dispatchRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
var transformData = require('./transformData');
|
||||||
|
var isCancel = require('../cancel/isCancel');
|
||||||
|
var defaults = require('../defaults');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws a `Cancel` if cancellation has been requested.
|
||||||
|
*/
|
||||||
|
function throwIfCancellationRequested(config) {
|
||||||
|
if (config.cancelToken) {
|
||||||
|
config.cancelToken.throwIfRequested();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a request to the server using the configured adapter.
|
||||||
|
*
|
||||||
|
* @param {object} config The config that is to be used for the request
|
||||||
|
* @returns {Promise} The Promise to be fulfilled
|
||||||
|
*/
|
||||||
|
module.exports = function dispatchRequest(config) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Ensure headers exist
|
||||||
|
config.headers = config.headers || {};
|
||||||
|
|
||||||
|
// Transform request data
|
||||||
|
config.data = transformData(
|
||||||
|
config.data,
|
||||||
|
config.headers,
|
||||||
|
config.transformRequest
|
||||||
|
);
|
||||||
|
|
||||||
|
// Flatten headers
|
||||||
|
config.headers = utils.merge(
|
||||||
|
config.headers.common || {},
|
||||||
|
config.headers[config.method] || {},
|
||||||
|
config.headers
|
||||||
|
);
|
||||||
|
|
||||||
|
utils.forEach(
|
||||||
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
||||||
|
function cleanHeaderConfig(method) {
|
||||||
|
delete config.headers[method];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var adapter = config.adapter || defaults.adapter;
|
||||||
|
|
||||||
|
return adapter(config).then(function onAdapterResolution(response) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Transform response data
|
||||||
|
response.data = transformData(
|
||||||
|
response.data,
|
||||||
|
response.headers,
|
||||||
|
config.transformResponse
|
||||||
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}, function onAdapterRejection(reason) {
|
||||||
|
if (!isCancel(reason)) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Transform response data
|
||||||
|
if (reason && reason.response) {
|
||||||
|
reason.response.data = transformData(
|
||||||
|
reason.response.data,
|
||||||
|
reason.response.headers,
|
||||||
|
config.transformResponse
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject(reason);
|
||||||
|
});
|
||||||
|
};
|
42
node_modules/axios/lib/core/enhanceError.js
generated
vendored
Normal file
42
node_modules/axios/lib/core/enhanceError.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an Error with the specified config, error code, and response.
|
||||||
|
*
|
||||||
|
* @param {Error} error The error to update.
|
||||||
|
* @param {Object} config The config.
|
||||||
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
||||||
|
* @param {Object} [request] The request.
|
||||||
|
* @param {Object} [response] The response.
|
||||||
|
* @returns {Error} The error.
|
||||||
|
*/
|
||||||
|
module.exports = function enhanceError(error, config, code, request, response) {
|
||||||
|
error.config = config;
|
||||||
|
if (code) {
|
||||||
|
error.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
error.request = request;
|
||||||
|
error.response = response;
|
||||||
|
error.isAxiosError = true;
|
||||||
|
|
||||||
|
error.toJSON = function toJSON() {
|
||||||
|
return {
|
||||||
|
// Standard
|
||||||
|
message: this.message,
|
||||||
|
name: this.name,
|
||||||
|
// Microsoft
|
||||||
|
description: this.description,
|
||||||
|
number: this.number,
|
||||||
|
// Mozilla
|
||||||
|
fileName: this.fileName,
|
||||||
|
lineNumber: this.lineNumber,
|
||||||
|
columnNumber: this.columnNumber,
|
||||||
|
stack: this.stack,
|
||||||
|
// Axios
|
||||||
|
config: this.config,
|
||||||
|
code: this.code
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return error;
|
||||||
|
};
|
87
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
Normal file
87
node_modules/axios/lib/core/mergeConfig.js
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('../utils');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config-specific merge-function which creates a new config-object
|
||||||
|
* by merging two configuration objects together.
|
||||||
|
*
|
||||||
|
* @param {Object} config1
|
||||||
|
* @param {Object} config2
|
||||||
|
* @returns {Object} New object resulting from merging config2 to config1
|
||||||
|
*/
|
||||||
|
module.exports = function mergeConfig(config1, config2) {
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
config2 = config2 || {};
|
||||||
|
var config = {};
|
||||||
|
|
||||||
|
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
||||||
|
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
||||||
|
var defaultToConfig2Keys = [
|
||||||
|
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
||||||
|
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
||||||
|
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
||||||
|
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
||||||
|
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
||||||
|
];
|
||||||
|
var directMergeKeys = ['validateStatus'];
|
||||||
|
|
||||||
|
function getMergedValue(target, source) {
|
||||||
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
||||||
|
return utils.merge(target, source);
|
||||||
|
} else if (utils.isPlainObject(source)) {
|
||||||
|
return utils.merge({}, source);
|
||||||
|
} else if (utils.isArray(source)) {
|
||||||
|
return source.slice();
|
||||||
|
}
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeDeepProperties(prop) {
|
||||||
|
if (!utils.isUndefined(config2[prop])) {
|
||||||
|
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
||||||
|
} else if (!utils.isUndefined(config1[prop])) {
|
||||||
|
config[prop] = getMergedValue(undefined, config1[prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
||||||
|
if (!utils.isUndefined(config2[prop])) {
|
||||||
|
config[prop] = getMergedValue(undefined, config2[prop]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
||||||
|
|
||||||
|
utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
||||||
|
if (!utils.isUndefined(config2[prop])) {
|
||||||
|
config[prop] = getMergedValue(undefined, config2[prop]);
|
||||||
|
} else if (!utils.isUndefined(config1[prop])) {
|
||||||
|
config[prop] = getMergedValue(undefined, config1[prop]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(directMergeKeys, function merge(prop) {
|
||||||
|
if (prop in config2) {
|
||||||
|
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
||||||
|
} else if (prop in config1) {
|
||||||
|
config[prop] = getMergedValue(undefined, config1[prop]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var axiosKeys = valueFromConfig2Keys
|
||||||
|
.concat(mergeDeepPropertiesKeys)
|
||||||
|
.concat(defaultToConfig2Keys)
|
||||||
|
.concat(directMergeKeys);
|
||||||
|
|
||||||
|
var otherKeys = Object
|
||||||
|
.keys(config1)
|
||||||
|
.concat(Object.keys(config2))
|
||||||
|
.filter(function filterAxiosKeys(key) {
|
||||||
|
return axiosKeys.indexOf(key) === -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(otherKeys, mergeDeepProperties);
|
||||||
|
|
||||||
|
return config;
|
||||||
|
};
|
25
node_modules/axios/lib/core/settle.js
generated
vendored
Normal file
25
node_modules/axios/lib/core/settle.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var createError = require('./createError');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve or reject a Promise based on response status.
|
||||||
|
*
|
||||||
|
* @param {Function} resolve A function that resolves the promise.
|
||||||
|
* @param {Function} reject A function that rejects the promise.
|
||||||
|
* @param {object} response The response.
|
||||||
|
*/
|
||||||
|
module.exports = function settle(resolve, reject, response) {
|
||||||
|
var validateStatus = response.config.validateStatus;
|
||||||
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
||||||
|
resolve(response);
|
||||||
|
} else {
|
||||||
|
reject(createError(
|
||||||
|
'Request failed with status code ' + response.status,
|
||||||
|
response.config,
|
||||||
|
null,
|
||||||
|
response.request,
|
||||||
|
response
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
20
node_modules/axios/lib/core/transformData.js
generated
vendored
Normal file
20
node_modules/axios/lib/core/transformData.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform the data for a request or a response
|
||||||
|
*
|
||||||
|
* @param {Object|String} data The data to be transformed
|
||||||
|
* @param {Array} headers The headers for the request or response
|
||||||
|
* @param {Array|Function} fns A single function or Array of functions
|
||||||
|
* @returns {*} The resulting transformed data
|
||||||
|
*/
|
||||||
|
module.exports = function transformData(data, headers, fns) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
utils.forEach(fns, function transform(fn) {
|
||||||
|
data = fn(data, headers);
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
};
|
98
node_modules/axios/lib/defaults.js
generated
vendored
Normal file
98
node_modules/axios/lib/defaults.js
generated
vendored
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./utils');
|
||||||
|
var normalizeHeaderName = require('./helpers/normalizeHeaderName');
|
||||||
|
|
||||||
|
var DEFAULT_CONTENT_TYPE = {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
};
|
||||||
|
|
||||||
|
function setContentTypeIfUnset(headers, value) {
|
||||||
|
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
||||||
|
headers['Content-Type'] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDefaultAdapter() {
|
||||||
|
var adapter;
|
||||||
|
if (typeof XMLHttpRequest !== 'undefined') {
|
||||||
|
// For browsers use XHR adapter
|
||||||
|
adapter = require('./adapters/xhr');
|
||||||
|
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
||||||
|
// For node use HTTP adapter
|
||||||
|
adapter = require('./adapters/http');
|
||||||
|
}
|
||||||
|
return adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaults = {
|
||||||
|
adapter: getDefaultAdapter(),
|
||||||
|
|
||||||
|
transformRequest: [function transformRequest(data, headers) {
|
||||||
|
normalizeHeaderName(headers, 'Accept');
|
||||||
|
normalizeHeaderName(headers, 'Content-Type');
|
||||||
|
if (utils.isFormData(data) ||
|
||||||
|
utils.isArrayBuffer(data) ||
|
||||||
|
utils.isBuffer(data) ||
|
||||||
|
utils.isStream(data) ||
|
||||||
|
utils.isFile(data) ||
|
||||||
|
utils.isBlob(data)
|
||||||
|
) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
if (utils.isArrayBufferView(data)) {
|
||||||
|
return data.buffer;
|
||||||
|
}
|
||||||
|
if (utils.isURLSearchParams(data)) {
|
||||||
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
||||||
|
return data.toString();
|
||||||
|
}
|
||||||
|
if (utils.isObject(data)) {
|
||||||
|
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
||||||
|
return JSON.stringify(data);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
transformResponse: [function transformResponse(data) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
try {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
} catch (e) { /* Ignore */ }
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
||||||
|
* timeout is not created.
|
||||||
|
*/
|
||||||
|
timeout: 0,
|
||||||
|
|
||||||
|
xsrfCookieName: 'XSRF-TOKEN',
|
||||||
|
xsrfHeaderName: 'X-XSRF-TOKEN',
|
||||||
|
|
||||||
|
maxContentLength: -1,
|
||||||
|
maxBodyLength: -1,
|
||||||
|
|
||||||
|
validateStatus: function validateStatus(status) {
|
||||||
|
return status >= 200 && status < 300;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
defaults.headers = {
|
||||||
|
common: {
|
||||||
|
'Accept': 'application/json, text/plain, */*'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
||||||
|
defaults.headers[method] = {};
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||||
|
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = defaults;
|
7
node_modules/axios/lib/helpers/README.md
generated
vendored
Normal file
7
node_modules/axios/lib/helpers/README.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# axios // helpers
|
||||||
|
|
||||||
|
The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like:
|
||||||
|
|
||||||
|
- Browser polyfills
|
||||||
|
- Managing cookies
|
||||||
|
- Parsing HTTP headers
|
11
node_modules/axios/lib/helpers/bind.js
generated
vendored
Normal file
11
node_modules/axios/lib/helpers/bind.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function bind(fn, thisArg) {
|
||||||
|
return function wrap() {
|
||||||
|
var args = new Array(arguments.length);
|
||||||
|
for (var i = 0; i < args.length; i++) {
|
||||||
|
args[i] = arguments[i];
|
||||||
|
}
|
||||||
|
return fn.apply(thisArg, args);
|
||||||
|
};
|
||||||
|
};
|
70
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
Normal file
70
node_modules/axios/lib/helpers/buildURL.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
function encode(val) {
|
||||||
|
return encodeURIComponent(val).
|
||||||
|
replace(/%3A/gi, ':').
|
||||||
|
replace(/%24/g, '$').
|
||||||
|
replace(/%2C/gi, ',').
|
||||||
|
replace(/%20/g, '+').
|
||||||
|
replace(/%5B/gi, '[').
|
||||||
|
replace(/%5D/gi, ']');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a URL by appending params to the end
|
||||||
|
*
|
||||||
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
||||||
|
* @param {object} [params] The params to be appended
|
||||||
|
* @returns {string} The formatted url
|
||||||
|
*/
|
||||||
|
module.exports = function buildURL(url, params, paramsSerializer) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
if (!params) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
var serializedParams;
|
||||||
|
if (paramsSerializer) {
|
||||||
|
serializedParams = paramsSerializer(params);
|
||||||
|
} else if (utils.isURLSearchParams(params)) {
|
||||||
|
serializedParams = params.toString();
|
||||||
|
} else {
|
||||||
|
var parts = [];
|
||||||
|
|
||||||
|
utils.forEach(params, function serialize(val, key) {
|
||||||
|
if (val === null || typeof val === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isArray(val)) {
|
||||||
|
key = key + '[]';
|
||||||
|
} else {
|
||||||
|
val = [val];
|
||||||
|
}
|
||||||
|
|
||||||
|
utils.forEach(val, function parseValue(v) {
|
||||||
|
if (utils.isDate(v)) {
|
||||||
|
v = v.toISOString();
|
||||||
|
} else if (utils.isObject(v)) {
|
||||||
|
v = JSON.stringify(v);
|
||||||
|
}
|
||||||
|
parts.push(encode(key) + '=' + encode(v));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
serializedParams = parts.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serializedParams) {
|
||||||
|
var hashmarkIndex = url.indexOf('#');
|
||||||
|
if (hashmarkIndex !== -1) {
|
||||||
|
url = url.slice(0, hashmarkIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
};
|
14
node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
Normal file
14
node_modules/axios/lib/helpers/combineURLs.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new URL by combining the specified URLs
|
||||||
|
*
|
||||||
|
* @param {string} baseURL The base URL
|
||||||
|
* @param {string} relativeURL The relative URL
|
||||||
|
* @returns {string} The combined URL
|
||||||
|
*/
|
||||||
|
module.exports = function combineURLs(baseURL, relativeURL) {
|
||||||
|
return relativeURL
|
||||||
|
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
||||||
|
: baseURL;
|
||||||
|
};
|
53
node_modules/axios/lib/helpers/cookies.js
generated
vendored
Normal file
53
node_modules/axios/lib/helpers/cookies.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
module.exports = (
|
||||||
|
utils.isStandardBrowserEnv() ?
|
||||||
|
|
||||||
|
// Standard browser envs support document.cookie
|
||||||
|
(function standardBrowserEnv() {
|
||||||
|
return {
|
||||||
|
write: function write(name, value, expires, path, domain, secure) {
|
||||||
|
var cookie = [];
|
||||||
|
cookie.push(name + '=' + encodeURIComponent(value));
|
||||||
|
|
||||||
|
if (utils.isNumber(expires)) {
|
||||||
|
cookie.push('expires=' + new Date(expires).toGMTString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isString(path)) {
|
||||||
|
cookie.push('path=' + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.isString(domain)) {
|
||||||
|
cookie.push('domain=' + domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (secure === true) {
|
||||||
|
cookie.push('secure');
|
||||||
|
}
|
||||||
|
|
||||||
|
document.cookie = cookie.join('; ');
|
||||||
|
},
|
||||||
|
|
||||||
|
read: function read(name) {
|
||||||
|
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
||||||
|
return (match ? decodeURIComponent(match[3]) : null);
|
||||||
|
},
|
||||||
|
|
||||||
|
remove: function remove(name) {
|
||||||
|
this.write(name, '', Date.now() - 86400000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})() :
|
||||||
|
|
||||||
|
// Non standard browser env (web workers, react-native) lack needed support.
|
||||||
|
(function nonStandardBrowserEnv() {
|
||||||
|
return {
|
||||||
|
write: function write() {},
|
||||||
|
read: function read() { return null; },
|
||||||
|
remove: function remove() {}
|
||||||
|
};
|
||||||
|
})()
|
||||||
|
);
|
24
node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
Normal file
24
node_modules/axios/lib/helpers/deprecatedMethod.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/*eslint no-console:0*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supply a warning to the developer that a method they are using
|
||||||
|
* has been deprecated.
|
||||||
|
*
|
||||||
|
* @param {string} method The name of the deprecated method
|
||||||
|
* @param {string} [instead] The alternate method to use if applicable
|
||||||
|
* @param {string} [docs] The documentation URL to get further details
|
||||||
|
*/
|
||||||
|
module.exports = function deprecatedMethod(method, instead, docs) {
|
||||||
|
try {
|
||||||
|
console.warn(
|
||||||
|
'DEPRECATED method `' + method + '`.' +
|
||||||
|
(instead ? ' Use `' + instead + '` instead.' : '') +
|
||||||
|
' This method will be removed in a future release.');
|
||||||
|
|
||||||
|
if (docs) {
|
||||||
|
console.warn('For more information about usage see ' + docs);
|
||||||
|
}
|
||||||
|
} catch (e) { /* Ignore */ }
|
||||||
|
};
|
14
node_modules/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
Normal file
14
node_modules/axios/lib/helpers/isAbsoluteURL.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the specified URL is absolute
|
||||||
|
*
|
||||||
|
* @param {string} url The URL to test
|
||||||
|
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
||||||
|
*/
|
||||||
|
module.exports = function isAbsoluteURL(url) {
|
||||||
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
||||||
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
||||||
|
// by any combination of letters, digits, plus, period, or hyphen.
|
||||||
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
||||||
|
};
|
11
node_modules/axios/lib/helpers/isAxiosError.js
generated
vendored
Normal file
11
node_modules/axios/lib/helpers/isAxiosError.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the payload is an error thrown by Axios
|
||||||
|
*
|
||||||
|
* @param {*} payload The value to test
|
||||||
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
||||||
|
*/
|
||||||
|
module.exports = function isAxiosError(payload) {
|
||||||
|
return (typeof payload === 'object') && (payload.isAxiosError === true);
|
||||||
|
};
|
68
node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
Normal file
68
node_modules/axios/lib/helpers/isURLSameOrigin.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
module.exports = (
|
||||||
|
utils.isStandardBrowserEnv() ?
|
||||||
|
|
||||||
|
// Standard browser envs have full support of the APIs needed to test
|
||||||
|
// whether the request URL is of the same origin as current location.
|
||||||
|
(function standardBrowserEnv() {
|
||||||
|
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
||||||
|
var urlParsingNode = document.createElement('a');
|
||||||
|
var originURL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse a URL to discover it's components
|
||||||
|
*
|
||||||
|
* @param {String} url The URL to be parsed
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
function resolveURL(url) {
|
||||||
|
var href = url;
|
||||||
|
|
||||||
|
if (msie) {
|
||||||
|
// IE needs attribute set twice to normalize properties
|
||||||
|
urlParsingNode.setAttribute('href', href);
|
||||||
|
href = urlParsingNode.href;
|
||||||
|
}
|
||||||
|
|
||||||
|
urlParsingNode.setAttribute('href', href);
|
||||||
|
|
||||||
|
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
||||||
|
return {
|
||||||
|
href: urlParsingNode.href,
|
||||||
|
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
||||||
|
host: urlParsingNode.host,
|
||||||
|
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
||||||
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
||||||
|
hostname: urlParsingNode.hostname,
|
||||||
|
port: urlParsingNode.port,
|
||||||
|
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
||||||
|
urlParsingNode.pathname :
|
||||||
|
'/' + urlParsingNode.pathname
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
originURL = resolveURL(window.location.href);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a URL shares the same origin as the current location
|
||||||
|
*
|
||||||
|
* @param {String} requestURL The URL to test
|
||||||
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
||||||
|
*/
|
||||||
|
return function isURLSameOrigin(requestURL) {
|
||||||
|
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
||||||
|
return (parsed.protocol === originURL.protocol &&
|
||||||
|
parsed.host === originURL.host);
|
||||||
|
};
|
||||||
|
})() :
|
||||||
|
|
||||||
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
||||||
|
(function nonStandardBrowserEnv() {
|
||||||
|
return function isURLSameOrigin() {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
})()
|
||||||
|
);
|
12
node_modules/axios/lib/helpers/normalizeHeaderName.js
generated
vendored
Normal file
12
node_modules/axios/lib/helpers/normalizeHeaderName.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('../utils');
|
||||||
|
|
||||||
|
module.exports = function normalizeHeaderName(headers, normalizedName) {
|
||||||
|
utils.forEach(headers, function processHeader(value, name) {
|
||||||
|
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
||||||
|
headers[normalizedName] = value;
|
||||||
|
delete headers[name];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
53
node_modules/axios/lib/helpers/parseHeaders.js
generated
vendored
Normal file
53
node_modules/axios/lib/helpers/parseHeaders.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = require('./../utils');
|
||||||
|
|
||||||
|
// Headers whose duplicates are ignored by node
|
||||||
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
||||||
|
var ignoreDuplicateOf = [
|
||||||
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
||||||
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
||||||
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
||||||
|
'referer', 'retry-after', 'user-agent'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse headers into an object
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
||||||
|
* Content-Type: application/json
|
||||||
|
* Connection: keep-alive
|
||||||
|
* Transfer-Encoding: chunked
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {String} headers Headers needing to be parsed
|
||||||
|
* @returns {Object} Headers parsed into an object
|
||||||
|
*/
|
||||||
|
module.exports = function parseHeaders(headers) {
|
||||||
|
var parsed = {};
|
||||||
|
var key;
|
||||||
|
var val;
|
||||||
|
var i;
|
||||||
|
|
||||||
|
if (!headers) { return parsed; }
|
||||||
|
|
||||||
|
utils.forEach(headers.split('\n'), function parser(line) {
|
||||||
|
i = line.indexOf(':');
|
||||||
|
key = utils.trim(line.substr(0, i)).toLowerCase();
|
||||||
|
val = utils.trim(line.substr(i + 1));
|
||||||
|
|
||||||
|
if (key) {
|
||||||
|
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (key === 'set-cookie') {
|
||||||
|
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
||||||
|
} else {
|
||||||
|
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return parsed;
|
||||||
|
};
|
27
node_modules/axios/lib/helpers/spread.js
generated
vendored
Normal file
27
node_modules/axios/lib/helpers/spread.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
||||||
|
*
|
||||||
|
* Common use case would be to use `Function.prototype.apply`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* function f(x, y, z) {}
|
||||||
|
* var args = [1, 2, 3];
|
||||||
|
* f.apply(null, args);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* With `spread` this example can be re-written.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* spread(function(x, y, z) {})([1, 2, 3]);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {Function} callback
|
||||||
|
* @returns {Function}
|
||||||
|
*/
|
||||||
|
module.exports = function spread(callback) {
|
||||||
|
return function wrap(arr) {
|
||||||
|
return callback.apply(null, arr);
|
||||||
|
};
|
||||||
|
};
|
351
node_modules/axios/lib/utils.js
generated
vendored
Normal file
351
node_modules/axios/lib/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,351 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var bind = require('./helpers/bind');
|
||||||
|
|
||||||
|
/*global toString:true*/
|
||||||
|
|
||||||
|
// utils is a library of generic helper functions non-specific to axios
|
||||||
|
|
||||||
|
var toString = Object.prototype.toString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is an Array
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is an Array, otherwise false
|
||||||
|
*/
|
||||||
|
function isArray(val) {
|
||||||
|
return toString.call(val) === '[object Array]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is undefined
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if the value is undefined, otherwise false
|
||||||
|
*/
|
||||||
|
function isUndefined(val) {
|
||||||
|
return typeof val === 'undefined';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Buffer
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
||||||
|
*/
|
||||||
|
function isBuffer(val) {
|
||||||
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
||||||
|
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is an ArrayBuffer
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
||||||
|
*/
|
||||||
|
function isArrayBuffer(val) {
|
||||||
|
return toString.call(val) === '[object ArrayBuffer]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a FormData
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is an FormData, otherwise false
|
||||||
|
*/
|
||||||
|
function isFormData(val) {
|
||||||
|
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a view on an ArrayBuffer
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
||||||
|
*/
|
||||||
|
function isArrayBufferView(val) {
|
||||||
|
var result;
|
||||||
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
||||||
|
result = ArrayBuffer.isView(val);
|
||||||
|
} else {
|
||||||
|
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a String
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a String, otherwise false
|
||||||
|
*/
|
||||||
|
function isString(val) {
|
||||||
|
return typeof val === 'string';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Number
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Number, otherwise false
|
||||||
|
*/
|
||||||
|
function isNumber(val) {
|
||||||
|
return typeof val === 'number';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is an Object
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is an Object, otherwise false
|
||||||
|
*/
|
||||||
|
function isObject(val) {
|
||||||
|
return val !== null && typeof val === 'object';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a plain Object
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @return {boolean} True if value is a plain Object, otherwise false
|
||||||
|
*/
|
||||||
|
function isPlainObject(val) {
|
||||||
|
if (toString.call(val) !== '[object Object]') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var prototype = Object.getPrototypeOf(val);
|
||||||
|
return prototype === null || prototype === Object.prototype;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Date
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Date, otherwise false
|
||||||
|
*/
|
||||||
|
function isDate(val) {
|
||||||
|
return toString.call(val) === '[object Date]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a File
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a File, otherwise false
|
||||||
|
*/
|
||||||
|
function isFile(val) {
|
||||||
|
return toString.call(val) === '[object File]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Blob
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Blob, otherwise false
|
||||||
|
*/
|
||||||
|
function isBlob(val) {
|
||||||
|
return toString.call(val) === '[object Blob]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Function
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Function, otherwise false
|
||||||
|
*/
|
||||||
|
function isFunction(val) {
|
||||||
|
return toString.call(val) === '[object Function]';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a Stream
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a Stream, otherwise false
|
||||||
|
*/
|
||||||
|
function isStream(val) {
|
||||||
|
return isObject(val) && isFunction(val.pipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a value is a URLSearchParams object
|
||||||
|
*
|
||||||
|
* @param {Object} val The value to test
|
||||||
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
||||||
|
*/
|
||||||
|
function isURLSearchParams(val) {
|
||||||
|
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim excess whitespace off the beginning and end of a string
|
||||||
|
*
|
||||||
|
* @param {String} str The String to trim
|
||||||
|
* @returns {String} The String freed of excess whitespace
|
||||||
|
*/
|
||||||
|
function trim(str) {
|
||||||
|
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if we're running in a standard browser environment
|
||||||
|
*
|
||||||
|
* This allows axios to run in a web worker, and react-native.
|
||||||
|
* Both environments support XMLHttpRequest, but not fully standard globals.
|
||||||
|
*
|
||||||
|
* web workers:
|
||||||
|
* typeof window -> undefined
|
||||||
|
* typeof document -> undefined
|
||||||
|
*
|
||||||
|
* react-native:
|
||||||
|
* navigator.product -> 'ReactNative'
|
||||||
|
* nativescript
|
||||||
|
* navigator.product -> 'NativeScript' or 'NS'
|
||||||
|
*/
|
||||||
|
function isStandardBrowserEnv() {
|
||||||
|
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
||||||
|
navigator.product === 'NativeScript' ||
|
||||||
|
navigator.product === 'NS')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
typeof window !== 'undefined' &&
|
||||||
|
typeof document !== 'undefined'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate over an Array or an Object invoking a function for each item.
|
||||||
|
*
|
||||||
|
* If `obj` is an Array callback will be called passing
|
||||||
|
* the value, index, and complete array for each item.
|
||||||
|
*
|
||||||
|
* If 'obj' is an Object callback will be called passing
|
||||||
|
* the value, key, and complete object for each property.
|
||||||
|
*
|
||||||
|
* @param {Object|Array} obj The object to iterate
|
||||||
|
* @param {Function} fn The callback to invoke for each item
|
||||||
|
*/
|
||||||
|
function forEach(obj, fn) {
|
||||||
|
// Don't bother if no value provided
|
||||||
|
if (obj === null || typeof obj === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force an array if not already something iterable
|
||||||
|
if (typeof obj !== 'object') {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
obj = [obj];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isArray(obj)) {
|
||||||
|
// Iterate over array values
|
||||||
|
for (var i = 0, l = obj.length; i < l; i++) {
|
||||||
|
fn.call(null, obj[i], i, obj);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Iterate over object keys
|
||||||
|
for (var key in obj) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||||
|
fn.call(null, obj[key], key, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts varargs expecting each argument to be an object, then
|
||||||
|
* immutably merges the properties of each object and returns result.
|
||||||
|
*
|
||||||
|
* When multiple objects contain the same key the later object in
|
||||||
|
* the arguments list will take precedence.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* var result = merge({foo: 123}, {foo: 456});
|
||||||
|
* console.log(result.foo); // outputs 456
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {Object} obj1 Object to merge
|
||||||
|
* @returns {Object} Result of all merge properties
|
||||||
|
*/
|
||||||
|
function merge(/* obj1, obj2, obj3, ... */) {
|
||||||
|
var result = {};
|
||||||
|
function assignValue(val, key) {
|
||||||
|
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
||||||
|
result[key] = merge(result[key], val);
|
||||||
|
} else if (isPlainObject(val)) {
|
||||||
|
result[key] = merge({}, val);
|
||||||
|
} else if (isArray(val)) {
|
||||||
|
result[key] = val.slice();
|
||||||
|
} else {
|
||||||
|
result[key] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
||||||
|
forEach(arguments[i], assignValue);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extends object a by mutably adding to it the properties of object b.
|
||||||
|
*
|
||||||
|
* @param {Object} a The object to be extended
|
||||||
|
* @param {Object} b The object to copy properties from
|
||||||
|
* @param {Object} thisArg The object to bind function to
|
||||||
|
* @return {Object} The resulting value of object a
|
||||||
|
*/
|
||||||
|
function extend(a, b, thisArg) {
|
||||||
|
forEach(b, function assignValue(val, key) {
|
||||||
|
if (thisArg && typeof val === 'function') {
|
||||||
|
a[key] = bind(val, thisArg);
|
||||||
|
} else {
|
||||||
|
a[key] = val;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
||||||
|
*
|
||||||
|
* @param {string} content with BOM
|
||||||
|
* @return {string} content value without BOM
|
||||||
|
*/
|
||||||
|
function stripBOM(content) {
|
||||||
|
if (content.charCodeAt(0) === 0xFEFF) {
|
||||||
|
content = content.slice(1);
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
isArray: isArray,
|
||||||
|
isArrayBuffer: isArrayBuffer,
|
||||||
|
isBuffer: isBuffer,
|
||||||
|
isFormData: isFormData,
|
||||||
|
isArrayBufferView: isArrayBufferView,
|
||||||
|
isString: isString,
|
||||||
|
isNumber: isNumber,
|
||||||
|
isObject: isObject,
|
||||||
|
isPlainObject: isPlainObject,
|
||||||
|
isUndefined: isUndefined,
|
||||||
|
isDate: isDate,
|
||||||
|
isFile: isFile,
|
||||||
|
isBlob: isBlob,
|
||||||
|
isFunction: isFunction,
|
||||||
|
isStream: isStream,
|
||||||
|
isURLSearchParams: isURLSearchParams,
|
||||||
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
||||||
|
forEach: forEach,
|
||||||
|
merge: merge,
|
||||||
|
extend: extend,
|
||||||
|
trim: trim,
|
||||||
|
stripBOM: stripBOM
|
||||||
|
};
|
86
node_modules/axios/package.json
generated
vendored
Normal file
86
node_modules/axios/package.json
generated
vendored
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
{
|
||||||
|
"name": "axios",
|
||||||
|
"version": "0.21.1",
|
||||||
|
"description": "Promise based HTTP client for the browser and node.js",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "grunt test && bundlesize",
|
||||||
|
"start": "node ./sandbox/server.js",
|
||||||
|
"build": "NODE_ENV=production grunt build",
|
||||||
|
"preversion": "npm test",
|
||||||
|
"version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",
|
||||||
|
"postversion": "git push && git push --tags",
|
||||||
|
"examples": "node ./examples/server.js",
|
||||||
|
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
||||||
|
"fix": "eslint --fix lib/**/*.js"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/axios/axios.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"xhr",
|
||||||
|
"http",
|
||||||
|
"ajax",
|
||||||
|
"promise",
|
||||||
|
"node"
|
||||||
|
],
|
||||||
|
"author": "Matt Zabriskie",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/axios/axios/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/axios/axios",
|
||||||
|
"devDependencies": {
|
||||||
|
"bundlesize": "^0.17.0",
|
||||||
|
"coveralls": "^3.0.0",
|
||||||
|
"es6-promise": "^4.2.4",
|
||||||
|
"grunt": "^1.0.2",
|
||||||
|
"grunt-banner": "^0.6.0",
|
||||||
|
"grunt-cli": "^1.2.0",
|
||||||
|
"grunt-contrib-clean": "^1.1.0",
|
||||||
|
"grunt-contrib-watch": "^1.0.0",
|
||||||
|
"grunt-eslint": "^20.1.0",
|
||||||
|
"grunt-karma": "^2.0.0",
|
||||||
|
"grunt-mocha-test": "^0.13.3",
|
||||||
|
"grunt-ts": "^6.0.0-beta.19",
|
||||||
|
"grunt-webpack": "^1.0.18",
|
||||||
|
"istanbul-instrumenter-loader": "^1.0.0",
|
||||||
|
"jasmine-core": "^2.4.1",
|
||||||
|
"karma": "^1.3.0",
|
||||||
|
"karma-chrome-launcher": "^2.2.0",
|
||||||
|
"karma-coverage": "^1.1.1",
|
||||||
|
"karma-firefox-launcher": "^1.1.0",
|
||||||
|
"karma-jasmine": "^1.1.1",
|
||||||
|
"karma-jasmine-ajax": "^0.1.13",
|
||||||
|
"karma-opera-launcher": "^1.0.0",
|
||||||
|
"karma-safari-launcher": "^1.0.0",
|
||||||
|
"karma-sauce-launcher": "^1.2.0",
|
||||||
|
"karma-sinon": "^1.0.5",
|
||||||
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
|
"karma-webpack": "^1.7.0",
|
||||||
|
"load-grunt-tasks": "^3.5.2",
|
||||||
|
"minimist": "^1.2.0",
|
||||||
|
"mocha": "^5.2.0",
|
||||||
|
"sinon": "^4.5.0",
|
||||||
|
"typescript": "^2.8.1",
|
||||||
|
"url-search-params": "^0.10.0",
|
||||||
|
"webpack": "^1.13.1",
|
||||||
|
"webpack-dev-server": "^1.14.1"
|
||||||
|
},
|
||||||
|
"browser": {
|
||||||
|
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
||||||
|
},
|
||||||
|
"jsdelivr": "dist/axios.min.js",
|
||||||
|
"unpkg": "dist/axios.min.js",
|
||||||
|
"typings": "./index.d.ts",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.10.0"
|
||||||
|
},
|
||||||
|
"bundlesize": [
|
||||||
|
{
|
||||||
|
"path": "./dist/axios.min.js",
|
||||||
|
"threshold": "5kB"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
361
node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
361
node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,361 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). (Format adopted after v3.0.0.)
|
||||||
|
|
||||||
|
<!-- markdownlint-disable MD024 -->
|
||||||
|
<!-- markdownlint-disable MD004 -->
|
||||||
|
|
||||||
|
## [6.2.1] (2020-12-13)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- some tests failed if directory path included a space ([1390])
|
||||||
|
|
||||||
|
## [6.2.0] (2020-10-25)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- added 'tsx' file extension for stand-alone executable subcommands ([#1368])
|
||||||
|
- documented second parameter to `.description()` to describe command arguments ([#1353])
|
||||||
|
- documentation of special cases with options taking varying numbers of option-arguments ([#1332])
|
||||||
|
- documentation for terminology ([#1361])
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- add missing TypeScript definition for `.addHelpCommand()' ([#1375])
|
||||||
|
- removed blank line after "Arguments:" in help, to match "Options:" and "Commands:" ([#1360])
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- update dependencies
|
||||||
|
|
||||||
|
## [6.1.0] (2020-08-28)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- include URL to relevant section of README for error for potential conflict between Command properties and option values ([#1306])
|
||||||
|
- `.combineFlagAndOptionalValue(false)` to ease upgrade path from older versions of Commander ([#1326])
|
||||||
|
- allow disabling the built-in help option using `.helpOption(false)` ([#1325])
|
||||||
|
- allow just some arguments in `argumentDescription` to `.description()` ([#1323])
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- tidy async test and remove lint override ([#1312])
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- executable subcommand launching when script path not known ([#1322])
|
||||||
|
|
||||||
|
## [6.0.0] (2020-07-21)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- add support for variadic options ([#1250])
|
||||||
|
- allow options to be added with just a short flag ([#1256])
|
||||||
|
- *Breaking* the option property has same case as flag. e.g. flag `-n` accessed as `opts().n` (previously uppercase)
|
||||||
|
- *Breaking* throw an error if there might be a clash between option name and a Command property, with advice on how to resolve ([#1275])
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Options which contain -no- in the middle of the option flag should not be treated as negatable. ([#1301])
|
||||||
|
|
||||||
|
## [6.0.0-0] (2020-06-20)
|
||||||
|
|
||||||
|
(Released in 6.0.0)
|
||||||
|
|
||||||
|
## [5.1.0] (2020-04-25)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- support for multiple command aliases, the first of which is shown in the auto-generated help ([#531], [#1236])
|
||||||
|
- configuration support in `addCommand()` for `hidden` and `isDefault` ([#1232])
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- omit masked help flags from the displayed help ([#645], [#1247])
|
||||||
|
- remove old short help flag when change help flags using `helpOption` ([#1248])
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- remove use of `arguments` to improve auto-generated help in editors ([#1235])
|
||||||
|
- rename `.command()` configuration `noHelp` to `hidden` (but not remove old support) ([#1232])
|
||||||
|
- improvements to documentation
|
||||||
|
- update dependencies
|
||||||
|
- update tested versions of node
|
||||||
|
- eliminate lint errors in TypeScript ([#1208])
|
||||||
|
|
||||||
|
## [5.0.0] (2020-03-14)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* support for nested commands with action-handlers ([#1] [#764] [#1149])
|
||||||
|
* `.addCommand()` for adding a separately configured command ([#764] [#1149])
|
||||||
|
* allow a non-executable to be set as the default command ([#742] [#1149])
|
||||||
|
* implicit help command when there are subcommands (previously only if executables) ([#1149])
|
||||||
|
* customise implicit help command with `.addHelpCommand()` ([#1149])
|
||||||
|
* display error message for unknown subcommand, by default ([#432] [#1088] [#1149])
|
||||||
|
* display help for missing subcommand, by default ([#1088] [#1149])
|
||||||
|
* combined short options as single argument may include boolean flags and value flag and value (e.g. `-a -b -p 80` can be written as `-abp80`) ([#1145])
|
||||||
|
* `.parseOption()` includes short flag and long flag expansions ([#1145])
|
||||||
|
* `.helpInformation()` returns help text as a string, previously a private routine ([#1169])
|
||||||
|
* `.parse()` implicitly uses `process.argv` if arguments not specified ([#1172])
|
||||||
|
* optionally specify where `.parse()` arguments "from", if not following node conventions ([#512] [#1172])
|
||||||
|
* suggest help option along with unknown command error ([#1179])
|
||||||
|
* TypeScript definition for `commands` property of `Command` ([#1184])
|
||||||
|
* export `program` property ([#1195])
|
||||||
|
* `createCommand` factory method to simplify subclassing ([#1191])
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* preserve argument order in subcommands ([#508] [#962] [#1138])
|
||||||
|
* do not emit `command:*` for executable subcommands ([#809] [#1149])
|
||||||
|
* action handler called whether or not there are non-option arguments ([#1062] [#1149])
|
||||||
|
* combining option short flag and value in single argument now works for subcommands ([#1145])
|
||||||
|
* only add implicit help command when it will not conflict with other uses of argument ([#1153] [#1149])
|
||||||
|
* implicit help command works with command aliases ([#948] [#1149])
|
||||||
|
* options are validated whether or not there is an action handler ([#1149])
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* *Breaking* `.args` contains command arguments with just recognised options removed ([#1032] [#1138])
|
||||||
|
* *Breaking* display error if required argument for command is missing ([#995] [#1149])
|
||||||
|
* tighten TypeScript definition of custom option processing function passed to `.option()` ([#1119])
|
||||||
|
* *Breaking* `.allowUnknownOption()` ([#802] [#1138])
|
||||||
|
* unknown options included in arguments passed to command action handler
|
||||||
|
* unknown options included in `.args`
|
||||||
|
* only recognised option short flags and long flags are expanded (e.g. `-ab` or `--foo=bar`) ([#1145])
|
||||||
|
* *Breaking* `.parseOptions()` ([#1138])
|
||||||
|
* `args` in returned result renamed `operands` and does not include anything after first unknown option
|
||||||
|
* `unknown` in returned result has arguments after first unknown option including operands, not just options and values
|
||||||
|
* *Breaking* `.on('command:*', callback)` and other command events passed (changed) results from `.parseOptions`, i.e. operands and unknown ([#1138])
|
||||||
|
* refactor Option from prototype to class ([#1133])
|
||||||
|
* refactor Command from prototype to class ([#1159])
|
||||||
|
* changes to error handling ([#1165])
|
||||||
|
* throw for author error, not just display message
|
||||||
|
* preflight for variadic error
|
||||||
|
* add tips to missing subcommand executable
|
||||||
|
* TypeScript fluent return types changed to be more subclass friendly, return `this` rather than `Command` ([#1180])
|
||||||
|
* `.parseAsync` returns `Promise<this>` to be consistent with `.parse()` ([#1180])
|
||||||
|
* update dependencies
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
* removed EventEmitter from TypeScript definition for Command, eliminating implicit peer dependency on `@types/node` ([#1146])
|
||||||
|
* removed private function `normalize` (the functionality has been integrated into `parseOptions`) ([#1145])
|
||||||
|
* `parseExpectedArgs` is now private ([#1149])
|
||||||
|
|
||||||
|
### Migration Tips
|
||||||
|
|
||||||
|
If you use `.on('command:*')` or more complicated tests to detect an unrecognised subcommand, you may be able to delete the code and rely on the default behaviour.
|
||||||
|
|
||||||
|
If you use `program.args` or more complicated tests to detect a missing subcommand, you may be able to delete the code and rely on the default behaviour.
|
||||||
|
|
||||||
|
If you use `.command('*')` to add a default command, you may be be able to switch to `isDefault:true` with a named command.
|
||||||
|
|
||||||
|
If you want to continue combining short options with optional values as though they were boolean flags, set `combineFlagAndOptionalValue(false)`
|
||||||
|
to expand `-fb` to `-f -b` rather than `-f b`.
|
||||||
|
|
||||||
|
## [5.0.0-4] (2020-03-03)
|
||||||
|
|
||||||
|
(Released in 5.0.0)
|
||||||
|
|
||||||
|
## [5.0.0-3] (2020-02-20)
|
||||||
|
|
||||||
|
(Released in 5.0.0)
|
||||||
|
|
||||||
|
## [5.0.0-2] (2020-02-10)
|
||||||
|
|
||||||
|
(Released in 5.0.0)
|
||||||
|
|
||||||
|
## [5.0.0-1] (2020-02-08)
|
||||||
|
|
||||||
|
(Released in 5.0.0)
|
||||||
|
|
||||||
|
## [5.0.0-0] (2020-02-02)
|
||||||
|
|
||||||
|
(Released in 5.0.0)
|
||||||
|
|
||||||
|
## [4.1.1] (2020-02-02)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* TypeScript definition for `.action()` should include Promise for async ([#1157])
|
||||||
|
|
||||||
|
## [4.1.0] (2020-01-06)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* two routines to change how option values are handled, and eliminate name clashes with command properties ([#933] [#1102])
|
||||||
|
* see storeOptionsAsProperties and passCommandToAction in README
|
||||||
|
* `.parseAsync` to use instead of `.parse` if supply async action handlers ([#806] [#1118])
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Remove trailing blanks from wrapped help text ([#1096])
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* update dependencies
|
||||||
|
* extend security coverage for Commander 2.x to 2020-02-03
|
||||||
|
* improvements to README
|
||||||
|
* improvements to TypeScript definition documentation
|
||||||
|
* move old versions out of main CHANGELOG
|
||||||
|
* removed explicit use of `ts-node` in tests
|
||||||
|
|
||||||
|
## [4.0.1] (2019-11-12)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* display help when requested, even if there are missing required options ([#1091])
|
||||||
|
|
||||||
|
## [4.0.0] (2019-11-02)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* automatically wrap and indent help descriptions for options and commands ([#1051])
|
||||||
|
* `.exitOverride()` allows override of calls to `process.exit` for additional error handling and to keep program running ([#1040])
|
||||||
|
* support for declaring required options with `.requiredOptions()` ([#1071])
|
||||||
|
* GitHub Actions support ([#1027])
|
||||||
|
* translation links in README
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* dev: switch tests from Sinon+Should to Jest with major rewrite of tests ([#1035])
|
||||||
|
* call default subcommand even when there are unknown options ([#1047])
|
||||||
|
* *Breaking* Commander is only officially supported on Node 8 and above, and requires Node 6 ([#1053])
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* *Breaking* keep command object out of program.args when action handler called ([#1048])
|
||||||
|
* also, action handler now passed array of unknown arguments
|
||||||
|
* complain about unknown options when program argument supplied and action handler ([#1049])
|
||||||
|
* this changes parameters to `command:*` event to include unknown arguments
|
||||||
|
* removed deprecated `customFds` option from call to `child_process.spawn` ([#1052])
|
||||||
|
* rework TypeScript declarations to bring all types into imported namespace ([#1081])
|
||||||
|
|
||||||
|
### Migration Tips
|
||||||
|
|
||||||
|
#### Testing for no arguments
|
||||||
|
|
||||||
|
If you were previously using code like:
|
||||||
|
|
||||||
|
```js
|
||||||
|
if (!program.args.length) ...
|
||||||
|
```
|
||||||
|
|
||||||
|
a partial replacement is:
|
||||||
|
|
||||||
|
```js
|
||||||
|
if (program.rawArgs.length < 3) ...
|
||||||
|
```
|
||||||
|
|
||||||
|
## [4.0.0-1] Prerelease (2019-10-08)
|
||||||
|
|
||||||
|
(Released in 4.0.0)
|
||||||
|
|
||||||
|
## [4.0.0-0] Prerelease (2019-10-01)
|
||||||
|
|
||||||
|
(Released in 4.0.0)
|
||||||
|
|
||||||
|
## Older versions
|
||||||
|
|
||||||
|
* [3.x](./changelogs/CHANGELOG-3.md)
|
||||||
|
* [2.x](./changelogs/CHANGELOG-2.md)
|
||||||
|
* [1.x](./changelogs/CHANGELOG-1.md)
|
||||||
|
* [0.x](./changelogs/CHANGELOG-0.md)
|
||||||
|
|
||||||
|
[#1]: https://github.com/tj/commander.js/issues/1
|
||||||
|
[#432]: https://github.com/tj/commander.js/issues/432
|
||||||
|
[#508]: https://github.com/tj/commander.js/issues/508
|
||||||
|
[#512]: https://github.com/tj/commander.js/issues/512
|
||||||
|
[#531]: https://github.com/tj/commander.js/issues/531
|
||||||
|
[#645]: https://github.com/tj/commander.js/issues/645
|
||||||
|
[#742]: https://github.com/tj/commander.js/issues/742
|
||||||
|
[#764]: https://github.com/tj/commander.js/issues/764
|
||||||
|
[#802]: https://github.com/tj/commander.js/issues/802
|
||||||
|
[#806]: https://github.com/tj/commander.js/issues/806
|
||||||
|
[#809]: https://github.com/tj/commander.js/issues/809
|
||||||
|
[#948]: https://github.com/tj/commander.js/issues/948
|
||||||
|
[#962]: https://github.com/tj/commander.js/issues/962
|
||||||
|
[#995]: https://github.com/tj/commander.js/issues/995
|
||||||
|
[#1027]: https://github.com/tj/commander.js/pull/1027
|
||||||
|
[#1032]: https://github.com/tj/commander.js/issues/1032
|
||||||
|
[#1035]: https://github.com/tj/commander.js/pull/1035
|
||||||
|
[#1040]: https://github.com/tj/commander.js/pull/1040
|
||||||
|
[#1047]: https://github.com/tj/commander.js/pull/1047
|
||||||
|
[#1048]: https://github.com/tj/commander.js/pull/1048
|
||||||
|
[#1049]: https://github.com/tj/commander.js/pull/1049
|
||||||
|
[#1051]: https://github.com/tj/commander.js/pull/1051
|
||||||
|
[#1052]: https://github.com/tj/commander.js/pull/1052
|
||||||
|
[#1053]: https://github.com/tj/commander.js/pull/1053
|
||||||
|
[#1062]: https://github.com/tj/commander.js/pull/1062
|
||||||
|
[#1071]: https://github.com/tj/commander.js/pull/1071
|
||||||
|
[#1081]: https://github.com/tj/commander.js/pull/1081
|
||||||
|
[#1088]: https://github.com/tj/commander.js/issues/1088
|
||||||
|
[#1091]: https://github.com/tj/commander.js/pull/1091
|
||||||
|
[#1096]: https://github.com/tj/commander.js/pull/1096
|
||||||
|
[#1102]: https://github.com/tj/commander.js/pull/1102
|
||||||
|
[#1118]: https://github.com/tj/commander.js/pull/1118
|
||||||
|
[#1119]: https://github.com/tj/commander.js/pull/1119
|
||||||
|
[#1133]: https://github.com/tj/commander.js/pull/1133
|
||||||
|
[#1138]: https://github.com/tj/commander.js/pull/1138
|
||||||
|
[#1145]: https://github.com/tj/commander.js/pull/1145
|
||||||
|
[#1146]: https://github.com/tj/commander.js/pull/1146
|
||||||
|
[#1149]: https://github.com/tj/commander.js/pull/1149
|
||||||
|
[#1153]: https://github.com/tj/commander.js/issues/1153
|
||||||
|
[#1157]: https://github.com/tj/commander.js/pull/1157
|
||||||
|
[#1159]: https://github.com/tj/commander.js/pull/1159
|
||||||
|
[#1165]: https://github.com/tj/commander.js/pull/1165
|
||||||
|
[#1169]: https://github.com/tj/commander.js/pull/1169
|
||||||
|
[#1172]: https://github.com/tj/commander.js/pull/1172
|
||||||
|
[#1179]: https://github.com/tj/commander.js/pull/1179
|
||||||
|
[#1180]: https://github.com/tj/commander.js/pull/1180
|
||||||
|
[#1184]: https://github.com/tj/commander.js/pull/1184
|
||||||
|
[#1191]: https://github.com/tj/commander.js/pull/1191
|
||||||
|
[#1195]: https://github.com/tj/commander.js/pull/1195
|
||||||
|
[#1208]: https://github.com/tj/commander.js/pull/1208
|
||||||
|
[#1232]: https://github.com/tj/commander.js/pull/1232
|
||||||
|
[#1235]: https://github.com/tj/commander.js/pull/1235
|
||||||
|
[#1236]: https://github.com/tj/commander.js/pull/1236
|
||||||
|
[#1247]: https://github.com/tj/commander.js/pull/1247
|
||||||
|
[#1248]: https://github.com/tj/commander.js/pull/1248
|
||||||
|
[#1250]: https://github.com/tj/commander.js/pull/1250
|
||||||
|
[#1256]: https://github.com/tj/commander.js/pull/1256
|
||||||
|
[#1275]: https://github.com/tj/commander.js/pull/1275
|
||||||
|
[#1301]: https://github.com/tj/commander.js/issues/1301
|
||||||
|
[#1306]: https://github.com/tj/commander.js/pull/1306
|
||||||
|
[#1312]: https://github.com/tj/commander.js/pull/1312
|
||||||
|
[#1322]: https://github.com/tj/commander.js/pull/1322
|
||||||
|
[#1323]: https://github.com/tj/commander.js/pull/1323
|
||||||
|
[#1325]: https://github.com/tj/commander.js/pull/1325
|
||||||
|
[#1326]: https://github.com/tj/commander.js/pull/1326
|
||||||
|
[#1332]: https://github.com/tj/commander.js/pull/1332
|
||||||
|
[#1353]: https://github.com/tj/commander.js/pull/1353
|
||||||
|
[#1360]: https://github.com/tj/commander.js/pull/1360
|
||||||
|
[#1361]: https://github.com/tj/commander.js/pull/1361
|
||||||
|
[#1368]: https://github.com/tj/commander.js/pull/1368
|
||||||
|
[#1375]: https://github.com/tj/commander.js/pull/1375
|
||||||
|
[#1390]: https://github.com/tj/commander.js/pull/1390
|
||||||
|
|
||||||
|
[Unreleased]: https://github.com/tj/commander.js/compare/master...develop
|
||||||
|
[6.2.1]: https://github.com/tj/commander.js/compare/v6.2.0..v6.2.1
|
||||||
|
[6.2.0]: https://github.com/tj/commander.js/compare/v6.1.0..v6.2.0
|
||||||
|
[6.1.0]: https://github.com/tj/commander.js/compare/v6.0.0..v6.1.0
|
||||||
|
[6.0.0]: https://github.com/tj/commander.js/compare/v5.1.0..v6.0.0
|
||||||
|
[6.0.0-0]: https://github.com/tj/commander.js/compare/v5.1.0..v6.0.0-0
|
||||||
|
[5.1.0]: https://github.com/tj/commander.js/compare/v5.0.0..v5.1.0
|
||||||
|
[5.0.0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0
|
||||||
|
[5.0.0-4]: https://github.com/tj/commander.js/compare/v5.0.0-3..v5.0.0-4
|
||||||
|
[5.0.0-3]: https://github.com/tj/commander.js/compare/v5.0.0-2..v5.0.0-3
|
||||||
|
[5.0.0-2]: https://github.com/tj/commander.js/compare/v5.0.0-1..v5.0.0-2
|
||||||
|
[5.0.0-1]: https://github.com/tj/commander.js/compare/v5.0.0-0..v5.0.0-1
|
||||||
|
[5.0.0-0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0-0
|
||||||
|
[4.1.1]: https://github.com/tj/commander.js/compare/v4.1.0..v4.1.1
|
||||||
|
[4.1.0]: https://github.com/tj/commander.js/compare/v4.0.1..v4.1.0
|
||||||
|
[4.0.1]: https://github.com/tj/commander.js/compare/v4.0.0..v4.0.1
|
||||||
|
[4.0.0]: https://github.com/tj/commander.js/compare/v3.0.2..v4.0.0
|
||||||
|
[4.0.0-1]: https://github.com/tj/commander.js/compare/v4.0.0-0..v4.0.0-1
|
||||||
|
[4.0.0-0]: https://github.com/tj/commander.js/compare/v3.0.2...v4.0.0-0
|
22
node_modules/commander/LICENSE
generated
vendored
Normal file
22
node_modules/commander/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
791
node_modules/commander/Readme.md
generated
vendored
Normal file
791
node_modules/commander/Readme.md
generated
vendored
Normal file
|
@ -0,0 +1,791 @@
|
||||||
|
# Commander.js
|
||||||
|
|
||||||
|
[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js)
|
||||||
|
[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
|
||||||
|
[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)
|
||||||
|
[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)
|
||||||
|
|
||||||
|
The complete solution for [node.js](http://nodejs.org) command-line interfaces.
|
||||||
|
|
||||||
|
Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
|
||||||
|
|
||||||
|
- [Commander.js](#commanderjs)
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Declaring _program_ variable](#declaring-program-variable)
|
||||||
|
- [Options](#options)
|
||||||
|
- [Common option types, boolean and value](#common-option-types-boolean-and-value)
|
||||||
|
- [Default option value](#default-option-value)
|
||||||
|
- [Other option types, negatable boolean and boolean|value](#other-option-types-negatable-boolean-and-booleanvalue)
|
||||||
|
- [Custom option processing](#custom-option-processing)
|
||||||
|
- [Required option](#required-option)
|
||||||
|
- [Variadic option](#variadic-option)
|
||||||
|
- [Version option](#version-option)
|
||||||
|
- [Commands](#commands)
|
||||||
|
- [Specify the argument syntax](#specify-the-argument-syntax)
|
||||||
|
- [Action handler (sub)commands](#action-handler-subcommands)
|
||||||
|
- [Stand-alone executable (sub)commands](#stand-alone-executable-subcommands)
|
||||||
|
- [Automated help](#automated-help)
|
||||||
|
- [Custom help](#custom-help)
|
||||||
|
- [.usage and .name](#usage-and-name)
|
||||||
|
- [.help(cb)](#helpcb)
|
||||||
|
- [.outputHelp(cb)](#outputhelpcb)
|
||||||
|
- [.helpInformation()](#helpinformation)
|
||||||
|
- [.helpOption(flags, description)](#helpoptionflags-description)
|
||||||
|
- [.addHelpCommand()](#addhelpcommand)
|
||||||
|
- [Custom event listeners](#custom-event-listeners)
|
||||||
|
- [Bits and pieces](#bits-and-pieces)
|
||||||
|
- [.parse() and .parseAsync()](#parse-and-parseasync)
|
||||||
|
- [Avoiding option name clashes](#avoiding-option-name-clashes)
|
||||||
|
- [TypeScript](#typescript)
|
||||||
|
- [createCommand()](#createcommand)
|
||||||
|
- [Import into ECMAScript Module](#import-into-ecmascript-module)
|
||||||
|
- [Node options such as `--harmony`](#node-options-such-as---harmony)
|
||||||
|
- [Debugging stand-alone executable subcommands](#debugging-stand-alone-executable-subcommands)
|
||||||
|
- [Override exit handling](#override-exit-handling)
|
||||||
|
- [Examples](#examples)
|
||||||
|
- [Support](#support)
|
||||||
|
- [Commander for enterprise](#commander-for-enterprise)
|
||||||
|
|
||||||
|
For information about terms used in this document see: [terminology](./docs/terminology.md)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install commander
|
||||||
|
```
|
||||||
|
|
||||||
|
## Declaring _program_ variable
|
||||||
|
|
||||||
|
Commander exports a global object which is convenient for quick programs.
|
||||||
|
This is used in the examples in this README for brevity.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { program } = require('commander');
|
||||||
|
program.version('0.0.1');
|
||||||
|
```
|
||||||
|
|
||||||
|
For larger programs which may use commander in multiple ways, including unit testing, it is better to create a local Command object to use.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Command } = require('commander');
|
||||||
|
const program = new Command();
|
||||||
|
program.version('0.0.1');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
Options are defined with the `.option()` method, also serving as documentation for the options. Each option can have a short flag (single character) and a long name, separated by a comma or space or vertical bar ('|').
|
||||||
|
|
||||||
|
The options can be accessed as properties on the Command object. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. See also optional new behaviour to [avoid name clashes](#avoiding-option-name-clashes).
|
||||||
|
|
||||||
|
Multiple short flags may optionally be combined in a single argument following the dash: boolean flags, followed by a single option taking a value (possibly followed by the value).
|
||||||
|
For example `-a -b -p 80` may be written as `-ab -p80` or even `-abp80`.
|
||||||
|
|
||||||
|
You can use `--` to indicate the end of the options, and any remaining arguments will be used without being interpreted.
|
||||||
|
|
||||||
|
Options on the command line are not positional, and can be specified before or after other arguments.
|
||||||
|
|
||||||
|
### Common option types, boolean and value
|
||||||
|
|
||||||
|
The two most used option types are a boolean option, and an option which takes its value
|
||||||
|
from the following argument (declared with angle brackets like `--expect <value>`). Both are `undefined` unless specified on command line.
|
||||||
|
|
||||||
|
Example file: [options-common.js](./examples/options-common.js)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.option('-d, --debug', 'output extra debugging')
|
||||||
|
.option('-s, --small', 'small pizza size')
|
||||||
|
.option('-p, --pizza-type <type>', 'flavour of pizza');
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
if (program.debug) console.log(program.opts());
|
||||||
|
console.log('pizza details:');
|
||||||
|
if (program.small) console.log('- small pizza size');
|
||||||
|
if (program.pizzaType) console.log(`- ${program.pizzaType}`);
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pizza-options -d
|
||||||
|
{ debug: true, small: undefined, pizzaType: undefined }
|
||||||
|
pizza details:
|
||||||
|
$ pizza-options -p
|
||||||
|
error: option '-p, --pizza-type <type>' argument missing
|
||||||
|
$ pizza-options -ds -p vegetarian
|
||||||
|
{ debug: true, small: true, pizzaType: 'vegetarian' }
|
||||||
|
pizza details:
|
||||||
|
- small pizza size
|
||||||
|
- vegetarian
|
||||||
|
$ pizza-options --pizza-type=cheese
|
||||||
|
pizza details:
|
||||||
|
- cheese
|
||||||
|
```
|
||||||
|
|
||||||
|
`program.parse(arguments)` processes the arguments, leaving any args not consumed by the program options in the `program.args` array.
|
||||||
|
|
||||||
|
### Default option value
|
||||||
|
|
||||||
|
You can specify a default value for an option which takes a value.
|
||||||
|
|
||||||
|
Example file: [options-defaults.js](./examples/options-defaults.js)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.option('-c, --cheese <type>', 'add the specified type of cheese', 'blue');
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
console.log(`cheese: ${program.cheese}`);
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pizza-options
|
||||||
|
cheese: blue
|
||||||
|
$ pizza-options --cheese stilton
|
||||||
|
cheese: stilton
|
||||||
|
```
|
||||||
|
|
||||||
|
### Other option types, negatable boolean and boolean|value
|
||||||
|
|
||||||
|
You can define a boolean option long name with a leading `no-` to set the option value to false when used.
|
||||||
|
Defined alone this also makes the option true by default.
|
||||||
|
|
||||||
|
If you define `--foo` first, adding `--no-foo` does not change the default value from what it would
|
||||||
|
otherwise be. You can specify a default boolean value for a boolean option and it can be overridden on command line.
|
||||||
|
|
||||||
|
Example file: [options-negatable.js](./examples/options-negatable.js)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.option('--no-sauce', 'Remove sauce')
|
||||||
|
.option('--cheese <flavour>', 'cheese flavour', 'mozzarella')
|
||||||
|
.option('--no-cheese', 'plain with no cheese')
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
const sauceStr = program.sauce ? 'sauce' : 'no sauce';
|
||||||
|
const cheeseStr = (program.cheese === false) ? 'no cheese' : `${program.cheese} cheese`;
|
||||||
|
console.log(`You ordered a pizza with ${sauceStr} and ${cheeseStr}`);
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pizza-options
|
||||||
|
You ordered a pizza with sauce and mozzarella cheese
|
||||||
|
$ pizza-options --sauce
|
||||||
|
error: unknown option '--sauce'
|
||||||
|
$ pizza-options --cheese=blue
|
||||||
|
You ordered a pizza with sauce and blue cheese
|
||||||
|
$ pizza-options --no-sauce --no-cheese
|
||||||
|
You ordered a pizza with no sauce and no cheese
|
||||||
|
```
|
||||||
|
|
||||||
|
You can specify an option which may be used as a boolean option but may optionally take an option-argument
|
||||||
|
(declared with square brackets like `--optional [value]`).
|
||||||
|
|
||||||
|
Example file: [options-boolean-or-value.js](./examples/options-boolean-or-value.js)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.option('-c, --cheese [type]', 'Add cheese with optional type');
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
if (program.cheese === undefined) console.log('no cheese');
|
||||||
|
else if (program.cheese === true) console.log('add cheese');
|
||||||
|
else console.log(`add cheese type ${program.cheese}`);
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pizza-options
|
||||||
|
no cheese
|
||||||
|
$ pizza-options --cheese
|
||||||
|
add cheese
|
||||||
|
$ pizza-options --cheese mozzarella
|
||||||
|
add cheese type mozzarella
|
||||||
|
```
|
||||||
|
|
||||||
|
For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).
|
||||||
|
|
||||||
|
### Custom option processing
|
||||||
|
|
||||||
|
You may specify a function to do custom processing of option-arguments. The callback function receives two parameters,
|
||||||
|
the user specified option-argument and the previous value for the option. It returns the new value for the option.
|
||||||
|
|
||||||
|
This allows you to coerce the option-argument to the desired type, or accumulate values, or do entirely custom processing.
|
||||||
|
|
||||||
|
You can optionally specify the default/starting value for the option after the function parameter.
|
||||||
|
|
||||||
|
Example file: [options-custom-processing.js](./examples/options-custom-processing.js)
|
||||||
|
|
||||||
|
```js
|
||||||
|
function myParseInt(value, dummyPrevious) {
|
||||||
|
// parseInt takes a string and an optional radix
|
||||||
|
return parseInt(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function increaseVerbosity(dummyValue, previous) {
|
||||||
|
return previous + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function collect(value, previous) {
|
||||||
|
return previous.concat([value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function commaSeparatedList(value, dummyPrevious) {
|
||||||
|
return value.split(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
program
|
||||||
|
.option('-f, --float <number>', 'float argument', parseFloat)
|
||||||
|
.option('-i, --integer <number>', 'integer argument', myParseInt)
|
||||||
|
.option('-v, --verbose', 'verbosity that can be increased', increaseVerbosity, 0)
|
||||||
|
.option('-c, --collect <value>', 'repeatable value', collect, [])
|
||||||
|
.option('-l, --list <items>', 'comma separated list', commaSeparatedList)
|
||||||
|
;
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
if (program.float !== undefined) console.log(`float: ${program.float}`);
|
||||||
|
if (program.integer !== undefined) console.log(`integer: ${program.integer}`);
|
||||||
|
if (program.verbose > 0) console.log(`verbosity: ${program.verbose}`);
|
||||||
|
if (program.collect.length > 0) console.log(program.collect);
|
||||||
|
if (program.list !== undefined) console.log(program.list);
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ custom -f 1e2
|
||||||
|
float: 100
|
||||||
|
$ custom --integer 2
|
||||||
|
integer: 2
|
||||||
|
$ custom -v -v -v
|
||||||
|
verbose: 3
|
||||||
|
$ custom -c a -c b -c c
|
||||||
|
[ 'a', 'b', 'c' ]
|
||||||
|
$ custom --list x,y,z
|
||||||
|
[ 'x', 'y', 'z' ]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Required option
|
||||||
|
|
||||||
|
You may specify a required (mandatory) option using `.requiredOption`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option` in format, taking flags and description, and optional default value or custom processing.
|
||||||
|
|
||||||
|
Example file: [options-required.js](./examples/options-required.js)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.requiredOption('-c, --cheese <type>', 'pizza must have cheese');
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pizza
|
||||||
|
error: required option '-c, --cheese <type>' not specified
|
||||||
|
```
|
||||||
|
|
||||||
|
### Variadic option
|
||||||
|
|
||||||
|
You may make an option variadic by appending `...` to the value placeholder when declaring the option. On the command line you
|
||||||
|
can then specify multiple option-arguments, and the parsed option value will be an array. The extra arguments
|
||||||
|
are read until the first argument starting with a dash. The special argument `--` stops option processing entirely. If a value
|
||||||
|
is specified in the same argument as the option then no further values are read.
|
||||||
|
|
||||||
|
Example file: [options-variadic.js](./examples/options-variadic.js)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.option('-n, --number <numbers...>', 'specify numbers')
|
||||||
|
.option('-l, --letter [letters...]', 'specify letters');
|
||||||
|
|
||||||
|
program.parse();
|
||||||
|
|
||||||
|
console.log('Options: ', program.opts());
|
||||||
|
console.log('Remaining arguments: ', program.args);
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ collect -n 1 2 3 --letter a b c
|
||||||
|
Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] }
|
||||||
|
Remaining arguments: []
|
||||||
|
$ collect --letter=A -n80 operand
|
||||||
|
Options: { number: [ '80' ], letter: [ 'A' ] }
|
||||||
|
Remaining arguments: [ 'operand' ]
|
||||||
|
$ collect --letter -n 1 -n 2 3 -- operand
|
||||||
|
Options: { number: [ '1', '2', '3' ], letter: true }
|
||||||
|
Remaining arguments: [ 'operand' ]
|
||||||
|
```
|
||||||
|
|
||||||
|
For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).
|
||||||
|
|
||||||
|
### Version option
|
||||||
|
|
||||||
|
The optional `version` method adds handling for displaying the command version. The default option flags are `-V` and `--version`, and when present the command prints the version number and exits.
|
||||||
|
|
||||||
|
```js
|
||||||
|
program.version('0.0.1');
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ ./examples/pizza -V
|
||||||
|
0.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
You may change the flags and description by passing additional parameters to the `version` method, using
|
||||||
|
the same syntax for flags as the `option` method.
|
||||||
|
|
||||||
|
```js
|
||||||
|
program.version('0.0.1', '-v, --vers', 'output the current version');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
You can specify (sub)commands using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an action handler attached to the command, or as a stand-alone executable file (described in more detail later). The subcommands may be nested ([example](./examples/nestedCommands.js)).
|
||||||
|
|
||||||
|
In the first parameter to `.command()` you specify the command name and any command-arguments. The arguments may be `<required>` or `[optional]`, and the last argument may also be `variadic...`.
|
||||||
|
|
||||||
|
You can use `.addCommand()` to add an already configured subcommand to the program.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Command implemented using action handler (description is supplied separately to `.command`)
|
||||||
|
// Returns new command for configuring.
|
||||||
|
program
|
||||||
|
.command('clone <source> [destination]')
|
||||||
|
.description('clone a repository into a newly created directory')
|
||||||
|
.action((source, destination) => {
|
||||||
|
console.log('clone command called');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Command implemented using stand-alone executable file (description is second parameter to `.command`)
|
||||||
|
// Returns `this` for adding more commands.
|
||||||
|
program
|
||||||
|
.command('start <service>', 'start named service')
|
||||||
|
.command('stop [service]', 'stop named service, or all if no name supplied');
|
||||||
|
|
||||||
|
// Command prepared separately.
|
||||||
|
// Returns `this` for adding more commands.
|
||||||
|
program
|
||||||
|
.addCommand(build.makeBuildCommand());
|
||||||
|
```
|
||||||
|
|
||||||
|
Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will
|
||||||
|
remove the command from the generated help output. Specifying `isDefault: true` will run the subcommand if no other
|
||||||
|
subcommand is specified ([example](./examples/defaultCommand.js)).
|
||||||
|
|
||||||
|
### Specify the argument syntax
|
||||||
|
|
||||||
|
You use `.arguments` to specify the expected command-arguments for the top-level command, and for subcommands they are usually
|
||||||
|
included in the `.command` call. Angled brackets (e.g. `<required>`) indicate required command-arguments.
|
||||||
|
Square brackets (e.g. `[optional]`) indicate optional command-arguments.
|
||||||
|
You can optionally describe the arguments in the help by supplying a hash as second parameter to `.description()`.
|
||||||
|
|
||||||
|
Example file: [env](./examples/env)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.arguments('<cmd> [env]')
|
||||||
|
.description('test command', {
|
||||||
|
cmd: 'command to run',
|
||||||
|
env: 'environment to run test in'
|
||||||
|
})
|
||||||
|
.action(function (cmd, env) {
|
||||||
|
console.log('command:', cmd);
|
||||||
|
console.log('environment:', env || 'no environment given');
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
The last argument of a command can be variadic, and only the last argument. To make an argument variadic you
|
||||||
|
append `...` to the argument name. For example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { program } = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.command('rmdir <dir> [otherDirs...]')
|
||||||
|
.action(function (dir, otherDirs) {
|
||||||
|
console.log('rmdir %s', dir);
|
||||||
|
if (otherDirs) {
|
||||||
|
otherDirs.forEach(function (oDir) {
|
||||||
|
console.log('rmdir %s', oDir);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
The variadic argument is passed to the action handler as an array.
|
||||||
|
|
||||||
|
### Action handler (sub)commands
|
||||||
|
|
||||||
|
You can add options to a command that uses an action handler.
|
||||||
|
The action handler gets passed a parameter for each argument you declared, and one additional argument which is the
|
||||||
|
command object itself. This command argument has the values for the command-specific options added as properties.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { program } = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('rm <dir>')
|
||||||
|
.option('-r, --recursive', 'Remove recursively')
|
||||||
|
.action(function (dir, cmdObj) {
|
||||||
|
console.log('remove ' + dir + (cmdObj.recursive ? ' recursively' : ''))
|
||||||
|
})
|
||||||
|
|
||||||
|
program.parse(process.argv)
|
||||||
|
```
|
||||||
|
|
||||||
|
You may supply an `async` action handler, in which case you call `.parseAsync` rather than `.parse`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
async function run() { /* code goes here */ }
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
program
|
||||||
|
.command('run')
|
||||||
|
.action(run);
|
||||||
|
await program.parseAsync(process.argv);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
A command's options on the command line are validated when the command is used. Any unknown options will be reported as an error.
|
||||||
|
|
||||||
|
### Stand-alone executable (sub)commands
|
||||||
|
|
||||||
|
When `.command()` is invoked with a description argument, this tells Commander that you're going to use stand-alone executables for subcommands.
|
||||||
|
Commander will search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-subcommand`, like `pm-install`, `pm-search`.
|
||||||
|
You can specify a custom name with the `executableFile` configuration option.
|
||||||
|
|
||||||
|
You handle the options for an executable (sub)command in the executable, and don't declare them at the top-level.
|
||||||
|
|
||||||
|
Example file: [pm](./examples/pm)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.command('install [name]', 'install one or more packages')
|
||||||
|
.command('search [query]', 'search with optional query')
|
||||||
|
.command('update', 'update installed packages', { executableFile: 'myUpdateSubCommand' })
|
||||||
|
.command('list', 'list packages installed', { isDefault: true });
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
|
||||||
|
|
||||||
|
## Automated help
|
||||||
|
|
||||||
|
The help information is auto-generated based on the information commander already knows about your program. The default
|
||||||
|
help option is `-h,--help`.
|
||||||
|
|
||||||
|
Example file: [pizza](./examples/pizza)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ node ./examples/pizza --help
|
||||||
|
Usage: pizza [options]
|
||||||
|
|
||||||
|
An application for pizzas ordering
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-V, --version output the version number
|
||||||
|
-p, --peppers Add peppers
|
||||||
|
-c, --cheese <type> Add the specified type of cheese (default: "marble")
|
||||||
|
-C, --no-cheese You do not want any cheese
|
||||||
|
-h, --help display help for command
|
||||||
|
```
|
||||||
|
|
||||||
|
A `help` command is added by default if your command has subcommands. It can be used alone, or with a subcommand name to show
|
||||||
|
further help for the subcommand. These are effectively the same if the `shell` program has implicit help:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
shell help
|
||||||
|
shell --help
|
||||||
|
|
||||||
|
shell help spawn
|
||||||
|
shell spawn --help
|
||||||
|
```
|
||||||
|
|
||||||
|
### Custom help
|
||||||
|
|
||||||
|
You can display extra information by listening for "--help".
|
||||||
|
|
||||||
|
Example file: [custom-help](./examples/custom-help)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.option('-f, --foo', 'enable some foo');
|
||||||
|
|
||||||
|
// must be before .parse()
|
||||||
|
program.on('--help', () => {
|
||||||
|
console.log('');
|
||||||
|
console.log('Example call:');
|
||||||
|
console.log(' $ custom-help --help');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Yields the following help output:
|
||||||
|
|
||||||
|
```Text
|
||||||
|
Usage: custom-help [options]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-f, --foo enable some foo
|
||||||
|
-h, --help display help for command
|
||||||
|
|
||||||
|
Example call:
|
||||||
|
$ custom-help --help
|
||||||
|
```
|
||||||
|
|
||||||
|
### .usage and .name
|
||||||
|
|
||||||
|
These allow you to customise the usage description in the first line of the help. The name is otherwise
|
||||||
|
deduced from the (full) program arguments. Given:
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.name("my-command")
|
||||||
|
.usage("[global options] command")
|
||||||
|
```
|
||||||
|
|
||||||
|
The help will start with:
|
||||||
|
|
||||||
|
```Text
|
||||||
|
Usage: my-command [global options] command
|
||||||
|
```
|
||||||
|
|
||||||
|
### .help(cb)
|
||||||
|
|
||||||
|
Output help information and exit immediately. Optional callback cb allows post-processing of help text before it is displayed.
|
||||||
|
|
||||||
|
### .outputHelp(cb)
|
||||||
|
|
||||||
|
Output help information without exiting.
|
||||||
|
Optional callback cb allows post-processing of help text before it is displayed.
|
||||||
|
|
||||||
|
### .helpInformation()
|
||||||
|
|
||||||
|
Get the command help information as a string for processing or displaying yourself. (The text does not include the custom help
|
||||||
|
from `--help` listeners.)
|
||||||
|
|
||||||
|
### .helpOption(flags, description)
|
||||||
|
|
||||||
|
Override the default help flags and description. Pass false to disable the built-in help option.
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.helpOption('-e, --HELP', 'read more information');
|
||||||
|
```
|
||||||
|
|
||||||
|
### .addHelpCommand()
|
||||||
|
|
||||||
|
You can explicitly turn on or off the implicit help command with `.addHelpCommand()` and `.addHelpCommand(false)`.
|
||||||
|
|
||||||
|
You can both turn on and customise the help command by supplying the name and description:
|
||||||
|
|
||||||
|
```js
|
||||||
|
program.addHelpCommand('assist [command]', 'show assistance');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom event listeners
|
||||||
|
|
||||||
|
You can execute custom actions by listening to command and option events.
|
||||||
|
|
||||||
|
```js
|
||||||
|
program.on('option:verbose', function () {
|
||||||
|
process.env.VERBOSE = this.verbose;
|
||||||
|
});
|
||||||
|
|
||||||
|
program.on('command:*', function (operands) {
|
||||||
|
console.error(`error: unknown command '${operands[0]}'`);
|
||||||
|
const availableCommands = program.commands.map(cmd => cmd.name());
|
||||||
|
mySuggestBestMatch(operands[0], availableCommands);
|
||||||
|
process.exitCode = 1;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Bits and pieces
|
||||||
|
|
||||||
|
### .parse() and .parseAsync()
|
||||||
|
|
||||||
|
The first argument to `.parse` is the array of strings to parse. You may omit the parameter to implicitly use `process.argv`.
|
||||||
|
|
||||||
|
If the arguments follow different conventions than node you can pass a `from` option in the second parameter:
|
||||||
|
|
||||||
|
- 'node': default, `argv[0]` is the application and `argv[1]` is the script being run, with user parameters after that
|
||||||
|
- 'electron': `argv[1]` varies depending on whether the electron application is packaged
|
||||||
|
- 'user': all of the arguments from the user
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
program.parse(process.argv); // Explicit, node conventions
|
||||||
|
program.parse(); // Implicit, and auto-detect electron
|
||||||
|
program.parse(['-f', 'filename'], { from: 'user' });
|
||||||
|
```
|
||||||
|
|
||||||
|
### Avoiding option name clashes
|
||||||
|
|
||||||
|
The original and default behaviour is that the option values are stored
|
||||||
|
as properties on the program, and the action handler is passed a
|
||||||
|
command object with the options values stored as properties.
|
||||||
|
This is very convenient to code, but the downside is possible clashes with
|
||||||
|
existing properties of Command.
|
||||||
|
|
||||||
|
There are two new routines to change the behaviour, and the default behaviour may change in the future:
|
||||||
|
|
||||||
|
- `storeOptionsAsProperties`: whether to store option values as properties on command object, or store separately (specify false) and access using `.opts()`
|
||||||
|
- `passCommandToAction`: whether to pass command to action handler,
|
||||||
|
or just the options (specify false)
|
||||||
|
|
||||||
|
Example file: [storeOptionsAsProperties-action.js](./examples/storeOptionsAsProperties-action.js)
|
||||||
|
|
||||||
|
```js
|
||||||
|
program
|
||||||
|
.storeOptionsAsProperties(false)
|
||||||
|
.passCommandToAction(false);
|
||||||
|
|
||||||
|
program
|
||||||
|
.name('my-program-name')
|
||||||
|
.option('-n,--name <name>');
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('show')
|
||||||
|
.option('-a,--action <action>')
|
||||||
|
.action((options) => {
|
||||||
|
console.log(options.action);
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
const programOptions = program.opts();
|
||||||
|
console.log(programOptions.name);
|
||||||
|
```
|
||||||
|
|
||||||
|
### TypeScript
|
||||||
|
|
||||||
|
The Commander package includes its TypeScript Definition file.
|
||||||
|
|
||||||
|
If you use `ts-node` and stand-alone executable subcommands written as `.ts` files, you need to call your program through node to get the subcommands called correctly. e.g.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node -r ts-node/register pm.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
### createCommand()
|
||||||
|
|
||||||
|
This factory function creates a new command. It is exported and may be used instead of using `new`, like:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { createCommand } = require('commander');
|
||||||
|
const program = createCommand();
|
||||||
|
```
|
||||||
|
|
||||||
|
`createCommand` is also a method of the Command object, and creates a new command rather than a subcommand. This gets used internally
|
||||||
|
when creating subcommands using `.command()`, and you may override it to
|
||||||
|
customise the new subcommand (examples using [subclass](./examples/custom-command-class.js) and [function](./examples/custom-command-function.js)).
|
||||||
|
|
||||||
|
### Import into ECMAScript Module
|
||||||
|
|
||||||
|
Commander is currently a CommonJS package, and the default export can be imported into an ES Module:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// index.mjs
|
||||||
|
import commander from 'commander';
|
||||||
|
const program = commander.program;
|
||||||
|
const newCommand = new commander.Command();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Node options such as `--harmony`
|
||||||
|
|
||||||
|
You can enable `--harmony` option in two ways:
|
||||||
|
|
||||||
|
- Use `#! /usr/bin/env node --harmony` in the subcommands scripts. (Note Windows does not support this pattern.)
|
||||||
|
- Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning subcommand process.
|
||||||
|
|
||||||
|
### Debugging stand-alone executable subcommands
|
||||||
|
|
||||||
|
An executable subcommand is launched as a separate child process.
|
||||||
|
|
||||||
|
If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al,
|
||||||
|
the inspector port is incremented by 1 for the spawned subcommand.
|
||||||
|
|
||||||
|
If you are using VSCode to debug executable subcommands you need to set the `"autoAttachChildProcesses": true` flag in your launch.json configuration.
|
||||||
|
|
||||||
|
### Override exit handling
|
||||||
|
|
||||||
|
By default Commander calls `process.exit` when it detects errors, or after displaying the help or version. You can override
|
||||||
|
this behaviour and optionally supply a callback. The default override throws a `CommanderError`.
|
||||||
|
|
||||||
|
The override callback is passed a `CommanderError` with properties `exitCode` number, `code` string, and `message`. The default override behaviour is to throw the error, except for async handling of executable subcommand completion which carries on. The normal display of error messages or version or help
|
||||||
|
is not affected by the override which is called after the display.
|
||||||
|
|
||||||
|
```js
|
||||||
|
program.exitOverride();
|
||||||
|
|
||||||
|
try {
|
||||||
|
program.parse(process.argv);
|
||||||
|
} catch (err) {
|
||||||
|
// custom processing...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Example file: [deploy](./examples/deploy)
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { program } = require('commander');
|
||||||
|
|
||||||
|
program
|
||||||
|
.version('0.1.0')
|
||||||
|
.option('-C, --chdir <path>', 'change the working directory')
|
||||||
|
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||||
|
.option('-T, --no-tests', 'ignore test hook');
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('setup [env]')
|
||||||
|
.description('run setup commands for all envs')
|
||||||
|
.option("-s, --setup_mode [mode]", "Which setup mode to use")
|
||||||
|
.action(function(env, options){
|
||||||
|
const mode = options.setup_mode || "normal";
|
||||||
|
env = env || 'all';
|
||||||
|
console.log('setup for %s env(s) with %s mode', env, mode);
|
||||||
|
});
|
||||||
|
|
||||||
|
program
|
||||||
|
.command('exec <cmd>')
|
||||||
|
.alias('ex')
|
||||||
|
.description('execute the given remote cmd')
|
||||||
|
.option("-e, --exec_mode <mode>", "Which exec mode to use")
|
||||||
|
.action(function(cmd, options){
|
||||||
|
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
|
||||||
|
}).on('--help', function() {
|
||||||
|
console.log('');
|
||||||
|
console.log('Examples:');
|
||||||
|
console.log('');
|
||||||
|
console.log(' $ deploy exec sequential');
|
||||||
|
console.log(' $ deploy exec async');
|
||||||
|
});
|
||||||
|
|
||||||
|
program.parse(process.argv);
|
||||||
|
```
|
||||||
|
|
||||||
|
More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
The current version of Commander is fully supported on Long Term Support versions of Node, and is likely to work with Node 6 but not tested.
|
||||||
|
(For versions of Node below Node 6, use Commander 3.x or 2.x.)
|
||||||
|
|
||||||
|
The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub.
|
||||||
|
|
||||||
|
### Commander for enterprise
|
||||||
|
|
||||||
|
Available as part of the Tidelift Subscription
|
||||||
|
|
||||||
|
The maintainers of Commander and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
1881
node_modules/commander/index.js
generated
vendored
Normal file
1881
node_modules/commander/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
51
node_modules/commander/package.json
generated
vendored
Normal file
51
node_modules/commander/package.json
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"name": "commander",
|
||||||
|
"version": "6.2.1",
|
||||||
|
"description": "the complete solution for node.js command-line programs",
|
||||||
|
"keywords": [
|
||||||
|
"commander",
|
||||||
|
"command",
|
||||||
|
"option",
|
||||||
|
"parser",
|
||||||
|
"cli",
|
||||||
|
"argument",
|
||||||
|
"args",
|
||||||
|
"argv"
|
||||||
|
],
|
||||||
|
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/tj/commander.js.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint index.js \"tests/**/*.js\"",
|
||||||
|
"typescript-lint": "eslint typings/*.ts",
|
||||||
|
"test": "jest && npm run test-typings",
|
||||||
|
"test-typings": "tsc -p tsconfig.json"
|
||||||
|
},
|
||||||
|
"main": "index",
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"typings/index.d.ts"
|
||||||
|
],
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/jest": "^26.0.15",
|
||||||
|
"@types/node": "^14.14.2",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^4.5.0",
|
||||||
|
"eslint": "^7.11.0",
|
||||||
|
"eslint-config-standard-with-typescript": "^19.0.1",
|
||||||
|
"eslint-plugin-jest": "^24.1.0",
|
||||||
|
"jest": "^26.6.0",
|
||||||
|
"standard": "^15.0.0",
|
||||||
|
"typescript": "^4.0.3"
|
||||||
|
},
|
||||||
|
"typings": "typings/index.d.ts",
|
||||||
|
"jest": {
|
||||||
|
"collectCoverage": true
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
}
|
410
node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
410
node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,410 @@
|
||||||
|
// Type definitions for commander
|
||||||
|
// Original definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
|
||||||
|
|
||||||
|
declare namespace commander {
|
||||||
|
|
||||||
|
interface CommanderError extends Error {
|
||||||
|
code: string;
|
||||||
|
exitCode: number;
|
||||||
|
message: string;
|
||||||
|
nestedError?: string;
|
||||||
|
}
|
||||||
|
type CommanderErrorConstructor = new (exitCode: number, code: string, message: string) => CommanderError;
|
||||||
|
|
||||||
|
interface Option {
|
||||||
|
flags: string;
|
||||||
|
required: boolean; // A value must be supplied when the option is specified.
|
||||||
|
optional: boolean; // A value is optional when the option is specified.
|
||||||
|
mandatory: boolean; // The option must have a value after parsing, which usually means it must be specified on command line.
|
||||||
|
bool: boolean;
|
||||||
|
short?: string;
|
||||||
|
long: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
type OptionConstructor = new (flags: string, description?: string) => Option;
|
||||||
|
|
||||||
|
interface ParseOptions {
|
||||||
|
from: 'node' | 'electron' | 'user';
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Command {
|
||||||
|
[key: string]: any; // options as properties
|
||||||
|
|
||||||
|
args: string[];
|
||||||
|
|
||||||
|
commands: Command[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the program version to `str`.
|
||||||
|
*
|
||||||
|
* This method auto-registers the "-V, --version" flag
|
||||||
|
* which will print the version number when passed.
|
||||||
|
*
|
||||||
|
* You can optionally supply the flags and description to override the defaults.
|
||||||
|
*/
|
||||||
|
version(str: string, flags?: string, description?: string): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a command, implemented using an action handler.
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* The command description is supplied using `.description`, not as a parameter to `.command`.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```ts
|
||||||
|
* program
|
||||||
|
* .command('clone <source> [destination]')
|
||||||
|
* .description('clone a repository into a newly created directory')
|
||||||
|
* .action((source, destination) => {
|
||||||
|
* console.log('clone command called');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
|
||||||
|
* @param opts - configuration options
|
||||||
|
* @returns new command
|
||||||
|
*/
|
||||||
|
command(nameAndArgs: string, opts?: CommandOptions): ReturnType<this['createCommand']>;
|
||||||
|
/**
|
||||||
|
* Define a command, implemented in a separate executable file.
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* The command description is supplied as the second parameter to `.command`.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```ts
|
||||||
|
* program
|
||||||
|
* .command('start <service>', 'start named service')
|
||||||
|
* .command('stop [service]', 'stop named service, or all if no name supplied');
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
|
||||||
|
* @param description - description of executable command
|
||||||
|
* @param opts - configuration options
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
command(nameAndArgs: string, description: string, opts?: commander.ExecutableCommandOptions): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory routine to create a new unattached command.
|
||||||
|
*
|
||||||
|
* See .command() for creating an attached subcommand, which uses this routine to
|
||||||
|
* create the command. You can override createCommand to customise subcommands.
|
||||||
|
*/
|
||||||
|
createCommand(name?: string): Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a prepared subcommand.
|
||||||
|
*
|
||||||
|
* See .command() for creating an attached subcommand which inherits settings from its parent.
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
addCommand(cmd: Command, opts?: CommandOptions): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define argument syntax for command.
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
arguments(desc: string): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override default decision whether to add implicit help command.
|
||||||
|
*
|
||||||
|
* addHelpCommand() // force on
|
||||||
|
* addHelpCommand(false); // force off
|
||||||
|
* addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
addHelpCommand(enableOrNameAndArgs?: string | boolean, description?: string): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register callback to use as replacement for calling process.exit.
|
||||||
|
*/
|
||||||
|
exitOverride(callback?: (err: CommanderError) => never|void): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register callback `fn` for the command.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* program
|
||||||
|
* .command('help')
|
||||||
|
* .description('display verbose help')
|
||||||
|
* .action(function() {
|
||||||
|
* // output help here
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
action(fn: (...args: any[]) => void | Promise<void>): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define option with `flags`, `description` and optional
|
||||||
|
* coercion `fn`.
|
||||||
|
*
|
||||||
|
* The `flags` string should contain both the short and long flags,
|
||||||
|
* separated by comma, a pipe or space. The following are all valid
|
||||||
|
* all will output this way when `--help` is used.
|
||||||
|
*
|
||||||
|
* "-p, --pepper"
|
||||||
|
* "-p|--pepper"
|
||||||
|
* "-p --pepper"
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // simple boolean defaulting to false
|
||||||
|
* program.option('-p, --pepper', 'add pepper');
|
||||||
|
*
|
||||||
|
* --pepper
|
||||||
|
* program.pepper
|
||||||
|
* // => Boolean
|
||||||
|
*
|
||||||
|
* // simple boolean defaulting to true
|
||||||
|
* program.option('-C, --no-cheese', 'remove cheese');
|
||||||
|
*
|
||||||
|
* program.cheese
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* --no-cheese
|
||||||
|
* program.cheese
|
||||||
|
* // => false
|
||||||
|
*
|
||||||
|
* // required argument
|
||||||
|
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||||
|
*
|
||||||
|
* --chdir /tmp
|
||||||
|
* program.chdir
|
||||||
|
* // => "/tmp"
|
||||||
|
*
|
||||||
|
* // optional argument
|
||||||
|
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
option(flags: string, description?: string, defaultValue?: string | boolean): this;
|
||||||
|
option(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): this;
|
||||||
|
option<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a required option, which must have a value after parsing. This usually means
|
||||||
|
* the option must be specified on the command line. (Otherwise the same as .option().)
|
||||||
|
*
|
||||||
|
* The `flags` string should contain both the short and long flags, separated by comma, a pipe or space.
|
||||||
|
*/
|
||||||
|
requiredOption(flags: string, description?: string, defaultValue?: string | boolean): this;
|
||||||
|
requiredOption(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): this;
|
||||||
|
requiredOption<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to store option values as properties on command object,
|
||||||
|
* or store separately (specify false). In both cases the option values can be accessed using .opts().
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
storeOptionsAsProperties(value?: boolean): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to pass command to action handler,
|
||||||
|
* or just the options (specify false).
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
passCommandToAction(value?: boolean): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter parsing of short flags with optional values.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // for `.option('-f,--flag [value]'):
|
||||||
|
* .combineFlagAndOptionalValue(true) // `-f80` is treated like `--flag=80`, this is the default behaviour
|
||||||
|
* .combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
combineFlagAndOptionalValue(arg?: boolean): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow unknown options on the command line.
|
||||||
|
*
|
||||||
|
* @param [arg] if `true` or omitted, no error will be thrown for unknown options.
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
allowUnknownOption(arg?: boolean): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse `argv`, setting options and invoking commands when defined.
|
||||||
|
*
|
||||||
|
* The default expectation is that the arguments are from node and have the application as argv[0]
|
||||||
|
* and the script being run in argv[1], with user parameters after that.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* program.parse(process.argv);
|
||||||
|
* program.parse(); // implicitly use process.argv and auto-detect node vs electron conventions
|
||||||
|
* program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
parse(argv?: string[], options?: ParseOptions): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse `argv`, setting options and invoking commands when defined.
|
||||||
|
*
|
||||||
|
* Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise.
|
||||||
|
*
|
||||||
|
* The default expectation is that the arguments are from node and have the application as argv[0]
|
||||||
|
* and the script being run in argv[1], with user parameters after that.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* program.parseAsync(process.argv);
|
||||||
|
* program.parseAsync(); // implicitly use process.argv and auto-detect node vs electron conventions
|
||||||
|
* program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
|
||||||
|
*
|
||||||
|
* @returns Promise
|
||||||
|
*/
|
||||||
|
parseAsync(argv?: string[], options?: ParseOptions): Promise<this>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse options from `argv` removing known options,
|
||||||
|
* and return argv split into operands and unknown arguments.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* argv => operands, unknown
|
||||||
|
* --known kkk op => [op], []
|
||||||
|
* op --known kkk => [op], []
|
||||||
|
* sub --unknown uuu op => [sub], [--unknown uuu op]
|
||||||
|
* sub -- --unknown uuu op => [sub --unknown uuu op], []
|
||||||
|
*/
|
||||||
|
parseOptions(argv: string[]): commander.ParseOptionsResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an object containing options as key-value pairs
|
||||||
|
*/
|
||||||
|
opts(): { [key: string]: any };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the description.
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
description(str: string, argsDescription?: {[argName: string]: string}): this;
|
||||||
|
/**
|
||||||
|
* Get the description.
|
||||||
|
*/
|
||||||
|
description(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an alias for the command.
|
||||||
|
*
|
||||||
|
* You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
alias(alias: string): this;
|
||||||
|
/**
|
||||||
|
* Get alias for the command.
|
||||||
|
*/
|
||||||
|
alias(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set aliases for the command.
|
||||||
|
*
|
||||||
|
* Only the first alias is shown in the auto-generated help.
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
aliases(aliases: string[]): this;
|
||||||
|
/**
|
||||||
|
* Get aliases for the command.
|
||||||
|
*/
|
||||||
|
aliases(): string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the command usage.
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
usage(str: string): this;
|
||||||
|
/**
|
||||||
|
* Get the command usage.
|
||||||
|
*/
|
||||||
|
usage(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the name of the command.
|
||||||
|
*
|
||||||
|
* @returns `this` command for chaining
|
||||||
|
*/
|
||||||
|
name(str: string): this;
|
||||||
|
/**
|
||||||
|
* Get the name of the command.
|
||||||
|
*/
|
||||||
|
name(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output help information for this command.
|
||||||
|
*
|
||||||
|
* When listener(s) are available for the helpLongFlag
|
||||||
|
* those callbacks are invoked.
|
||||||
|
*/
|
||||||
|
outputHelp(cb?: (str: string) => string): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return command help documentation.
|
||||||
|
*/
|
||||||
|
helpInformation(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You can pass in flags and a description to override the help
|
||||||
|
* flags and help description for your command. Pass in false
|
||||||
|
* to disable the built-in help option.
|
||||||
|
*/
|
||||||
|
helpOption(flags?: string | boolean, description?: string): this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output help information and exit.
|
||||||
|
*/
|
||||||
|
help(cb?: (str: string) => string): never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a listener (callback) for when events occur. (Implemented using EventEmitter.)
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* program
|
||||||
|
* .on('--help', () -> {
|
||||||
|
* console.log('See web site for more information.');
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
}
|
||||||
|
type CommandConstructor = new (name?: string) => Command;
|
||||||
|
|
||||||
|
interface CommandOptions {
|
||||||
|
noHelp?: boolean; // old name for hidden
|
||||||
|
hidden?: boolean;
|
||||||
|
isDefault?: boolean;
|
||||||
|
}
|
||||||
|
interface ExecutableCommandOptions extends CommandOptions {
|
||||||
|
executableFile?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ParseOptionsResult {
|
||||||
|
operands: string[];
|
||||||
|
unknown: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CommanderStatic extends Command {
|
||||||
|
program: Command;
|
||||||
|
Command: CommandConstructor;
|
||||||
|
Option: OptionConstructor;
|
||||||
|
CommanderError: CommanderErrorConstructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Declaring namespace AND global
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
|
declare const commander: commander.CommanderStatic;
|
||||||
|
export = commander;
|
18
node_modules/follow-redirects/LICENSE
generated
vendored
Normal file
18
node_modules/follow-redirects/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
Copyright 2014–present Olivier Lalonde <olalonde@gmail.com>, James Talmage <james@talmage.io>, Ruben Verborgh
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||||
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
148
node_modules/follow-redirects/README.md
generated
vendored
Normal file
148
node_modules/follow-redirects/README.md
generated
vendored
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
## Follow Redirects
|
||||||
|
|
||||||
|
Drop-in replacement for Node's `http` and `https` modules that automatically follows redirects.
|
||||||
|
|
||||||
|
[![npm version](https://img.shields.io/npm/v/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects)
|
||||||
|
[![Build Status](https://travis-ci.com/follow-redirects/follow-redirects.svg?branch=master)](https://travis-ci.com/follow-redirects/follow-redirects)
|
||||||
|
[![Coverage Status](https://coveralls.io/repos/follow-redirects/follow-redirects/badge.svg?branch=master)](https://coveralls.io/r/follow-redirects/follow-redirects?branch=master)
|
||||||
|
[![npm downloads](https://img.shields.io/npm/dm/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects)
|
||||||
|
[![Sponsor on GitHub](https://img.shields.io/static/v1?label=Sponsor&message=%F0%9F%92%96&logo=GitHub)](https://github.com/sponsors/RubenVerborgh)
|
||||||
|
|
||||||
|
`follow-redirects` provides [request](https://nodejs.org/api/http.html#http_http_request_options_callback) and [get](https://nodejs.org/api/http.html#http_http_get_options_callback)
|
||||||
|
methods that behave identically to those found on the native [http](https://nodejs.org/api/http.html#http_http_request_options_callback) and [https](https://nodejs.org/api/https.html#https_https_request_options_callback)
|
||||||
|
modules, with the exception that they will seamlessly follow redirects.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const { http, https } = require('follow-redirects');
|
||||||
|
|
||||||
|
http.get('http://bit.ly/900913', response => {
|
||||||
|
response.on('data', chunk => {
|
||||||
|
console.log(chunk);
|
||||||
|
});
|
||||||
|
}).on('error', err => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
You can inspect the final redirected URL through the `responseUrl` property on the `response`.
|
||||||
|
If no redirection happened, `responseUrl` is the original request URL.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const request = https.request({
|
||||||
|
host: 'bitly.com',
|
||||||
|
path: '/UHfDGO',
|
||||||
|
}, response => {
|
||||||
|
console.log(response.responseUrl);
|
||||||
|
// 'http://duckduckgo.com/robots.txt'
|
||||||
|
});
|
||||||
|
request.end();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
### Global options
|
||||||
|
Global options are set directly on the `follow-redirects` module:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const followRedirects = require('follow-redirects');
|
||||||
|
followRedirects.maxRedirects = 10;
|
||||||
|
followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB
|
||||||
|
```
|
||||||
|
|
||||||
|
The following global options are supported:
|
||||||
|
|
||||||
|
- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.
|
||||||
|
|
||||||
|
- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.
|
||||||
|
|
||||||
|
### Per-request options
|
||||||
|
Per-request options are set by passing an `options` object:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const url = require('url');
|
||||||
|
const { http, https } = require('follow-redirects');
|
||||||
|
|
||||||
|
const options = url.parse('http://bit.ly/900913');
|
||||||
|
options.maxRedirects = 10;
|
||||||
|
options.beforeRedirect = (options, { headers }) => {
|
||||||
|
// Use this to adjust the request options upon redirecting,
|
||||||
|
// to inspect the latest response headers,
|
||||||
|
// or to cancel the request by throwing an error
|
||||||
|
if (options.hostname === "example.com") {
|
||||||
|
options.auth = "user:password";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
http.request(options);
|
||||||
|
```
|
||||||
|
|
||||||
|
In addition to the [standard HTTP](https://nodejs.org/api/http.html#http_http_request_options_callback) and [HTTPS options](https://nodejs.org/api/https.html#https_https_request_options_callback),
|
||||||
|
the following per-request options are supported:
|
||||||
|
- `followRedirects` (default: `true`) – whether redirects should be followed.
|
||||||
|
|
||||||
|
- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.
|
||||||
|
|
||||||
|
- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.
|
||||||
|
|
||||||
|
- `beforeRedirect` (default: `undefined`) – optionally change the request `options` on redirects, or abort the request by throwing an error.
|
||||||
|
|
||||||
|
- `agents` (default: `undefined`) – sets the `agent` option per protocol, since HTTP and HTTPS use different agents. Example value: `{ http: new http.Agent(), https: new https.Agent() }`
|
||||||
|
|
||||||
|
- `trackRedirects` (default: `false`) – whether to store the redirected response details into the `redirects` array on the response object.
|
||||||
|
|
||||||
|
|
||||||
|
### Advanced usage
|
||||||
|
By default, `follow-redirects` will use the Node.js default implementations
|
||||||
|
of [`http`](https://nodejs.org/api/http.html)
|
||||||
|
and [`https`](https://nodejs.org/api/https.html).
|
||||||
|
To enable features such as caching and/or intermediate request tracking,
|
||||||
|
you might instead want to wrap `follow-redirects` around custom protocol implementations:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const { http, https } = require('follow-redirects').wrap({
|
||||||
|
http: require('your-custom-http'),
|
||||||
|
https: require('your-custom-https'),
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Such custom protocols only need an implementation of the `request` method.
|
||||||
|
|
||||||
|
## Browser Usage
|
||||||
|
|
||||||
|
Due to the way the browser works,
|
||||||
|
the `http` and `https` browser equivalents perform redirects by default.
|
||||||
|
|
||||||
|
By requiring `follow-redirects` this way:
|
||||||
|
```javascript
|
||||||
|
const http = require('follow-redirects/http');
|
||||||
|
const https = require('follow-redirects/https');
|
||||||
|
```
|
||||||
|
you can easily tell webpack and friends to replace
|
||||||
|
`follow-redirect` by the built-in versions:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"follow-redirects/http" : "http",
|
||||||
|
"follow-redirects/https" : "https"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Pull Requests are always welcome. Please [file an issue](https://github.com/follow-redirects/follow-redirects/issues)
|
||||||
|
detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied
|
||||||
|
by tests. You can run the test suite locally with a simple `npm test` command.
|
||||||
|
|
||||||
|
## Debug Logging
|
||||||
|
|
||||||
|
`follow-redirects` uses the excellent [debug](https://www.npmjs.com/package/debug) for logging. To turn on logging
|
||||||
|
set the environment variable `DEBUG=follow-redirects` for debug output from just this module. When running the test
|
||||||
|
suite it is sometimes advantageous to set `DEBUG=*` to see output from the express server as well.
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
- [Ruben Verborgh](https://ruben.verborgh.org/)
|
||||||
|
- [Olivier Lalonde](mailto:olalonde@gmail.com)
|
||||||
|
- [James Talmage](mailto:james@talmage.io)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT License](https://github.com/follow-redirects/follow-redirects/blob/master/LICENSE)
|
9
node_modules/follow-redirects/debug.js
generated
vendored
Normal file
9
node_modules/follow-redirects/debug.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
var debug;
|
||||||
|
try {
|
||||||
|
/* eslint global-require: off */
|
||||||
|
debug = require("debug")("follow-redirects");
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
debug = function () { /* */ };
|
||||||
|
}
|
||||||
|
module.exports = debug;
|
1
node_modules/follow-redirects/http.js
generated
vendored
Normal file
1
node_modules/follow-redirects/http.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require("./").http;
|
1
node_modules/follow-redirects/https.js
generated
vendored
Normal file
1
node_modules/follow-redirects/https.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require("./").https;
|
504
node_modules/follow-redirects/index.js
generated
vendored
Normal file
504
node_modules/follow-redirects/index.js
generated
vendored
Normal file
|
@ -0,0 +1,504 @@
|
||||||
|
var url = require("url");
|
||||||
|
var URL = url.URL;
|
||||||
|
var http = require("http");
|
||||||
|
var https = require("https");
|
||||||
|
var Writable = require("stream").Writable;
|
||||||
|
var assert = require("assert");
|
||||||
|
var debug = require("./debug");
|
||||||
|
|
||||||
|
// Create handlers that pass events from native requests
|
||||||
|
var eventHandlers = Object.create(null);
|
||||||
|
["abort", "aborted", "connect", "error", "socket", "timeout"].forEach(function (event) {
|
||||||
|
eventHandlers[event] = function (arg1, arg2, arg3) {
|
||||||
|
this._redirectable.emit(event, arg1, arg2, arg3);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// Error types with codes
|
||||||
|
var RedirectionError = createErrorType(
|
||||||
|
"ERR_FR_REDIRECTION_FAILURE",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
var TooManyRedirectsError = createErrorType(
|
||||||
|
"ERR_FR_TOO_MANY_REDIRECTS",
|
||||||
|
"Maximum number of redirects exceeded"
|
||||||
|
);
|
||||||
|
var MaxBodyLengthExceededError = createErrorType(
|
||||||
|
"ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
|
||||||
|
"Request body larger than maxBodyLength limit"
|
||||||
|
);
|
||||||
|
var WriteAfterEndError = createErrorType(
|
||||||
|
"ERR_STREAM_WRITE_AFTER_END",
|
||||||
|
"write after end"
|
||||||
|
);
|
||||||
|
|
||||||
|
// An HTTP(S) request that can be redirected
|
||||||
|
function RedirectableRequest(options, responseCallback) {
|
||||||
|
// Initialize the request
|
||||||
|
Writable.call(this);
|
||||||
|
this._sanitizeOptions(options);
|
||||||
|
this._options = options;
|
||||||
|
this._ended = false;
|
||||||
|
this._ending = false;
|
||||||
|
this._redirectCount = 0;
|
||||||
|
this._redirects = [];
|
||||||
|
this._requestBodyLength = 0;
|
||||||
|
this._requestBodyBuffers = [];
|
||||||
|
|
||||||
|
// Attach a callback if passed
|
||||||
|
if (responseCallback) {
|
||||||
|
this.on("response", responseCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
// React to responses of native requests
|
||||||
|
var self = this;
|
||||||
|
this._onNativeResponse = function (response) {
|
||||||
|
self._processResponse(response);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Perform the first request
|
||||||
|
this._performRequest();
|
||||||
|
}
|
||||||
|
RedirectableRequest.prototype = Object.create(Writable.prototype);
|
||||||
|
|
||||||
|
// Writes buffered data to the current native request
|
||||||
|
RedirectableRequest.prototype.write = function (data, encoding, callback) {
|
||||||
|
// Writing is not allowed if end has been called
|
||||||
|
if (this._ending) {
|
||||||
|
throw new WriteAfterEndError();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate input and shift parameters if necessary
|
||||||
|
if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) {
|
||||||
|
throw new TypeError("data should be a string, Buffer or Uint8Array");
|
||||||
|
}
|
||||||
|
if (typeof encoding === "function") {
|
||||||
|
callback = encoding;
|
||||||
|
encoding = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore empty buffers, since writing them doesn't invoke the callback
|
||||||
|
// https://github.com/nodejs/node/issues/22066
|
||||||
|
if (data.length === 0) {
|
||||||
|
if (callback) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Only write when we don't exceed the maximum body length
|
||||||
|
if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
|
||||||
|
this._requestBodyLength += data.length;
|
||||||
|
this._requestBodyBuffers.push({ data: data, encoding: encoding });
|
||||||
|
this._currentRequest.write(data, encoding, callback);
|
||||||
|
}
|
||||||
|
// Error when we exceed the maximum body length
|
||||||
|
else {
|
||||||
|
this.emit("error", new MaxBodyLengthExceededError());
|
||||||
|
this.abort();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ends the current native request
|
||||||
|
RedirectableRequest.prototype.end = function (data, encoding, callback) {
|
||||||
|
// Shift parameters if necessary
|
||||||
|
if (typeof data === "function") {
|
||||||
|
callback = data;
|
||||||
|
data = encoding = null;
|
||||||
|
}
|
||||||
|
else if (typeof encoding === "function") {
|
||||||
|
callback = encoding;
|
||||||
|
encoding = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write data if needed and end
|
||||||
|
if (!data) {
|
||||||
|
this._ended = this._ending = true;
|
||||||
|
this._currentRequest.end(null, null, callback);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var self = this;
|
||||||
|
var currentRequest = this._currentRequest;
|
||||||
|
this.write(data, encoding, function () {
|
||||||
|
self._ended = true;
|
||||||
|
currentRequest.end(null, null, callback);
|
||||||
|
});
|
||||||
|
this._ending = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Sets a header value on the current native request
|
||||||
|
RedirectableRequest.prototype.setHeader = function (name, value) {
|
||||||
|
this._options.headers[name] = value;
|
||||||
|
this._currentRequest.setHeader(name, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Clears a header value on the current native request
|
||||||
|
RedirectableRequest.prototype.removeHeader = function (name) {
|
||||||
|
delete this._options.headers[name];
|
||||||
|
this._currentRequest.removeHeader(name);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Global timeout for all underlying requests
|
||||||
|
RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
|
||||||
|
if (callback) {
|
||||||
|
this.once("timeout", callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.socket) {
|
||||||
|
startTimer(this, msecs);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var self = this;
|
||||||
|
this._currentRequest.once("socket", function () {
|
||||||
|
startTimer(self, msecs);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.once("response", clearTimer);
|
||||||
|
this.once("error", clearTimer);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
function startTimer(request, msecs) {
|
||||||
|
clearTimeout(request._timeout);
|
||||||
|
request._timeout = setTimeout(function () {
|
||||||
|
request.emit("timeout");
|
||||||
|
}, msecs);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearTimer() {
|
||||||
|
clearTimeout(this._timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proxy all other public ClientRequest methods
|
||||||
|
[
|
||||||
|
"abort", "flushHeaders", "getHeader",
|
||||||
|
"setNoDelay", "setSocketKeepAlive",
|
||||||
|
].forEach(function (method) {
|
||||||
|
RedirectableRequest.prototype[method] = function (a, b) {
|
||||||
|
return this._currentRequest[method](a, b);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// Proxy all public ClientRequest properties
|
||||||
|
["aborted", "connection", "socket"].forEach(function (property) {
|
||||||
|
Object.defineProperty(RedirectableRequest.prototype, property, {
|
||||||
|
get: function () { return this._currentRequest[property]; },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
RedirectableRequest.prototype._sanitizeOptions = function (options) {
|
||||||
|
// Ensure headers are always present
|
||||||
|
if (!options.headers) {
|
||||||
|
options.headers = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since http.request treats host as an alias of hostname,
|
||||||
|
// but the url module interprets host as hostname plus port,
|
||||||
|
// eliminate the host property to avoid confusion.
|
||||||
|
if (options.host) {
|
||||||
|
// Use hostname if set, because it has precedence
|
||||||
|
if (!options.hostname) {
|
||||||
|
options.hostname = options.host;
|
||||||
|
}
|
||||||
|
delete options.host;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete the URL object when necessary
|
||||||
|
if (!options.pathname && options.path) {
|
||||||
|
var searchPos = options.path.indexOf("?");
|
||||||
|
if (searchPos < 0) {
|
||||||
|
options.pathname = options.path;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
options.pathname = options.path.substring(0, searchPos);
|
||||||
|
options.search = options.path.substring(searchPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Executes the next native request (initial or redirect)
|
||||||
|
RedirectableRequest.prototype._performRequest = function () {
|
||||||
|
// Load the native protocol
|
||||||
|
var protocol = this._options.protocol;
|
||||||
|
var nativeProtocol = this._options.nativeProtocols[protocol];
|
||||||
|
if (!nativeProtocol) {
|
||||||
|
this.emit("error", new TypeError("Unsupported protocol " + protocol));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If specified, use the agent corresponding to the protocol
|
||||||
|
// (HTTP and HTTPS use different types of agents)
|
||||||
|
if (this._options.agents) {
|
||||||
|
var scheme = protocol.substr(0, protocol.length - 1);
|
||||||
|
this._options.agent = this._options.agents[scheme];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the native request
|
||||||
|
var request = this._currentRequest =
|
||||||
|
nativeProtocol.request(this._options, this._onNativeResponse);
|
||||||
|
this._currentUrl = url.format(this._options);
|
||||||
|
|
||||||
|
// Set up event handlers
|
||||||
|
request._redirectable = this;
|
||||||
|
for (var event in eventHandlers) {
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (event) {
|
||||||
|
request.on(event, eventHandlers[event]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// End a redirected request
|
||||||
|
// (The first request must be ended explicitly with RedirectableRequest#end)
|
||||||
|
if (this._isRedirect) {
|
||||||
|
// Write the request entity and end.
|
||||||
|
var i = 0;
|
||||||
|
var self = this;
|
||||||
|
var buffers = this._requestBodyBuffers;
|
||||||
|
(function writeNext(error) {
|
||||||
|
// Only write if this request has not been redirected yet
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (request === self._currentRequest) {
|
||||||
|
// Report any write errors
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if (error) {
|
||||||
|
self.emit("error", error);
|
||||||
|
}
|
||||||
|
// Write the next buffer if there are still left
|
||||||
|
else if (i < buffers.length) {
|
||||||
|
var buffer = buffers[i++];
|
||||||
|
/* istanbul ignore else */
|
||||||
|
if (!request.finished) {
|
||||||
|
request.write(buffer.data, buffer.encoding, writeNext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// End the request if `end` has been called on us
|
||||||
|
else if (self._ended) {
|
||||||
|
request.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Processes a response from the current native request
|
||||||
|
RedirectableRequest.prototype._processResponse = function (response) {
|
||||||
|
// Store the redirected response
|
||||||
|
var statusCode = response.statusCode;
|
||||||
|
if (this._options.trackRedirects) {
|
||||||
|
this._redirects.push({
|
||||||
|
url: this._currentUrl,
|
||||||
|
headers: response.headers,
|
||||||
|
statusCode: statusCode,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// RFC7231§6.4: The 3xx (Redirection) class of status code indicates
|
||||||
|
// that further action needs to be taken by the user agent in order to
|
||||||
|
// fulfill the request. If a Location header field is provided,
|
||||||
|
// the user agent MAY automatically redirect its request to the URI
|
||||||
|
// referenced by the Location field value,
|
||||||
|
// even if the specific status code is not understood.
|
||||||
|
var location = response.headers.location;
|
||||||
|
if (location && this._options.followRedirects !== false &&
|
||||||
|
statusCode >= 300 && statusCode < 400) {
|
||||||
|
// Abort the current request
|
||||||
|
this._currentRequest.removeAllListeners();
|
||||||
|
this._currentRequest.on("error", noop);
|
||||||
|
this._currentRequest.abort();
|
||||||
|
// Discard the remainder of the response to avoid waiting for data
|
||||||
|
response.destroy();
|
||||||
|
|
||||||
|
// RFC7231§6.4: A client SHOULD detect and intervene
|
||||||
|
// in cyclical redirections (i.e., "infinite" redirection loops).
|
||||||
|
if (++this._redirectCount > this._options.maxRedirects) {
|
||||||
|
this.emit("error", new TooManyRedirectsError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// RFC7231§6.4: Automatic redirection needs to done with
|
||||||
|
// care for methods not known to be safe, […]
|
||||||
|
// RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
|
||||||
|
// the request method from POST to GET for the subsequent request.
|
||||||
|
if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
|
||||||
|
// RFC7231§6.4.4: The 303 (See Other) status code indicates that
|
||||||
|
// the server is redirecting the user agent to a different resource […]
|
||||||
|
// A user agent can perform a retrieval request targeting that URI
|
||||||
|
// (a GET or HEAD request if using HTTP) […]
|
||||||
|
(statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
|
||||||
|
this._options.method = "GET";
|
||||||
|
// Drop a possible entity and headers related to it
|
||||||
|
this._requestBodyBuffers = [];
|
||||||
|
removeMatchingHeaders(/^content-/i, this._options.headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drop the Host header, as the redirect might lead to a different host
|
||||||
|
var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) ||
|
||||||
|
url.parse(this._currentUrl).hostname;
|
||||||
|
|
||||||
|
// Create the redirected request
|
||||||
|
var redirectUrl = url.resolve(this._currentUrl, location);
|
||||||
|
debug("redirecting to", redirectUrl);
|
||||||
|
this._isRedirect = true;
|
||||||
|
var redirectUrlParts = url.parse(redirectUrl);
|
||||||
|
Object.assign(this._options, redirectUrlParts);
|
||||||
|
|
||||||
|
// Drop the Authorization header if redirecting to another host
|
||||||
|
if (redirectUrlParts.hostname !== previousHostName) {
|
||||||
|
removeMatchingHeaders(/^authorization$/i, this._options.headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Evaluate the beforeRedirect callback
|
||||||
|
if (typeof this._options.beforeRedirect === "function") {
|
||||||
|
var responseDetails = { headers: response.headers };
|
||||||
|
try {
|
||||||
|
this._options.beforeRedirect.call(null, this._options, responseDetails);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.emit("error", err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._sanitizeOptions(this._options);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the redirected request
|
||||||
|
try {
|
||||||
|
this._performRequest();
|
||||||
|
}
|
||||||
|
catch (cause) {
|
||||||
|
var error = new RedirectionError("Redirected request failed: " + cause.message);
|
||||||
|
error.cause = cause;
|
||||||
|
this.emit("error", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// The response is not a redirect; return it as-is
|
||||||
|
response.responseUrl = this._currentUrl;
|
||||||
|
response.redirects = this._redirects;
|
||||||
|
this.emit("response", response);
|
||||||
|
|
||||||
|
// Clean up
|
||||||
|
this._requestBodyBuffers = [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Wraps the key/value object of protocols with redirect functionality
|
||||||
|
function wrap(protocols) {
|
||||||
|
// Default settings
|
||||||
|
var exports = {
|
||||||
|
maxRedirects: 21,
|
||||||
|
maxBodyLength: 10 * 1024 * 1024,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Wrap each protocol
|
||||||
|
var nativeProtocols = {};
|
||||||
|
Object.keys(protocols).forEach(function (scheme) {
|
||||||
|
var protocol = scheme + ":";
|
||||||
|
var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
|
||||||
|
var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
|
||||||
|
|
||||||
|
// Executes a request, following redirects
|
||||||
|
function request(input, options, callback) {
|
||||||
|
// Parse parameters
|
||||||
|
if (typeof input === "string") {
|
||||||
|
var urlStr = input;
|
||||||
|
try {
|
||||||
|
input = urlToOptions(new URL(urlStr));
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
/* istanbul ignore next */
|
||||||
|
input = url.parse(urlStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (URL && (input instanceof URL)) {
|
||||||
|
input = urlToOptions(input);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
callback = options;
|
||||||
|
options = input;
|
||||||
|
input = { protocol: protocol };
|
||||||
|
}
|
||||||
|
if (typeof options === "function") {
|
||||||
|
callback = options;
|
||||||
|
options = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set defaults
|
||||||
|
options = Object.assign({
|
||||||
|
maxRedirects: exports.maxRedirects,
|
||||||
|
maxBodyLength: exports.maxBodyLength,
|
||||||
|
}, input, options);
|
||||||
|
options.nativeProtocols = nativeProtocols;
|
||||||
|
|
||||||
|
assert.equal(options.protocol, protocol, "protocol mismatch");
|
||||||
|
debug("options", options);
|
||||||
|
return new RedirectableRequest(options, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Executes a GET request, following redirects
|
||||||
|
function get(input, options, callback) {
|
||||||
|
var wrappedRequest = wrappedProtocol.request(input, options, callback);
|
||||||
|
wrappedRequest.end();
|
||||||
|
return wrappedRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Expose the properties on the wrapped protocol
|
||||||
|
Object.defineProperties(wrappedProtocol, {
|
||||||
|
request: { value: request, configurable: true, enumerable: true, writable: true },
|
||||||
|
get: { value: get, configurable: true, enumerable: true, writable: true },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return exports;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* istanbul ignore next */
|
||||||
|
function noop() { /* empty */ }
|
||||||
|
|
||||||
|
// from https://github.com/nodejs/node/blob/master/lib/internal/url.js
|
||||||
|
function urlToOptions(urlObject) {
|
||||||
|
var options = {
|
||||||
|
protocol: urlObject.protocol,
|
||||||
|
hostname: urlObject.hostname.startsWith("[") ?
|
||||||
|
/* istanbul ignore next */
|
||||||
|
urlObject.hostname.slice(1, -1) :
|
||||||
|
urlObject.hostname,
|
||||||
|
hash: urlObject.hash,
|
||||||
|
search: urlObject.search,
|
||||||
|
pathname: urlObject.pathname,
|
||||||
|
path: urlObject.pathname + urlObject.search,
|
||||||
|
href: urlObject.href,
|
||||||
|
};
|
||||||
|
if (urlObject.port !== "") {
|
||||||
|
options.port = Number(urlObject.port);
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeMatchingHeaders(regex, headers) {
|
||||||
|
var lastValue;
|
||||||
|
for (var header in headers) {
|
||||||
|
if (regex.test(header)) {
|
||||||
|
lastValue = headers[header];
|
||||||
|
delete headers[header];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lastValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createErrorType(code, defaultMessage) {
|
||||||
|
function CustomError(message) {
|
||||||
|
Error.captureStackTrace(this, this.constructor);
|
||||||
|
this.message = message || defaultMessage;
|
||||||
|
}
|
||||||
|
CustomError.prototype = new Error();
|
||||||
|
CustomError.prototype.constructor = CustomError;
|
||||||
|
CustomError.prototype.name = "Error [" + code + "]";
|
||||||
|
CustomError.prototype.code = code;
|
||||||
|
return CustomError;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exports
|
||||||
|
module.exports = wrap({ http: http, https: https });
|
||||||
|
module.exports.wrap = wrap;
|
59
node_modules/follow-redirects/package.json
generated
vendored
Normal file
59
node_modules/follow-redirects/package.json
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
"name": "follow-redirects",
|
||||||
|
"version": "1.13.1",
|
||||||
|
"description": "HTTP and HTTPS modules that follow redirects.",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"files": [
|
||||||
|
"*.js"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "npm run lint && npm run mocha",
|
||||||
|
"lint": "eslint *.js test",
|
||||||
|
"mocha": "nyc mocha"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git@github.com:follow-redirects/follow-redirects.git"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/follow-redirects/follow-redirects",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/follow-redirects/follow-redirects/issues"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"http",
|
||||||
|
"https",
|
||||||
|
"url",
|
||||||
|
"redirect",
|
||||||
|
"client",
|
||||||
|
"location",
|
||||||
|
"utility"
|
||||||
|
],
|
||||||
|
"author": "Ruben Verborgh <ruben@verborgh.org> (https://ruben.verborgh.org/)",
|
||||||
|
"contributors": [
|
||||||
|
"Olivier Lalonde <olalonde@gmail.com> (http://www.syskall.com)",
|
||||||
|
"James Talmage <james@talmage.io>"
|
||||||
|
],
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"concat-stream": "^2.0.0",
|
||||||
|
"eslint": "^5.16.0",
|
||||||
|
"express": "^4.16.4",
|
||||||
|
"lolex": "^3.1.0",
|
||||||
|
"mocha": "^6.0.2",
|
||||||
|
"nyc": "^14.1.1"
|
||||||
|
}
|
||||||
|
}
|
9
node_modules/fs/README.md
generated
vendored
Normal file
9
node_modules/fs/README.md
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Security holding package
|
||||||
|
|
||||||
|
This package name is not currently in use, but was formerly occupied
|
||||||
|
by another package. To avoid malicious use, npm is hanging on to the
|
||||||
|
package name, but loosely, and we'll probably give it to you if you
|
||||||
|
want it.
|
||||||
|
|
||||||
|
You may adopt this package by contacting support@npmjs.com and
|
||||||
|
requesting the name.
|
20
node_modules/fs/package.json
generated
vendored
Normal file
20
node_modules/fs/package.json
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "fs",
|
||||||
|
"version": "0.0.1-security",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/npm/security-holder.git"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/npm/security-holder/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/npm/security-holder#readme"
|
||||||
|
}
|
5
node_modules/is-docker/cli.js
generated
vendored
Executable file
5
node_modules/is-docker/cli.js
generated
vendored
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
'use strict';
|
||||||
|
const isDocker = require('.');
|
||||||
|
|
||||||
|
process.exitCode = isDocker() ? 0 : 2;
|
15
node_modules/is-docker/index.d.ts
generated
vendored
Normal file
15
node_modules/is-docker/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/**
|
||||||
|
Check if the process is running inside a Docker container.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import isDocker = require('is-docker');
|
||||||
|
|
||||||
|
if (isDocker()) {
|
||||||
|
console.log('Running inside a Docker container');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
declare function isDocker(): boolean;
|
||||||
|
|
||||||
|
export = isDocker;
|
29
node_modules/is-docker/index.js
generated
vendored
Normal file
29
node_modules/is-docker/index.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
'use strict';
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
let isDocker;
|
||||||
|
|
||||||
|
function hasDockerEnv() {
|
||||||
|
try {
|
||||||
|
fs.statSync('/.dockerenv');
|
||||||
|
return true;
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasDockerCGroup() {
|
||||||
|
try {
|
||||||
|
return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
if (isDocker === undefined) {
|
||||||
|
isDocker = hasDockerEnv() || hasDockerCGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
return isDocker;
|
||||||
|
};
|
9
node_modules/is-docker/license
generated
vendored
Normal file
9
node_modules/is-docker/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
42
node_modules/is-docker/package.json
generated
vendored
Normal file
42
node_modules/is-docker/package.json
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{
|
||||||
|
"name": "is-docker",
|
||||||
|
"version": "2.1.1",
|
||||||
|
"description": "Check if the process is running inside a Docker container",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "sindresorhus/is-docker",
|
||||||
|
"funding": "https://github.com/sponsors/sindresorhus",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "https://sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bin": "cli.js",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava && tsd"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts",
|
||||||
|
"cli.js"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"detect",
|
||||||
|
"docker",
|
||||||
|
"dockerized",
|
||||||
|
"container",
|
||||||
|
"inside",
|
||||||
|
"is",
|
||||||
|
"env",
|
||||||
|
"environment",
|
||||||
|
"process"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^1.4.1",
|
||||||
|
"sinon": "^7.3.2",
|
||||||
|
"tsd": "^0.7.2",
|
||||||
|
"xo": "^0.24.0"
|
||||||
|
}
|
||||||
|
}
|
27
node_modules/is-docker/readme.md
generated
vendored
Normal file
27
node_modules/is-docker/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# is-docker [![Build Status](https://travis-ci.com/sindresorhus/is-docker.svg?branch=master)](https://travis-ci.com/github/sindresorhus/is-docker)
|
||||||
|
|
||||||
|
> Check if the process is running inside a Docker container
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install is-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const isDocker = require('is-docker');
|
||||||
|
|
||||||
|
if (isDocker()) {
|
||||||
|
console.log('Running inside a Docker container');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CLI
|
||||||
|
|
||||||
|
```
|
||||||
|
$ is-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
Exits with code 0 if inside a Docker container and 2 if not.
|
15
node_modules/is-wsl/index.d.ts
generated
vendored
Normal file
15
node_modules/is-wsl/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/**
|
||||||
|
Check if the process is running inside [Windows Subsystem for Linux](https://msdn.microsoft.com/commandline/wsl/about) (Bash on Windows).
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import isWsl = require('is-wsl');
|
||||||
|
|
||||||
|
// When running inside Windows Subsystem for Linux
|
||||||
|
console.log(isWsl);
|
||||||
|
//=> true
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
declare const isWsl: boolean;
|
||||||
|
|
||||||
|
export = isWsl;
|
31
node_modules/is-wsl/index.js
generated
vendored
Normal file
31
node_modules/is-wsl/index.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
'use strict';
|
||||||
|
const os = require('os');
|
||||||
|
const fs = require('fs');
|
||||||
|
const isDocker = require('is-docker');
|
||||||
|
|
||||||
|
const isWsl = () => {
|
||||||
|
if (process.platform !== 'linux') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (os.release().toLowerCase().includes('microsoft')) {
|
||||||
|
if (isDocker()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') ?
|
||||||
|
!isDocker() : false;
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (process.env.__IS_WSL_TEST__) {
|
||||||
|
module.exports = isWsl;
|
||||||
|
} else {
|
||||||
|
module.exports = isWsl();
|
||||||
|
}
|
9
node_modules/is-wsl/license
generated
vendored
Normal file
9
node_modules/is-wsl/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
45
node_modules/is-wsl/package.json
generated
vendored
Normal file
45
node_modules/is-wsl/package.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "is-wsl",
|
||||||
|
"version": "2.2.0",
|
||||||
|
"description": "Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "sindresorhus/is-wsl",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava && tsd"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"check",
|
||||||
|
"wsl",
|
||||||
|
"windows",
|
||||||
|
"subsystem",
|
||||||
|
"linux",
|
||||||
|
"detect",
|
||||||
|
"bash",
|
||||||
|
"process",
|
||||||
|
"console",
|
||||||
|
"terminal",
|
||||||
|
"is"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"is-docker": "^2.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^1.4.1",
|
||||||
|
"clear-module": "^3.2.0",
|
||||||
|
"proxyquire": "^2.1.0",
|
||||||
|
"tsd": "^0.7.2",
|
||||||
|
"xo": "^0.24.0"
|
||||||
|
}
|
||||||
|
}
|
36
node_modules/is-wsl/readme.md
generated
vendored
Normal file
36
node_modules/is-wsl/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# is-wsl [![Build Status](https://travis-ci.org/sindresorhus/is-wsl.svg?branch=master)](https://travis-ci.org/sindresorhus/is-wsl)
|
||||||
|
|
||||||
|
> Check if the process is running inside [Windows Subsystem for Linux](https://msdn.microsoft.com/commandline/wsl/about) (Bash on Windows)
|
||||||
|
|
||||||
|
Can be useful if you need to work around unimplemented or buggy features in WSL. Supports both WSL 1 and WSL 2.
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install is-wsl
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const isWsl = require('is-wsl');
|
||||||
|
|
||||||
|
// When running inside Windows Subsystem for Linux
|
||||||
|
console.log(isWsl);
|
||||||
|
//=> true
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<b>
|
||||||
|
<a href="https://tidelift.com/subscription/pkg/npm-is-wsl?utm_source=npm-is-wsl&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||||
|
</b>
|
||||||
|
<br>
|
||||||
|
<sub>
|
||||||
|
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||||
|
</sub>
|
||||||
|
</div>
|
10
node_modules/json2csv/.eslintrc
generated
vendored
Normal file
10
node_modules/json2csv/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 8
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended"
|
||||||
|
}
|
3
node_modules/json2csv/.gitattributes
generated
vendored
Normal file
3
node_modules/json2csv/.gitattributes
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
* text=auto
|
||||||
|
test/fixtures/csv/eol.csv text eol=crlf
|
||||||
|
test/fixtures/csv/escapeEOL.csv text eol=crlf
|
600
node_modules/json2csv/CHANGELOG.md
generated
vendored
Normal file
600
node_modules/json2csv/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,600 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [5.0.5](https://github.com/zemirco/json2csv/compare/v5.0.4...v5.0.5) (2020-11-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't mutate original object in unset ([#499](https://github.com/zemirco/json2csv/issues/499)) ([6e4ea5e](https://github.com/zemirco/json2csv/commit/6e4ea5ebdc263006ca6ff45879fbb7e0bd65bef2))
|
||||||
|
|
||||||
|
### [5.0.4](https://github.com/zemirco/json2csv/compare/v5.0.3...v5.0.4) (2020-11-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Fix issue with unwind and empty arrays creating an extra column ([#496](https://github.com/zemirco/json2csv/issues/496)) ([0b331fc](https://github.com/zemirco/json2csv/commit/0b331fc3ad345f8062abe60f64cb3b43dad30fb0))
|
||||||
|
|
||||||
|
### [5.0.3](https://github.com/zemirco/json2csv/compare/v5.0.2...v5.0.3) (2020-09-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* audit dependencies fix ([d6d0fc7](https://github.com/zemirco/json2csv/commit/d6d0fc78128e01e021414aaf52a65cbcd09a1225))
|
||||||
|
* update commander dep ([322e568](https://github.com/zemirco/json2csv/commit/322e568793ec4a64f43ec2ac82c9886177bcc4ed))
|
||||||
|
|
||||||
|
### [5.0.2](https://github.com/zemirco/json2csv/compare/v5.0.1...v5.0.2) (2020-09-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** fix relative paths issue in CLI when not streaming ([#488](https://github.com/zemirco/json2csv/issues/488)) ([06079e8](https://github.com/zemirco/json2csv/commit/06079e840128030eacfecde66da11295eb162234))
|
||||||
|
|
||||||
|
### [5.0.1](https://github.com/zemirco/json2csv/compare/v5.0.0...v5.0.1) (2020-04-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* wrong call to processValue ([#454](https://github.com/zemirco/json2csv/issues/454)) ([66abd45](https://github.com/zemirco/json2csv/commit/66abd45))
|
||||||
|
|
||||||
|
## [5.0.0](https://github.com/zemirco/json2csv/compare/v4.5.2...v5.0.0) (2020-03-15)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* Node 8 and 9 no longer supported, use Node 10 or greater. It might still work, but it has reached End-Of-Life.
|
||||||
|
* module no longer takes `unwind`, `unwindBlank`, `flatten` or the `flattenSeparator` options, instead see the new `transforms` option. CLI options are unchanged from the callers side, but use the built in transforms under the hood.
|
||||||
|
|
||||||
|
* Add support for transforms
|
||||||
|
|
||||||
|
* Add documentation about transforms
|
||||||
|
* remove extra commonjs build, use starting point in package.json `main` field.
|
||||||
|
* Renamed `doubleQuote` to `escapedQuote`
|
||||||
|
* remove `stringify` option
|
||||||
|
* `--fields-config` option has been removed, use the new `--config` option for all configuration, not just fields.
|
||||||
|
* Drop node 6 and 7, and add node 11 and 12
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Always error asynchronously from parseAsync method ([#412](https://github.com/zemirco/json2csv/issues/412)) ([16cc044](https://github.com/zemirco/json2csv/commit/16cc044))
|
||||||
|
* audit deps ([15992cf](https://github.com/zemirco/json2csv/commit/15992cf))
|
||||||
|
* drop Node 8 and 9 ([7295465](https://github.com/zemirco/json2csv/commit/7295465))
|
||||||
|
* Make some CLI options mandatory ([#433](https://github.com/zemirco/json2csv/issues/433)) ([bd51527](https://github.com/zemirco/json2csv/commit/bd51527))
|
||||||
|
* Remove CommonJS build ([#422](https://github.com/zemirco/json2csv/issues/422)) ([5ce0089](https://github.com/zemirco/json2csv/commit/5ce0089))
|
||||||
|
* Remove stringify option ([#419](https://github.com/zemirco/json2csv/issues/419)) ([39f303d](https://github.com/zemirco/json2csv/commit/39f303d))
|
||||||
|
* Rename doubleQuote to escapedQuote ([#418](https://github.com/zemirco/json2csv/issues/418)) ([f99408c](https://github.com/zemirco/json2csv/commit/f99408c))
|
||||||
|
* update CI node versions ([#413](https://github.com/zemirco/json2csv/issues/413)) ([6fd6c09](https://github.com/zemirco/json2csv/commit/6fd6c09))
|
||||||
|
* update commander cli dep ([74aa40a](https://github.com/zemirco/json2csv/commit/74aa40a))
|
||||||
|
* update commander dep ([272675b](https://github.com/zemirco/json2csv/commit/272675b))
|
||||||
|
* **deps:** audit dependencies ([bf9877a](https://github.com/zemirco/json2csv/commit/bf9877a))
|
||||||
|
* **deps:** update commander ([3f099f2](https://github.com/zemirco/json2csv/commit/3f099f2))
|
||||||
|
* **security:** fix audit vulnerabilities ([b57715b](https://github.com/zemirco/json2csv/commit/b57715b))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add support for flattening arrays and change transforms arguments to an object. ([#432](https://github.com/zemirco/json2csv/issues/432)) ([916e448](https://github.com/zemirco/json2csv/commit/916e448))
|
||||||
|
* Add support for transforms ([#431](https://github.com/zemirco/json2csv/issues/431)) ([f1d04d0](https://github.com/zemirco/json2csv/commit/f1d04d0))
|
||||||
|
* Improve async promise to optionally not return ([#421](https://github.com/zemirco/json2csv/issues/421)) ([3e296f6](https://github.com/zemirco/json2csv/commit/3e296f6))
|
||||||
|
* Improves the unwind transform so it unwinds all unwindable fields if … ([#434](https://github.com/zemirco/json2csv/issues/434)) ([ec1f301](https://github.com/zemirco/json2csv/commit/ec1f301))
|
||||||
|
* replace fields config by a global config ([#338](https://github.com/zemirco/json2csv/issues/338)) ([d6c1c5f](https://github.com/zemirco/json2csv/commit/d6c1c5f))
|
||||||
|
|
||||||
|
## [4.5.2](https://github.com/zemirco/json2csv/compare/v4.5.1...v4.5.2) (2019-07-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Improve the inference of the header name when using function as value ([#395](https://github.com/zemirco/json2csv/issues/395)) ([590d19a](https://github.com/zemirco/json2csv/commit/590d19a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.4.0"></a>
|
||||||
|
## [4.4.0](https://github.com/zemirco/json2csv/compare/v4.3.5...v4.4.0) (2019-03-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Performance improvements and new async api ([#360](https://github.com/zemirco/json2csv/issues/360)) ([d59dea1](https://github.com/zemirco/json2csv/commit/d59dea1))
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.3.5"></a>
|
||||||
|
## [4.3.5](https://github.com/zemirco/json2csv/compare/v4.3.4...v4.3.5) (2019-02-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* audit deps ([3182707](https://github.com/zemirco/json2csv/commit/3182707))
|
||||||
|
* unwind of nested fields ([#357](https://github.com/zemirco/json2csv/issues/357)) ([2d69281](https://github.com/zemirco/json2csv/commit/2d69281))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.3.4"></a>
|
||||||
|
## [4.3.4](https://github.com/zemirco/json2csv/compare/v4.3.3...v4.3.4) (2019-02-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* issue with fields.value function not receiving correct fields ([#353](https://github.com/zemirco/json2csv/issues/353)) ([851c02f](https://github.com/zemirco/json2csv/commit/851c02f))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.3.3"></a>
|
||||||
|
## [4.3.3](https://github.com/zemirco/json2csv/compare/v4.3.2...v4.3.3) (2019-01-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* audit dep fix ([1ef4bcd](https://github.com/zemirco/json2csv/commit/1ef4bcd))
|
||||||
|
* Remove invalid reference to flat ([#347](https://github.com/zemirco/json2csv/issues/347)) ([130ef7d](https://github.com/zemirco/json2csv/commit/130ef7d))
|
||||||
|
* Remove preferGlobal from package.json ([#346](https://github.com/zemirco/json2csv/issues/346)) ([2b6ad3a](https://github.com/zemirco/json2csv/commit/2b6ad3a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.3.2"></a>
|
||||||
|
## [4.3.2](https://github.com/zemirco/json2csv/compare/v4.3.1...v4.3.2) (2018-12-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Remove lodash.clonedeep dependency ([#339](https://github.com/zemirco/json2csv/issues/339)) ([d28955a](https://github.com/zemirco/json2csv/commit/d28955a)), closes [#333](https://github.com/zemirco/json2csv/issues/333)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.3.1"></a>
|
||||||
|
## [4.3.1](https://github.com/zemirco/json2csv/compare/v4.3.0...v4.3.1) (2018-11-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Return correct exit code on error ([#337](https://github.com/zemirco/json2csv/issues/337)) ([a793de5](https://github.com/zemirco/json2csv/commit/a793de5))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.3.0"></a>
|
||||||
|
# [4.3.0](https://github.com/zemirco/json2csv/compare/v4.2.1...v4.3.0) (2018-11-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Optimize performance around the usage of fields ([#328](https://github.com/zemirco/json2csv/issues/328)) ([d9e4463](https://github.com/zemirco/json2csv/commit/d9e4463))
|
||||||
|
* Remove wrong submodule ([#326](https://github.com/zemirco/json2csv/issues/326)) ([6486bb0](https://github.com/zemirco/json2csv/commit/6486bb0))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add support for objectMode in the stream API ([#325](https://github.com/zemirco/json2csv/issues/325)) ([8f0ae55](https://github.com/zemirco/json2csv/commit/8f0ae55))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.2.1"></a>
|
||||||
|
## [4.2.1](https://github.com/zemirco/json2csv/compare/v4.2.0...v4.2.1) (2018-08-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* bug that modifies opts after parsing an object/stream ([#318](https://github.com/zemirco/json2csv/issues/318)) ([f0a4830](https://github.com/zemirco/json2csv/commit/f0a4830))
|
||||||
|
* Clean up the flattening separator feature ([#315](https://github.com/zemirco/json2csv/issues/315)) ([ee3d181](https://github.com/zemirco/json2csv/commit/ee3d181))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.2.0"></a>
|
||||||
|
# [4.2.0](https://github.com/zemirco/json2csv/compare/v4.1.6...v4.2.0) (2018-07-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Added flattenSeparator option ([#314](https://github.com/zemirco/json2csv/issues/314)) ([5c5de9f](https://github.com/zemirco/json2csv/commit/5c5de9f))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.1.6"></a>
|
||||||
|
## [4.1.6](https://github.com/zemirco/json2csv/compare/v4.1.5...v4.1.6) (2018-07-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Update dependencies and remove cli-table2 dependency ([#312](https://github.com/zemirco/json2csv/issues/312)) ([5981ba3](https://github.com/zemirco/json2csv/commit/5981ba3))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.1.5"></a>
|
||||||
|
## [4.1.5](https://github.com/zemirco/json2csv/compare/v4.1.4...v4.1.5) (2018-06-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Process stdin as a stream ([#308](https://github.com/zemirco/json2csv/issues/308)) ([2b186b6](https://github.com/zemirco/json2csv/commit/2b186b6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.1.4"></a>
|
||||||
|
## [4.1.4](https://github.com/zemirco/json2csv/compare/v4.1.3...v4.1.4) (2018-06-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't escape tabs ([#305](https://github.com/zemirco/json2csv/issues/305)) ([a36c8e3](https://github.com/zemirco/json2csv/commit/a36c8e3))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.1.3"></a>
|
||||||
|
## [4.1.3](https://github.com/zemirco/json2csv/compare/v4.1.2...v4.1.3) (2018-05-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Escape custom quotes correctly ([#301](https://github.com/zemirco/json2csv/issues/301)) ([7d57208](https://github.com/zemirco/json2csv/commit/7d57208))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.1.2"></a>
|
||||||
|
## [4.1.2](https://github.com/zemirco/json2csv/compare/v4.1.1...v4.1.2) (2018-04-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **tests:** Skip bogus pretty print tests only in old node versions ([#290](https://github.com/zemirco/json2csv/issues/290)) ([0f3b885](https://github.com/zemirco/json2csv/commit/0f3b885))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.1.1"></a>
|
||||||
|
## [4.1.1](https://github.com/zemirco/json2csv/compare/v4.1.0...v4.1.1) (2018-04-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* readme CLI's info ([#289](https://github.com/zemirco/json2csv/issues/289)) ([9fe65b3](https://github.com/zemirco/json2csv/commit/9fe65b3))
|
||||||
|
* Add tests and docs to unwind-blank feature ([#287](https://github.com/zemirco/json2csv/issues/287)) ([e3d4a05](https://github.com/zemirco/json2csv/commit/e3d4a05))
|
||||||
|
* **perf:** Improve unwind performance and maintainability ([#288](https://github.com/zemirco/json2csv/issues/288)) ([80e496d](https://github.com/zemirco/json2csv/commit/80e496d))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.1.0"></a>
|
||||||
|
## [4.1.0](https://github.com/zemirco/json2csv/compare/v4.0.4...v4.1.0) (2018-04-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Avoid redundant deep cloning when unwinding. ([#286](https://github.com/zemirco/json2csv/issues/286)) ([95a6ca9](https://github.com/zemirco/json2csv/commit/95a6ca9))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add ability to unwind by blanking out instead of repeating data ([#285](https://github.com/zemirco/json2csv/issues/285)) ([61d9808](https://github.com/zemirco/json2csv/commit/61d9808))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.0.4"></a>
|
||||||
|
## [4.0.4](https://github.com/zemirco/json2csv/compare/v4.0.3...v4.0.4) (2018-04-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* comment out failing tests ([#283](https://github.com/zemirco/json2csv/issues/283)) ([5b25eaa](https://github.com/zemirco/json2csv/commit/5b25eaa))
|
||||||
|
* Support empty array with opts.fields ([#281](https://github.com/zemirco/json2csv/issues/281)) ([eccca89](https://github.com/zemirco/json2csv/commit/eccca89))
|
||||||
|
* **tests:** emit correct lines from transform ([#282](https://github.com/zemirco/json2csv/issues/282)) ([2322ddf](https://github.com/zemirco/json2csv/commit/2322ddf))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.0.3"></a>
|
||||||
|
## [4.0.3](https://github.com/zemirco/json2csv/compare/v4.0.2...v4.0.3) (2018-04-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* error when a field is null and flatten is used ([#274](https://github.com/zemirco/json2csv/issues/274)) ([1349a94](https://github.com/zemirco/json2csv/commit/1349a94))
|
||||||
|
* throw error for empty dataset only if fields not specified ([0d8534e](https://github.com/zemirco/json2csv/commit/0d8534e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.0.2"></a>
|
||||||
|
## [4.0.2](https://github.com/zemirco/json2csv/compare/v4.0.1...v4.0.2) (2018-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **parser:** RangeError ([#271](https://github.com/zemirco/json2csv/issues/271)) ([c8d5a87](https://github.com/zemirco/json2csv/commit/c8d5a87))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.0.1"></a>
|
||||||
|
## [4.0.1](https://github.com/zemirco/json2csv/compare/v4.0.0...v4.0.1) (2018-03-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* double quote escaping before new line ([#268](https://github.com/zemirco/json2csv/issues/268)) ([fa991cf](https://github.com/zemirco/json2csv/commit/fa991cf))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.0.0"></a>
|
||||||
|
# [4.0.0](https://github.com/zemirco/json2csv/compare/v4.0.0-alpha.2...v4.0.0) (2018-02-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Replace webpack with rollup packaging ([#266](https://github.com/zemirco/json2csv/issues/266)) ([a9f8020](https://github.com/zemirco/json2csv/commit/a9f8020))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Pass transform options through ([#262](https://github.com/zemirco/json2csv/issues/262)) ([650913f](https://github.com/zemirco/json2csv/commit/650913f))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.0.0-alpha.2"></a>
|
||||||
|
# [4.0.0-alpha.2](https://github.com/zemirco/json2csv/compare/v4.0.0-alpha.1...v4.0.0-alpha.2) (2018-02-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* flatten issue with toJSON ([#259](https://github.com/zemirco/json2csv/issues/259)) ([7006d2b](https://github.com/zemirco/json2csv/commit/7006d2b))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.0.0-alpha.1"></a>
|
||||||
|
# [4.0.0-alpha.1](https://github.com/zemirco/json2csv/compare/v4.0.0-alpha.0...v4.0.0-alpha.1) (2018-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Remove TypeScript definition ([#256](https://github.com/zemirco/json2csv/issues/256)) ([4f09694](https://github.com/zemirco/json2csv/commit/4f09694))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="4.0.0-alpha.0"></a>
|
||||||
|
# [4.0.0-alpha.0](https://github.com/zemirco/json2csv/compare/v3.11.5...v4.0.0-alpha.0) (2018-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Add CLI tests ([#247](https://github.com/zemirco/json2csv/issues/247)) ([bb8126f](https://github.com/zemirco/json2csv/commit/bb8126f))
|
||||||
|
* Add excel string to cli and standardize ([#231](https://github.com/zemirco/json2csv/issues/231)) ([421baad](https://github.com/zemirco/json2csv/commit/421baad))
|
||||||
|
* Allow passing ldjson input files ([#220](https://github.com/zemirco/json2csv/issues/220)) ([9c861ed](https://github.com/zemirco/json2csv/commit/9c861ed))
|
||||||
|
* Avoid throwing an error on elements that can't be stringified (like functions) ([#223](https://github.com/zemirco/json2csv/issues/223)) ([679c687](https://github.com/zemirco/json2csv/commit/679c687))
|
||||||
|
* backslash logic ([#222](https://github.com/zemirco/json2csv/issues/222)) ([29e9445](https://github.com/zemirco/json2csv/commit/29e9445))
|
||||||
|
* broken stdin input ([#241](https://github.com/zemirco/json2csv/issues/241)) ([6cb407c](https://github.com/zemirco/json2csv/commit/6cb407c))
|
||||||
|
* Combine EOL and newLine parameters ([#219](https://github.com/zemirco/json2csv/issues/219)) ([4668a8b](https://github.com/zemirco/json2csv/commit/4668a8b))
|
||||||
|
* header flag ([#221](https://github.com/zemirco/json2csv/issues/221)) ([7f7338f](https://github.com/zemirco/json2csv/commit/7f7338f))
|
||||||
|
* outdated jsdoc ([#243](https://github.com/zemirco/json2csv/issues/243)) ([efe9888](https://github.com/zemirco/json2csv/commit/efe9888))
|
||||||
|
* pretty print issues ([#242](https://github.com/zemirco/json2csv/issues/242)) ([3bd9655](https://github.com/zemirco/json2csv/commit/3bd9655))
|
||||||
|
* Process header cells as any other cell ([#244](https://github.com/zemirco/json2csv/issues/244)) ([1fcde13](https://github.com/zemirco/json2csv/commit/1fcde13))
|
||||||
|
* Remove callback support ([2096ade](https://github.com/zemirco/json2csv/commit/2096ade))
|
||||||
|
* Remove fieldNames ([#232](https://github.com/zemirco/json2csv/issues/232)) ([6cc74b2](https://github.com/zemirco/json2csv/commit/6cc74b2))
|
||||||
|
* Remove path-is-absolute dependency ([#225](https://github.com/zemirco/json2csv/issues/225)) ([f71a3df](https://github.com/zemirco/json2csv/commit/f71a3df))
|
||||||
|
* Rename hasCSVColumnTitle to noHeader ([#216](https://github.com/zemirco/json2csv/issues/216)) ([f053c8b](https://github.com/zemirco/json2csv/commit/f053c8b))
|
||||||
|
* Rename ld-json to ndjson ([#240](https://github.com/zemirco/json2csv/issues/240)) ([24a7893](https://github.com/zemirco/json2csv/commit/24a7893))
|
||||||
|
* Rename unwindPath to unwind ([#230](https://github.com/zemirco/json2csv/issues/230)) ([7143bc7](https://github.com/zemirco/json2csv/commit/7143bc7))
|
||||||
|
* Streamify pretty print ([#248](https://github.com/zemirco/json2csv/issues/248)) ([fb7ad53](https://github.com/zemirco/json2csv/commit/fb7ad53))
|
||||||
|
|
||||||
|
|
||||||
|
### Chores
|
||||||
|
|
||||||
|
* Refactor the entire library to ES6 ([#233](https://github.com/zemirco/json2csv/issues/233)) ([dce4d33](https://github.com/zemirco/json2csv/commit/dce4d33))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add doubleQuote to cli, rename other options to line up with the cli ([5e402dc](https://github.com/zemirco/json2csv/commit/5e402dc))
|
||||||
|
* Add fields config option to CLI ([#245](https://github.com/zemirco/json2csv/issues/245)) ([74ef666](https://github.com/zemirco/json2csv/commit/74ef666))
|
||||||
|
* Add streaming API ([#235](https://github.com/zemirco/json2csv/issues/235)) ([01ca93e](https://github.com/zemirco/json2csv/commit/01ca93e))
|
||||||
|
* Split tests in multiple files ([#246](https://github.com/zemirco/json2csv/issues/246)) ([839de77](https://github.com/zemirco/json2csv/commit/839de77))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* Replaces field-list with field-config
|
||||||
|
* Remove `preserveNewLinesInValues` option, preserve by default
|
||||||
|
|
||||||
|
* Refactor the entire library to ES6
|
||||||
|
|
||||||
|
* Fix PR issues
|
||||||
|
|
||||||
|
* Add strict mode for node 4.X
|
||||||
|
* Remove fieldNames
|
||||||
|
|
||||||
|
* Increase coverage back to 100%
|
||||||
|
* callback is no longer available, just return the csv from the json2csv.
|
||||||
|
|
||||||
|
- updated tests
|
||||||
|
- updated readme
|
||||||
|
* * Rename unwindPath to unwind
|
||||||
|
|
||||||
|
* Fix field-list in CLI
|
||||||
|
* newLine removed, eol kept.
|
||||||
|
* Rename del to delimiter to match the cli flag
|
||||||
|
* Rename quotes to quote to match the cli flag
|
||||||
|
|
||||||
|
* Remove unused double quotes comment
|
||||||
|
|
||||||
|
* Fix noHeader in CLI
|
||||||
|
|
||||||
|
* Revert "Remove unused double quotes comment"
|
||||||
|
|
||||||
|
This reverts commit 250d3e6ddf3062cbdc1e0174493a37fa21197d8e.
|
||||||
|
|
||||||
|
* Add doubleQuote to CLI
|
||||||
|
* Rename hasCSVColumnTitle to noHeader to keep in line with the CLI
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.11.5"></a>
|
||||||
|
## [3.11.5](https://github.com/zemirco/json2csv/compare/v3.11.4...v3.11.5) (2017-10-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* backslash value not escaped properly ([#202](https://github.com/zemirco/json2csv/issues/202)) ([#204](https://github.com/zemirco/json2csv/issues/204)) ([2cf50f1](https://github.com/zemirco/json2csv/commit/2cf50f1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.11.4"></a>
|
||||||
|
## [3.11.4](https://github.com/zemirco/json2csv/compare/v3.11.3...v3.11.4) (2017-10-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **security:** Update debug to 3.1.0 for security reasons ([9c7cfaa](https://github.com/zemirco/json2csv/commit/9c7cfaa))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.11.3"></a>
|
||||||
|
## [3.11.3](https://github.com/zemirco/json2csv/compare/v3.11.2...v3.11.3) (2017-10-09)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.11.2"></a>
|
||||||
|
## [3.11.2](https://github.com/zemirco/json2csv/compare/v3.11.1...v3.11.2) (2017-09-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Remove extra space character in mode withBOM: true [#190](https://github.com/zemirco/json2csv/issues/190) ([#194](https://github.com/zemirco/json2csv/issues/194)) ([e8b6f6b](https://github.com/zemirco/json2csv/commit/e8b6f6b))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.11.1"></a>
|
||||||
|
## [3.11.1](https://github.com/zemirco/json2csv/compare/v3.11.0...v3.11.1) (2017-08-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **cli:** pass BOM cli option to function ([#193](https://github.com/zemirco/json2csv/issues/193)) ([70cfdfe](https://github.com/zemirco/json2csv/commit/70cfdfe))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.11.0"></a>
|
||||||
|
# [3.11.0](https://github.com/zemirco/json2csv/compare/v3.10.0...v3.11.0) (2017-08-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Handle dates without double-escaping ([#189](https://github.com/zemirco/json2csv/issues/189)) ([ff514ba](https://github.com/zemirco/json2csv/commit/ff514ba))
|
||||||
|
* unwind parameter in command line mode ([#191](https://github.com/zemirco/json2csv/issues/191)) ([e706c25](https://github.com/zemirco/json2csv/commit/e706c25))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Added flag to signal if resulting function value should be stringified or not ([#192](https://github.com/zemirco/json2csv/issues/192)) ([aaa6b05](https://github.com/zemirco/json2csv/commit/aaa6b05))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.10.0"></a>
|
||||||
|
# [3.10.0](https://github.com/zemirco/json2csv/compare/v3.9.1...v3.10.0) (2017-07-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add BOM character option ([#187](https://github.com/zemirco/json2csv/issues/187)) ([0c799ca](https://github.com/zemirco/json2csv/commit/0c799ca))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.9.1"></a>
|
||||||
|
## [3.9.1](https://github.com/zemirco/json2csv/compare/v3.9.0...v3.9.1) (2017-07-14)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.9.0"></a>
|
||||||
|
# [3.9.0](https://github.com/zemirco/json2csv/compare/v3.8.0...v3.9.0) (2017-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Parameter unwindPath for multiple fields ([#174](https://github.com/zemirco/json2csv/issues/174)) ([#183](https://github.com/zemirco/json2csv/issues/183)) ([fbcaa10](https://github.com/zemirco/json2csv/commit/fbcaa10))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.8.0"></a>
|
||||||
|
# [3.8.0](https://github.com/zemirco/json2csv/compare/v3.7.3...v3.8.0) (2017-07-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **docs:** Add a coma in the ReadMe example ([#181](https://github.com/zemirco/json2csv/issues/181)) ([abeb820](https://github.com/zemirco/json2csv/commit/abeb820))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Preserve new lines in cells with option `preserveNewLinesInValues` ([#91](https://github.com/zemirco/json2csv/issues/91)) ([#171](https://github.com/zemirco/json2csv/issues/171)) ([187b701](https://github.com/zemirco/json2csv/commit/187b701))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="3.7.3"></a>
|
||||||
|
## [3.7.3](https://github.com/zemirco/json2csv/compare/v3.7.1...v3.7.3) (2016-12-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **jsdoc:** JSDoc Editting ([#155](https://github.com/zemirco/json2csv/issues/155)) ([76075d6](https://github.com/zemirco/json2csv/commit/76075d6))
|
||||||
|
* **ts:** Fix type definition ([#154](https://github.com/zemirco/json2csv/issues/154)) ([fae53a1](https://github.com/zemirco/json2csv/commit/fae53a1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 3.6.3 / 2016-08-17
|
||||||
|
|
||||||
|
* Fix crashing on EPIPE error [#134](https://github.com/zemirco/json2csv/pull/134)
|
||||||
|
* Add UMD build for browser usage [#136](https://github.com/zemirco/json2csv/pull/136)
|
||||||
|
* Add docs during prepublish
|
||||||
|
|
||||||
|
## 3.6.2 / 2016-07-22
|
||||||
|
|
||||||
|
* Remove debugger, see [#132](https://github.com/zemirco/json2csv/pull/132)
|
||||||
|
* Fix changelog typo
|
||||||
|
|
||||||
|
## 3.6.1 / 2016-07-12
|
||||||
|
|
||||||
|
* Fix auto-fields returning all available fields, even if not available on the first object, see #104
|
||||||
|
|
||||||
|
## 3.6.0 / 2016-07-07
|
||||||
|
|
||||||
|
* Make callback optional
|
||||||
|
* Make callback use `process.nextTick`, so it's not sync
|
||||||
|
|
||||||
|
Thanks @STRML!
|
||||||
|
|
||||||
|
## 3.5.1 / 2016-06-29
|
||||||
|
|
||||||
|
* Revert [#114](https://github.com/zemirco/json2csv/pull/114), due to more issues
|
||||||
|
* Update npmignore
|
||||||
|
* Add a changelog
|
||||||
|
* Updatee readme
|
||||||
|
|
||||||
|
## 3.5.0 / 2016-06-21
|
||||||
|
|
||||||
|
* `includeEmptyRows` options added, see [#122](https://github.com/zemirco/json2csv/pull/122) (Thanks @glutentag)
|
||||||
|
* `-a` or `--include-empty-rows` added for the CLI.
|
||||||
|
|
||||||
|
## 2.2.1 / 2013-11-10
|
||||||
|
|
||||||
|
* mainly for development e.g. adding code format, update readme..
|
||||||
|
|
||||||
|
## 2.2.0 / 2013-11-08
|
||||||
|
|
||||||
|
* not create CSV column title by passing hasCSVColumnTitle: false, into params.
|
||||||
|
* if field is not exist in object then the field value in CSV will be empty.
|
||||||
|
* fix data in object format - {...}
|
||||||
|
|
||||||
|
## 2.1.0 / 2013-06-11
|
||||||
|
|
||||||
|
* quote titles in the first row
|
||||||
|
|
||||||
|
## 2.0.0 / 2013-03-04
|
||||||
|
|
||||||
|
* err in callback function
|
||||||
|
|
||||||
|
## 1.3.1 / 2013-02-20
|
||||||
|
|
||||||
|
* fix stdin encoding
|
||||||
|
|
||||||
|
## 1.3.0 / 2013-02-20
|
||||||
|
|
||||||
|
* support reading from stdin [#9](https://github.com/zeMirco/json2csv/pull/9)
|
||||||
|
|
||||||
|
## 1.2.0 / 2013-02-20
|
||||||
|
|
||||||
|
* support custom field names [#8](https://github.com/zeMirco/json2csv/pull/8)
|
||||||
|
|
||||||
|
## 1.1.0 / 2013-01-19
|
||||||
|
|
||||||
|
* add optional custom delimiter
|
14
node_modules/json2csv/LICENSE.md
generated
vendored
Normal file
14
node_modules/json2csv/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Copyright (C) 2012 [Mirco Zeiss](mailto: mirco.zeiss@gmail.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
||||||
|
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
||||||
|
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||||
|
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||||
|
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
970
node_modules/json2csv/README.md
generated
vendored
Normal file
970
node_modules/json2csv/README.md
generated
vendored
Normal file
|
@ -0,0 +1,970 @@
|
||||||
|
# json2csv
|
||||||
|
|
||||||
|
Converts json into csv with column titles and proper line endings.
|
||||||
|
Can be used as a module and from the command line.
|
||||||
|
|
||||||
|
[![npm version][npm-badge]][npm-badge-url]
|
||||||
|
[![Build Status][travis-badge]][travis-badge-url]
|
||||||
|
[![Coverage Status][coveralls-badge]][coveralls-badge-url]
|
||||||
|
|
||||||
|
See the [CHANGELOG] for details about the latest release.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Fast and lightweight
|
||||||
|
- Scalable to infinitely large datasets (using stream processing)
|
||||||
|
- Support for standard JSON as well as NDJSON
|
||||||
|
- Advanced data selection (automatic field discovery, underscore-like selectors, custom data getters, default values for missing fields, transforms, etc.)
|
||||||
|
- Highly customizable (supportting custom quotation marks, delimiters, eol values, etc.)
|
||||||
|
- Automatic escaping (preserving new lines, quotes, etc. in them)
|
||||||
|
- Optional headers
|
||||||
|
- Unicode encoding support
|
||||||
|
- Pretty printing in table format to stdout
|
||||||
|
|
||||||
|
## How to install
|
||||||
|
|
||||||
|
You can install json2csv as a dependency using NPM.
|
||||||
|
Requires **Node v10** or higher.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Global so it can be called from anywhere
|
||||||
|
$ npm install -g json2csv
|
||||||
|
# or as a dependency of a project
|
||||||
|
$ npm install json2csv --save
|
||||||
|
```
|
||||||
|
|
||||||
|
Also, if you are loading json2csv directly to the browser you can pull it directly from the CDN.
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/json2csv"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, the above script will get the latest release of json2csv. You can also specify a specific version:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/json2csv@4.2.1"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Command Line Interface
|
||||||
|
|
||||||
|
`json2csv` can be called from the command line if installed globally (using the `-g` flag).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Usage: json2csv [options]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-V, --version output the version number
|
||||||
|
-i, --input <input> Path and name of the incoming json file. Defaults to stdin.
|
||||||
|
-o, --output <output> Path and name of the resulting csv file. Defaults to stdout.
|
||||||
|
-c, --config <path> Specify a file with a valid JSON configuration.
|
||||||
|
-n, --ndjson Treat the input as NewLine-Delimited JSON.
|
||||||
|
-s, --no-streaming Process the whole JSON array in memory instead of doing it line by line.
|
||||||
|
-f, --fields <fields> List of fields to process. Defaults to field auto-detection.
|
||||||
|
-v, --default-value <defaultValue> Default value to use for missing fields.
|
||||||
|
-q, --quote <quote> Character(s) to use as quote mark. Defaults to '"'.
|
||||||
|
-Q, --escaped-quote <escapedQuote> Character(s) to use as a escaped quote. Defaults to a double `quote`, '""'.
|
||||||
|
-d, --delimiter <delimiter> Character(s) to use as delimiter. Defaults to ','. (default: ",")
|
||||||
|
-e, --eol <eol> Character(s) to use as End-of-Line for separating rows. Defaults to '\n'. (default: "\n")
|
||||||
|
-E, --excel-strings Wraps string data to force Excel to interpret it as string even if it contains a number.
|
||||||
|
-H, --no-header Disable the column name header.
|
||||||
|
-a, --include-empty-rows Includes empty rows in the resulting CSV output.
|
||||||
|
-b, --with-bom Includes BOM character at the beginning of the CSV.
|
||||||
|
-p, --pretty Print output as a pretty table. Use only when printing to console.
|
||||||
|
--unwind [paths] Creates multiple rows from a single JSON document similar to MongoDB unwind.
|
||||||
|
--unwind-blank When unwinding, blank out instead of repeating data. Defaults to false. (default: false)
|
||||||
|
--flatten-objects Flatten nested objects. Defaults to false. (default: false)
|
||||||
|
--flatten-arrays Flatten nested arrays. Defaults to false. (default: false)
|
||||||
|
--flatten-separator <separator> Flattened keys separator. Defaults to '.'. (default: ".")
|
||||||
|
-h, --help output usage information
|
||||||
|
```
|
||||||
|
|
||||||
|
If no input `-i` is specified the result is expected from to the console standard input.
|
||||||
|
If no output `-o` is specified the result is printed to the console standard output.
|
||||||
|
If no fields `-f` or config `-c` are passed the fields of the first element are used since json2csv CLI process the items one at a time. You can use the `--no-streaming` flag to load the entire JSON in memory and get all the headers. However, keep in mind that this is slower and requires much more memory.
|
||||||
|
Use `-p` to show the result as a table in the console.
|
||||||
|
|
||||||
|
Any option passed through the config file `-c` will be overriden if a specific flag is passed as well. For example, the fields option of the config will be overriden if the fields flag `-f` is used.
|
||||||
|
|
||||||
|
### CLI examples
|
||||||
|
|
||||||
|
All examples use this example [input file](https://github.com/zemirco/json2csv/blob/master/test/fixtures/json/default.json).
|
||||||
|
|
||||||
|
#### Input file and specify fields
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ json2csv -i input.json -f carModel,price,color
|
||||||
|
carModel,price,color
|
||||||
|
"Audi",10000,"blue"
|
||||||
|
"BMW",15000,"red"
|
||||||
|
"Mercedes",20000,"yellow"
|
||||||
|
"Porsche",30000,"green"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Input file, specify fields and use pretty logging
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ json2csv -i input.json -f carModel,price,color -p
|
||||||
|
```
|
||||||
|
|
||||||
|
![Screenshot](https://s3.amazonaws.com/zeMirco/github/json2csv/json2csv-pretty.png)
|
||||||
|
|
||||||
|
#### Generating CSV containing only specific fields
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ json2csv -i input.json -f carModel,price,color -o out.csv
|
||||||
|
$ cat out.csv
|
||||||
|
carModel,price,color
|
||||||
|
"Audi",10000,"blue"
|
||||||
|
"BMW",15000,"red"
|
||||||
|
"Mercedes",20000,"yellow"
|
||||||
|
"Porsche",30000,"green"
|
||||||
|
```
|
||||||
|
|
||||||
|
Same result will be obtained passing the fields config as a file.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ json2csv -i input.json -c fieldsConfig.json -o out.csv
|
||||||
|
```
|
||||||
|
|
||||||
|
where the file `fieldsConfig.json` contains
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
"carModel",
|
||||||
|
"price",
|
||||||
|
"color"
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Read input from stdin
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ json2csv -f price
|
||||||
|
[{"price":1000},{"price":2000}]
|
||||||
|
```
|
||||||
|
|
||||||
|
Hit <kbd>Enter</kbd> and afterwards <kbd>CTRL</kbd> + <kbd>D</kbd> to end reading from stdin. The terminal should show
|
||||||
|
|
||||||
|
```
|
||||||
|
price
|
||||||
|
1000
|
||||||
|
2000
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Appending to existing CSV
|
||||||
|
|
||||||
|
Sometimes you want to add some additional rows with the same columns.
|
||||||
|
This is how you can do that.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Initial creation of csv with headings
|
||||||
|
$ json2csv -i test.json -f name,version > test.csv
|
||||||
|
# Append additional rows
|
||||||
|
$ json2csv -i test.json -f name,version --no-header >> test.csv
|
||||||
|
```
|
||||||
|
|
||||||
|
## Javascript module
|
||||||
|
|
||||||
|
`json2csv` can also be use programatically from you javascript codebase.
|
||||||
|
|
||||||
|
### Available Options
|
||||||
|
|
||||||
|
The programatic APIs take a configuration object very equivalent to the CLI options.
|
||||||
|
|
||||||
|
- `fields` - Array of Objects/Strings. Defaults to toplevel JSON attributes. See example below.
|
||||||
|
- `ndjson` - Only effective on the streaming API. Indicates that data coming through the stream is NDJSON.
|
||||||
|
- `transforms` - Array of transforms to be applied to each data item. A transform is simply a function that receives a data item and returns the transformed item.
|
||||||
|
- `defaultValue` - String, default value to use when missing data. Defaults to `<empty>` if not specified. (Overridden by `fields[].default`)
|
||||||
|
- `quote` - String, quote around cell values and column names. Defaults to `"` if not specified.
|
||||||
|
- `escapedQuote` - String, the value to replace escaped quotes in strings. Defaults to 2x`quotes` (for example `""`) if not specified.
|
||||||
|
- `delimiter` - String, delimiter of columns. Defaults to `,` if not specified.
|
||||||
|
- `eol` - String, overrides the default OS line ending (i.e. `\n` on Unix and `\r\n` on Windows).
|
||||||
|
- `excelStrings` - Boolean, converts string data into normalized Excel style data.
|
||||||
|
- `header` - Boolean, determines whether or not CSV file will contain a title column. Defaults to `true` if not specified.
|
||||||
|
- `includeEmptyRows` - Boolean, includes empty rows. Defaults to `false`.
|
||||||
|
- `withBOM` - Boolean, with BOM character. Defaults to `false`.
|
||||||
|
|
||||||
|
### json2csv parser (Synchronous API)
|
||||||
|
|
||||||
|
`json2csv` can also be used programatically as a synchronous converter using its `parse` method.
|
||||||
|
```js
|
||||||
|
const { Parser } = require('json2csv');
|
||||||
|
|
||||||
|
const fields = ['field1', 'field2', 'field3'];
|
||||||
|
const opts = { fields };
|
||||||
|
|
||||||
|
try {
|
||||||
|
const parser = new Parser(opts);
|
||||||
|
const csv = parser.parse(myData);
|
||||||
|
console.log(csv);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
you can also use the convenience method `parse`
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { parse } = require('json2csv');
|
||||||
|
|
||||||
|
const fields = ['field1', 'field2', 'field3'];
|
||||||
|
const opts = { fields };
|
||||||
|
|
||||||
|
try {
|
||||||
|
const csv = parse(myData, opts);
|
||||||
|
console.log(csv);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Both of the methods above load the entire JSON in memory and do the whole processing in-memory while blocking Javascript event loop. For that reason is rarely a good reason to use it until your data is very small or your application doesn't do anything else.
|
||||||
|
|
||||||
|
### json2csv async parser (Streaming API)
|
||||||
|
|
||||||
|
The synchronous API has the downside of loading the entire JSON array in memory and blocking javascript's event loop while processing the data. This means that your server won't be able to process more request or your UI will become irresponsive while data is being processed. For those reasons, is rarely a good reason to use it unless your data is very small or your application doesn't do anything else.
|
||||||
|
|
||||||
|
The async parser process the data as a non-blocking stream. This approach ensures a consistent memory footprint and avoid blocking javascript's event loop. Thus, it's better suited for large datasets or system with high concurrency.
|
||||||
|
|
||||||
|
One very important difference between the asynchronous and the synchronous APIs is that using the asynchronous API json objects are processed one by one. In practice, this means that only the fields in the first object of the array are automatically detected and other fields are just ignored. To avoid this, it's advisable to ensure that all the objects contain exactly the same fields or provide the list of fields using the `fields` option.
|
||||||
|
|
||||||
|
The async API uses takes a second options arguments that's directly passed to the underlying streams and accept the same options as the standard [Node.js streams](https://nodejs.org/api/stream.html#stream_new_stream_duplex_options).
|
||||||
|
|
||||||
|
Instances of `AsyncParser` expose three objects:
|
||||||
|
* *input:* Which allows to push more data
|
||||||
|
* *processor:* A readable string representing the whole data processing. You can listen to all the standard events of Node.js streams.
|
||||||
|
* *transform:* The json2csv transform. See bellow for more details.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { AsyncParser } = require('json2csv');
|
||||||
|
|
||||||
|
const fields = ['field1', 'field2', 'field3'];
|
||||||
|
const opts = { fields };
|
||||||
|
const transformOpts = { highWaterMark: 8192 };
|
||||||
|
|
||||||
|
const asyncParser = new AsyncParser(opts, transformOpts);
|
||||||
|
|
||||||
|
let csv = '';
|
||||||
|
asyncParser.processor
|
||||||
|
.on('data', chunk => (csv += chunk.toString()))
|
||||||
|
.on('end', () => console.log(csv))
|
||||||
|
.on('error', err => console.error(err));
|
||||||
|
|
||||||
|
// You can also listen for events on the conversion and see how the header or the lines are coming out.
|
||||||
|
asyncParser.transform
|
||||||
|
.on('header', header => console.log(header))
|
||||||
|
.on('line', line => console.log(line))
|
||||||
|
.on('error', err => console.log(err));
|
||||||
|
|
||||||
|
asyncParser.input.push(data); // This data might come from an HTTP request, etc.
|
||||||
|
asyncParser.input.push(null); // Sending `null` to a stream signal that no more data is expected and ends it.
|
||||||
|
```
|
||||||
|
|
||||||
|
`AsyncParser` also exposes some convenience methods:
|
||||||
|
* `fromInput` allows you to set the input stream.
|
||||||
|
* `throughTransform` allows you to add transforms to the stream.
|
||||||
|
* `toOutput` allows you to set the output stream.
|
||||||
|
* `promise` returns a promise that resolves when the stream ends or errors. Takes a boolean parameter to indicate if the resulting CSV should be kept in-memory and be resolved by the promise.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { createReadStream, createWriteStream } = require('fs');
|
||||||
|
const { AsyncParser } = require('json2csv');
|
||||||
|
|
||||||
|
const fields = ['field1', 'field2', 'field3'];
|
||||||
|
const opts = { fields };
|
||||||
|
const transformOpts = { highWaterMark: 8192 };
|
||||||
|
|
||||||
|
// Using the promise API
|
||||||
|
const input = createReadStream(inputPath, { encoding: 'utf8' });
|
||||||
|
const asyncParser = new JSON2CSVAsyncParser(opts, transformOpts);
|
||||||
|
const parsingProcessor = asyncParser.fromInput(input);
|
||||||
|
|
||||||
|
parsingProcessor.promise()
|
||||||
|
.then(csv => console.log(csv))
|
||||||
|
.catch(err => console.error(err));
|
||||||
|
|
||||||
|
// Using the promise API just to know when the process finnish
|
||||||
|
// but not actually load the CSV in memory
|
||||||
|
const input = createReadStream(inputPath, { encoding: 'utf8' });
|
||||||
|
const output = createWriteStream(outputPath, { encoding: 'utf8' });
|
||||||
|
const asyncParser = new JSON2CSVAsyncParser(opts, transformOpts);
|
||||||
|
const parsingProcessor = asyncParser.fromInput(input).toOutput(output);
|
||||||
|
|
||||||
|
parsingProcessor.promise(false).catch(err => console.error(err));
|
||||||
|
```
|
||||||
|
|
||||||
|
you can also use the convenience method `parseAsync` which accept both JSON arrays/objects and readable streams and returns a promise.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { parseAsync } = require('json2csv');
|
||||||
|
|
||||||
|
const fields = ['field1', 'field2', 'field3'];
|
||||||
|
const opts = { fields };
|
||||||
|
|
||||||
|
parseAsync(myData, opts)
|
||||||
|
.then(csv => console.log(csv))
|
||||||
|
.catch(err => console.error(err));
|
||||||
|
```
|
||||||
|
|
||||||
|
### json2csv transform (Streaming API)
|
||||||
|
|
||||||
|
json2csv also exposes the raw stream transform so you can pipe your json content into it. This is the same Transform that `AsyncParser` uses under the hood.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { createReadStream, createWriteStream } = require('fs');
|
||||||
|
const { Transform } = require('json2csv');
|
||||||
|
|
||||||
|
const fields = ['field1', 'field2', 'field3'];
|
||||||
|
const opts = { fields };
|
||||||
|
const transformOpts = { highWaterMark: 16384, encoding: 'utf-8' };
|
||||||
|
|
||||||
|
const input = createReadStream(inputPath, { encoding: 'utf8' });
|
||||||
|
const output = createWriteStream(outputPath, { encoding: 'utf8' });
|
||||||
|
const json2csv = new Transform(opts, transformOpts);
|
||||||
|
|
||||||
|
const processor = input.pipe(json2csv).pipe(output);
|
||||||
|
|
||||||
|
// You can also listen for events on the conversion and see how the header or the lines are coming out.
|
||||||
|
json2csv
|
||||||
|
.on('header', header => console.log(header))
|
||||||
|
.on('line', line => console.log(line))
|
||||||
|
.on('error', err => console.log(err));
|
||||||
|
```
|
||||||
|
|
||||||
|
The stream API can also work on object mode. This is useful when you have an input stream in object mode or if you are getting JSON objects one by one and want to convert them to CSV as they come.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Transform } = require("json2csv");
|
||||||
|
const { Readable } = require('stream');
|
||||||
|
|
||||||
|
const input = new Readable({ objectMode: true });
|
||||||
|
input._read = () => {};
|
||||||
|
// myObjectEmitter is just a fake example representing anything that emit objects.
|
||||||
|
myObjectEmitter.on('object', obj => input.push(obj));
|
||||||
|
// Pushing a null close the stream
|
||||||
|
myObjectEmitter.end(() => input.push(null));
|
||||||
|
|
||||||
|
const output = process.stdout;
|
||||||
|
|
||||||
|
const opts = {};
|
||||||
|
const transformOpts = { objectMode: true };
|
||||||
|
|
||||||
|
const json2csv = new Transform(opts, transformOpts);
|
||||||
|
const processor = input.pipe(json2csv).pipe(output);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Data transforms
|
||||||
|
|
||||||
|
json2csv supports data transforms. A transform is simply a function that receives a data item and returns the transformed item.
|
||||||
|
|
||||||
|
|
||||||
|
#### Custom transforms
|
||||||
|
|
||||||
|
```js
|
||||||
|
function (item) {
|
||||||
|
// apply tranformations or create new object
|
||||||
|
return transformedItem;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
or using ES6
|
||||||
|
```js
|
||||||
|
(item) => {
|
||||||
|
// apply tranformations or create new object
|
||||||
|
return transformedItem;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For example, let's add a line counter to our CSV, capitalize the car field and change the price to be in Ks (1000s).
|
||||||
|
```js
|
||||||
|
let counter = 1;
|
||||||
|
(item) => ({ counter: counter++, ...item, car: item.car.toUpperCase(), price: item.price / 1000 });
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Built-in transforms
|
||||||
|
|
||||||
|
There is a number of built-in transform provider by the library.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { transforms: { unwind, flatten } } = require('json2csv');
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Unwind
|
||||||
|
|
||||||
|
The unwind transform deconstructs an array field from the input item to output a row for each element. Is's similar to MongoDB's $unwind aggregation.
|
||||||
|
|
||||||
|
The transform needs to be instantiated and takes an options object as arguments containing:
|
||||||
|
- `paths` - Array of String, list the paths to the fields to be unwound. It's mandatory and should not be empty.
|
||||||
|
- `blankOut` - Boolean, unwind using blank values instead of repeating data. Defaults to `false`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Default
|
||||||
|
unwind({ paths: ['fieldToUnwind'] });
|
||||||
|
|
||||||
|
// Blanking out repeated data
|
||||||
|
unwind({ paths: ['fieldToUnwind'], blankOut: true });
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Flatten
|
||||||
|
Flatten nested javascript objects into a single level object.
|
||||||
|
|
||||||
|
The transform needs to be instantiated and takes an options object as arguments containing:
|
||||||
|
- `objects` - Boolean, whether to flatten JSON objects or not. Defaults to `true`.
|
||||||
|
- `arrays`- Boolean, whether to flatten Arrays or not. Defaults to `false`.
|
||||||
|
- `separator` - String, separator to use between nested JSON keys when flattening a field. Defaults to `.`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Default
|
||||||
|
flatten();
|
||||||
|
|
||||||
|
// Custom separator '__'
|
||||||
|
flatten({ separator: '_' });
|
||||||
|
|
||||||
|
// Flatten only arrays
|
||||||
|
flatten({ objects: false, arrays: true });
|
||||||
|
```
|
||||||
|
|
||||||
|
### Javascript module examples
|
||||||
|
|
||||||
|
#### Example `fields` option
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
fields: [
|
||||||
|
// Supports pathname -> pathvalue
|
||||||
|
'simplepath', // equivalent to {value:'simplepath'}
|
||||||
|
'path.to.value' // also equivalent to {value:'path.to.value'}
|
||||||
|
|
||||||
|
// Supports label -> simple path
|
||||||
|
{
|
||||||
|
label: 'some label', // Optional, column will be labeled 'path.to.something' if not defined)
|
||||||
|
value: 'path.to.something', // data.path.to.something
|
||||||
|
default: 'NULL' // default if value is not found (Optional, overrides `defaultValue` for column)
|
||||||
|
},
|
||||||
|
|
||||||
|
// Supports label -> derived value
|
||||||
|
{
|
||||||
|
label: 'some label', // Optional, column will be labeled with the function name or empty if the function is anonymous
|
||||||
|
value: (row, field) => row[field.label].toLowerCase() ||field.default,
|
||||||
|
default: 'NULL' // default if value function returns null or undefined
|
||||||
|
},
|
||||||
|
|
||||||
|
// Supports label -> derived value
|
||||||
|
{
|
||||||
|
value: (row) => row.arrayField.join(',')
|
||||||
|
},
|
||||||
|
|
||||||
|
// Supports label -> derived value
|
||||||
|
{
|
||||||
|
value: (row) => `"${row.arrayField.join(',')}"`
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example 1
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Parser } = require('json2csv');
|
||||||
|
|
||||||
|
const myCars = [
|
||||||
|
{
|
||||||
|
"car": "Audi",
|
||||||
|
"price": 40000,
|
||||||
|
"color": "blue"
|
||||||
|
}, {
|
||||||
|
"car": "BMW",
|
||||||
|
"price": 35000,
|
||||||
|
"color": "black"
|
||||||
|
}, {
|
||||||
|
"car": "Porsche",
|
||||||
|
"price": 60000,
|
||||||
|
"color": "green"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const json2csvParser = new Parser();
|
||||||
|
const csv = json2csvParser.parse(myCars);
|
||||||
|
|
||||||
|
console.log(csv);
|
||||||
|
```
|
||||||
|
|
||||||
|
will output to console
|
||||||
|
|
||||||
|
```
|
||||||
|
"car", "price", "color"
|
||||||
|
"Audi", 40000, "blue"
|
||||||
|
"BMW", 35000, "black"
|
||||||
|
"Porsche", 60000, "green"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example 2
|
||||||
|
|
||||||
|
You can choose which fields to include in the CSV.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Parser } = require('json2csv');
|
||||||
|
const fields = ['car', 'color'];
|
||||||
|
|
||||||
|
const json2csvParser = new Parser({ fields });
|
||||||
|
const csv = json2csvParser.parse(myCars);
|
||||||
|
|
||||||
|
console.log(csv);
|
||||||
|
```
|
||||||
|
|
||||||
|
will output to console
|
||||||
|
|
||||||
|
```
|
||||||
|
"car", "color"
|
||||||
|
"Audi", "blue"
|
||||||
|
"BMW", "black"
|
||||||
|
"Porsche", "green"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example 3
|
||||||
|
|
||||||
|
You can choose custom column names for the exported file.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Parser } = require('json2csv');
|
||||||
|
|
||||||
|
const fields = [{
|
||||||
|
label: 'Car Name',
|
||||||
|
value: 'car'
|
||||||
|
},{
|
||||||
|
label: 'Price USD',
|
||||||
|
value: 'price'
|
||||||
|
}];
|
||||||
|
|
||||||
|
const json2csvParser = new Parser({ fields });
|
||||||
|
const csv = json2csvParser.parse(myCars);
|
||||||
|
|
||||||
|
console.log(csv);
|
||||||
|
```
|
||||||
|
|
||||||
|
will output to console
|
||||||
|
|
||||||
|
```
|
||||||
|
"Car Name", "Price USD"
|
||||||
|
"Audi", 40000
|
||||||
|
"BMW", 35000
|
||||||
|
"Porsche", 60000
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example 4
|
||||||
|
|
||||||
|
You can also specify nested properties using dot notation.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Parser } = require('json2csv');
|
||||||
|
|
||||||
|
const myCars = [
|
||||||
|
{
|
||||||
|
"car": { "make": "Audi", "model": "A3" },
|
||||||
|
"price": 40000,
|
||||||
|
"color": "blue"
|
||||||
|
}, {
|
||||||
|
"car": { "make": "BMW", "model": "F20" },
|
||||||
|
"price": 35000,
|
||||||
|
"color": "black"
|
||||||
|
}, {
|
||||||
|
"car": { "make": "Porsche", "model": "9PA AF1" },
|
||||||
|
"price": 60000,
|
||||||
|
"color": "green"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const fields = ['car.make', 'car.model', 'price', 'color'];
|
||||||
|
|
||||||
|
const json2csvParser = new Parser({ fields });
|
||||||
|
const csv = json2csvParser.parse(myCars);
|
||||||
|
|
||||||
|
console.log(csv);
|
||||||
|
```
|
||||||
|
|
||||||
|
will output to console
|
||||||
|
|
||||||
|
```
|
||||||
|
"car.make", "car.model", "price", "color"
|
||||||
|
"Audi", "A3", 40000, "blue"
|
||||||
|
"BMW", "F20", 35000, "black"
|
||||||
|
"Porsche", "9PA AF1", 60000, "green"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example 5
|
||||||
|
|
||||||
|
Use a custom delimiter to create tsv files using the delimiter option:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Parser } = require('json2csv');
|
||||||
|
|
||||||
|
const json2csvParser = new Parser({ delimiter: '\t' });
|
||||||
|
const tsv = json2csvParser.parse(myCars);
|
||||||
|
|
||||||
|
console.log(tsv);
|
||||||
|
```
|
||||||
|
|
||||||
|
will output to console
|
||||||
|
|
||||||
|
```
|
||||||
|
"car" "price" "color"
|
||||||
|
"Audi" 10000 "blue"
|
||||||
|
"BMW" 15000 "red"
|
||||||
|
"Mercedes" 20000 "yellow"
|
||||||
|
"Porsche" 30000 "green"
|
||||||
|
```
|
||||||
|
|
||||||
|
If no delimiter is specified, the default `,` is used.
|
||||||
|
|
||||||
|
#### Example 6
|
||||||
|
|
||||||
|
You can choose custom quotation marks.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Parser } = require('json2csv');
|
||||||
|
|
||||||
|
const json2csvParser = new Parser({ quote: '' });
|
||||||
|
const csv = json2csvParser.parse(myCars);
|
||||||
|
|
||||||
|
console.log(csv);
|
||||||
|
```
|
||||||
|
|
||||||
|
will output to console
|
||||||
|
|
||||||
|
```
|
||||||
|
car, price, color
|
||||||
|
Audi, 40000, blue
|
||||||
|
BMW", 35000, black
|
||||||
|
Porsche", 60000, green
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example 7
|
||||||
|
|
||||||
|
You can unwind arrays similar to MongoDB's $unwind operation using the `unwind` transform.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Parser, transforms: { unwind } } = require('json2csv');
|
||||||
|
|
||||||
|
const myCars = [
|
||||||
|
{
|
||||||
|
"carModel": "Audi",
|
||||||
|
"price": 0,
|
||||||
|
"colors": ["blue","green","yellow"]
|
||||||
|
}, {
|
||||||
|
"carModel": "BMW",
|
||||||
|
"price": 15000,
|
||||||
|
"colors": ["red","blue"]
|
||||||
|
}, {
|
||||||
|
"carModel": "Mercedes",
|
||||||
|
"price": 20000,
|
||||||
|
"colors": "yellow"
|
||||||
|
}, {
|
||||||
|
"carModel": "Porsche",
|
||||||
|
"price": 30000,
|
||||||
|
"colors": ["green","teal","aqua"]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const fields = ['carModel', 'price', 'colors'];
|
||||||
|
const transforms = [unwind({ paths: ['colors'] })];
|
||||||
|
|
||||||
|
const json2csvParser = new Parser({ fields, transforms });
|
||||||
|
const csv = json2csvParser.parse(myCars);
|
||||||
|
|
||||||
|
console.log(csv);
|
||||||
|
```
|
||||||
|
|
||||||
|
will output to console
|
||||||
|
|
||||||
|
```
|
||||||
|
"carModel","price","colors"
|
||||||
|
"Audi",0,"blue"
|
||||||
|
"Audi",0,"green"
|
||||||
|
"Audi",0,"yellow"
|
||||||
|
"BMW",15000,"red"
|
||||||
|
"BMW",15000,"blue"
|
||||||
|
"Mercedes",20000,"yellow"
|
||||||
|
"Porsche",30000,"green"
|
||||||
|
"Porsche",30000,"teal"
|
||||||
|
"Porsche",30000,"aqua"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example 8
|
||||||
|
|
||||||
|
You can also unwind arrays multiple times or with nested objects.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Parser, transforms: { unwind } } = require('json2csv');
|
||||||
|
|
||||||
|
const myCars = [
|
||||||
|
{
|
||||||
|
"carModel": "BMW",
|
||||||
|
"price": 15000,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "airbag",
|
||||||
|
"color": "white"
|
||||||
|
}, {
|
||||||
|
"name": "dashboard",
|
||||||
|
"color": "black"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
"carModel": "Porsche",
|
||||||
|
"price": 30000,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "airbag",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"position": "left",
|
||||||
|
"color": "white"
|
||||||
|
}, {
|
||||||
|
"position": "right",
|
||||||
|
"color": "gray"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
"name": "dashboard",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"position": "left",
|
||||||
|
"color": "gray"
|
||||||
|
}, {
|
||||||
|
"position": "right",
|
||||||
|
"color": "black"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const fields = ['carModel', 'price', 'items.name', 'items.color', 'items.items.position', 'items.items.color'];
|
||||||
|
const transforms = [unwind({ paths: ['items', 'items.items'] })];
|
||||||
|
const json2csvParser = new Parser({ fields, transforms });
|
||||||
|
const csv = json2csvParser.parse(myCars);
|
||||||
|
|
||||||
|
console.log(csv);
|
||||||
|
```
|
||||||
|
|
||||||
|
will output to console
|
||||||
|
|
||||||
|
```
|
||||||
|
"carModel","price","items.name","items.color","items.items.position","items.items.color"
|
||||||
|
"BMW",15000,"airbag","white",,
|
||||||
|
"BMW",15000,"dashboard","black",,
|
||||||
|
"Porsche",30000,"airbag",,"left","white"
|
||||||
|
"Porsche",30000,"airbag",,"right","gray"
|
||||||
|
"Porsche",30000,"dashboard",,"left","gray"
|
||||||
|
"Porsche",30000,"dashboard",,"right","black"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example 9
|
||||||
|
|
||||||
|
You can also unwind arrays blanking the repeated fields.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { Parser, transforms: { unwind } } = require('json2csv');
|
||||||
|
|
||||||
|
const myCars = [
|
||||||
|
{
|
||||||
|
"carModel": "BMW",
|
||||||
|
"price": 15000,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "airbag",
|
||||||
|
"color": "white"
|
||||||
|
}, {
|
||||||
|
"name": "dashboard",
|
||||||
|
"color": "black"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
"carModel": "Porsche",
|
||||||
|
"price": 30000,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "airbag",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"position": "left",
|
||||||
|
"color": "white"
|
||||||
|
}, {
|
||||||
|
"position": "right",
|
||||||
|
"color": "gray"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
"name": "dashboard",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"position": "left",
|
||||||
|
"color": "gray"
|
||||||
|
}, {
|
||||||
|
"position": "right",
|
||||||
|
"color": "black"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const fields = ['carModel', 'price', 'items.name', 'items.color', 'items.items.position', 'items.items.color'];
|
||||||
|
const transforms = [unwind({ paths: ['items', 'items.items'], blankOut: true })];
|
||||||
|
|
||||||
|
const json2csvParser = new Parser({ fields, transforms });
|
||||||
|
const csv = json2csvParser.parse(myCars);
|
||||||
|
|
||||||
|
console.log(csv);
|
||||||
|
```
|
||||||
|
|
||||||
|
will output to console
|
||||||
|
|
||||||
|
```
|
||||||
|
"carModel","price","items.name","items.color","items.items.position","items.items.color"
|
||||||
|
"BMW",15000,"airbag","white",,
|
||||||
|
,,"dashboard","black",,
|
||||||
|
"Porsche",30000,"airbag",,"left","white"
|
||||||
|
,,,,"right","gray"
|
||||||
|
,,"dashboard",,"left","gray"
|
||||||
|
,,,,"right","black"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Migrations
|
||||||
|
|
||||||
|
#### Migrating from 3.X to 4.X
|
||||||
|
|
||||||
|
What in 3.X used to be
|
||||||
|
```js
|
||||||
|
const json2csv = require('json2csv');
|
||||||
|
const csv = json2csv({ data: myData, fields: myFields, unwindPath: paths, ... });
|
||||||
|
```
|
||||||
|
|
||||||
|
should be replaced by
|
||||||
|
```js
|
||||||
|
const { Parser } = require('json2csv');
|
||||||
|
const json2csvParser = new Parser({ fields: myFields, unwind: paths, ... });
|
||||||
|
const csv = json2csvParser.parse(myData);
|
||||||
|
```
|
||||||
|
|
||||||
|
or the convenience method
|
||||||
|
```js
|
||||||
|
const json2csv = require('json2csv');
|
||||||
|
const csv = json2csv.parse(myData, { fields: myFields, unwind: paths, ... });
|
||||||
|
```
|
||||||
|
|
||||||
|
Please note that many of the configuration parameters have been slightly renamed. Please check one by one that all your parameters are correct.
|
||||||
|
You can se the documentation for json2csv 3.11.5 [here](https://github.com/zemirco/json2csv/blob/v3.11.5/README.md).
|
||||||
|
|
||||||
|
#### Migrating from 4.X to 5.X
|
||||||
|
|
||||||
|
In the CLI, the config file option, `-c`, used to be a list of fields and now it's expected to be a full configuration object.
|
||||||
|
|
||||||
|
The `stringify` option hass been removed.
|
||||||
|
|
||||||
|
`doubleQuote` has been renamed to `escapedQuote`.
|
||||||
|
|
||||||
|
The `unwind` and `flatten` -related options has been moved to their own transforms.
|
||||||
|
|
||||||
|
What used to be
|
||||||
|
```js
|
||||||
|
const { Parser } = require('json2csv');
|
||||||
|
const json2csvParser = new Parser({ unwind: paths, unwindBlank: true, flatten: true, flattenSeparator: '__' });
|
||||||
|
const csv = json2csvParser.parse(myData);
|
||||||
|
```
|
||||||
|
|
||||||
|
should be replaced by
|
||||||
|
```js
|
||||||
|
const { Parser, transforms: { unwind, flatten } } = require('json2csv');
|
||||||
|
const json2csvParser = new Parser({ transforms: [unwind({ paths, blankOut: true }), flatten('__')] });
|
||||||
|
const csv = json2csvParser.parse(myData);
|
||||||
|
```
|
||||||
|
|
||||||
|
You can se the documentation for json2csv v4.X.X [here](https://github.com/zemirco/json2csv/blob/v4/README.md).
|
||||||
|
|
||||||
|
## Known Gotchas
|
||||||
|
|
||||||
|
### Excel support
|
||||||
|
|
||||||
|
#### Avoiding excel autoformatting
|
||||||
|
|
||||||
|
Excel tries to automatically detect the format of every field (number, date, string, etc.) regardless of whether the field is quoted or not.
|
||||||
|
|
||||||
|
This might produce few undesired effects with, for example, serial numbers:
|
||||||
|
- Large numbers are displayed using scientific notation
|
||||||
|
- Leading zeros are stripped.
|
||||||
|
|
||||||
|
Enabling the `excelString` option produces an Excel-specific CSV file that forces Excel to interpret string fields as strings. Please note that the CSV will look incorrect if viewing it somewhere else than Excel.
|
||||||
|
|
||||||
|
#### Avoiding CSV injection
|
||||||
|
|
||||||
|
As part of Excel automatically format detection, fields regarded as formulas (starting with `=`, `+`, `-` or `@`) are interpreted regardless of whether the field is quoted or not, creating a security risk (see [CSV Injection](https://www.owasp.org/index.php/CSV_Injection).
|
||||||
|
|
||||||
|
This issue has nothing to do with the CSV format, since CSV knows nothing about formulas, but with how Excel parses CSV files.
|
||||||
|
|
||||||
|
Enabling the `excelString` option produces an Excel-specific CSV file that forces Excel to interpret string fields as strings. Please note that the CSV will look incorrect if viewing it somewhere else than Excel.
|
||||||
|
|
||||||
|
#### Preserving new lines
|
||||||
|
|
||||||
|
Excel only recognizes `\r\n` as valid new line inside a cell.
|
||||||
|
|
||||||
|
#### Unicode Support
|
||||||
|
|
||||||
|
Excel can display Unicode correctly (just setting the `withBOM` option to true). However, Excel can't save unicode so, if you perform any changes to the CSV and save it from Excel, the Unicode characters will not be displayed correctly.
|
||||||
|
|
||||||
|
|
||||||
|
### PowerShell escaping
|
||||||
|
|
||||||
|
PowerShell do some estrange double quote escaping escaping which results on each line of the CSV missing the first and last quote if outputting the result directly to stdout. Instead of that, it's advisable that you write the result directly to a file.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
json2csv is packaged using `rollup`. You can generate the packages running:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
which generates 3 files under the `dist folder`:
|
||||||
|
|
||||||
|
* `json2csv.umd.js` UMD module transpiled to ES5
|
||||||
|
* `json2csv.esm.js` ES5 module (import/export)
|
||||||
|
* `json2csv.cjs.js` CommonJS module
|
||||||
|
|
||||||
|
When you use packaging tools like webpack and such, they know which version to use depending on your configuration.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
Run the folowing command to check the code style.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the following command to run the tests and return coverage
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm run test-with-coverage
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
After you clone the repository you just need to install the required packages for development by runnning following command under json2csv dir.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
Before making any pull request please ensure sure that your code is formatted, test are passing and test coverage haven't decreased. (See [Testing](#testing))
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
See [LICENSE.md].
|
||||||
|
|
||||||
|
[npm-badge]: https://badge.fury.io/js/json2csv.svg
|
||||||
|
[npm-badge-url]: http://badge.fury.io/js/json2csv
|
||||||
|
[travis-badge]: https://travis-ci.org/zemirco/json2csv.svg
|
||||||
|
[travis-badge-url]: https://travis-ci.org/zemirco/json2csv
|
||||||
|
[coveralls-badge]: https://coveralls.io/repos/zemirco/json2csv/badge.svg?branch=master
|
||||||
|
[coveralls-badge-url]: https://coveralls.io/r/zemirco/json2csv?branch=master
|
||||||
|
[CHANGELOG]: https://github.com/zemirco/json2csv/blob/master/CHANGELOG.md
|
||||||
|
[LICENSE.md]: https://github.com/zemirco/json2csv/blob/master/LICENSE.md
|
183
node_modules/json2csv/bin/json2csv.js
generated
vendored
Executable file
183
node_modules/json2csv/bin/json2csv.js
generated
vendored
Executable file
|
@ -0,0 +1,183 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { promisify } = require('util');
|
||||||
|
const { createReadStream, createWriteStream, readFile: readFileOrig, writeFile: writeFileOrig } = require('fs');
|
||||||
|
const os = require('os');
|
||||||
|
const { isAbsolute, join } = require('path');
|
||||||
|
const program = require('commander');
|
||||||
|
const pkg = require('../package');
|
||||||
|
const json2csv = require('../lib/json2csv');
|
||||||
|
const parseNdJson = require('./utils/parseNdjson');
|
||||||
|
const TablePrinter = require('./utils/TablePrinter');
|
||||||
|
|
||||||
|
const readFile = promisify(readFileOrig);
|
||||||
|
const writeFile = promisify(writeFileOrig);
|
||||||
|
|
||||||
|
const { unwind, flatten } = json2csv.transforms;
|
||||||
|
const JSON2CSVParser = json2csv.Parser;
|
||||||
|
const Json2csvTransform = json2csv.Transform;
|
||||||
|
|
||||||
|
program
|
||||||
|
.version(pkg.version)
|
||||||
|
.option('-i, --input <input>', 'Path and name of the incoming json file. Defaults to stdin.')
|
||||||
|
.option('-o, --output <output>', 'Path and name of the resulting csv file. Defaults to stdout.')
|
||||||
|
.option('-c, --config <path>', 'Specify a file with a valid JSON configuration.')
|
||||||
|
.option('-n, --ndjson', 'Treat the input as NewLine-Delimited JSON.')
|
||||||
|
.option('-s, --no-streaming', 'Process the whole JSON array in memory instead of doing it line by line.')
|
||||||
|
.option('-f, --fields <fields>', 'List of fields to process. Defaults to field auto-detection.')
|
||||||
|
.option('-v, --default-value <defaultValue>', 'Default value to use for missing fields.')
|
||||||
|
.option('-q, --quote <quote>', 'Character(s) to use as quote mark. Defaults to \'"\'.')
|
||||||
|
.option('-Q, --escaped-quote <escapedQuote>', 'Character(s) to use as a escaped quote. Defaults to a double `quote`, \'""\'.')
|
||||||
|
.option('-d, --delimiter <delimiter>', 'Character(s) to use as delimiter. Defaults to \',\'.', ',')
|
||||||
|
.option('-e, --eol <eol>', 'Character(s) to use as End-of-Line for separating rows. Defaults to \'\\n\'.', os.EOL)
|
||||||
|
.option('-E, --excel-strings','Wraps string data to force Excel to interpret it as string even if it contains a number.')
|
||||||
|
.option('-H, --no-header', 'Disable the column name header.')
|
||||||
|
.option('-a, --include-empty-rows', 'Includes empty rows in the resulting CSV output.')
|
||||||
|
.option('-b, --with-bom', 'Includes BOM character at the beginning of the CSV.')
|
||||||
|
.option('-p, --pretty', 'Print output as a pretty table. Use only when printing to console.')
|
||||||
|
// Built-in transforms
|
||||||
|
.option('--unwind [paths]', 'Creates multiple rows from a single JSON document similar to MongoDB unwind.')
|
||||||
|
.option('--unwind-blank', 'When unwinding, blank out instead of repeating data. Defaults to false.', false)
|
||||||
|
.option('--flatten-objects', 'Flatten nested objects. Defaults to false.', false)
|
||||||
|
.option('--flatten-arrays', 'Flatten nested arrays. Defaults to false.', false)
|
||||||
|
.option('--flatten-separator <separator>', 'Flattened keys separator. Defaults to \'.\'.', '.')
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
function makePathAbsolute(filePath) {
|
||||||
|
return (filePath && !isAbsolute(filePath))
|
||||||
|
? join(process.cwd(), filePath)
|
||||||
|
: filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
program.input = makePathAbsolute(program.input);
|
||||||
|
program.output = makePathAbsolute(program.output);
|
||||||
|
program.config = makePathAbsolute(program.config);
|
||||||
|
|
||||||
|
// don't fail if piped to e.g. head
|
||||||
|
/* istanbul ignore next */
|
||||||
|
process.stdout.on('error', (error) => {
|
||||||
|
if (error.code === 'EPIPE') process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
function getInputStream(inputPath) {
|
||||||
|
if (inputPath) return createReadStream(inputPath, { encoding: 'utf8' });
|
||||||
|
|
||||||
|
process.stdin.resume();
|
||||||
|
process.stdin.setEncoding('utf8');
|
||||||
|
return process.stdin;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOutputStream(outputPath, config) {
|
||||||
|
if (outputPath) return createWriteStream(outputPath, { encoding: 'utf8' });
|
||||||
|
if (config.pretty) return new TablePrinter(config).writeStream();
|
||||||
|
return process.stdout;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getInput(inputPath, ndjson) {
|
||||||
|
if (!inputPath) return getInputFromStdin();
|
||||||
|
if (ndjson) return parseNdJson(await readFile(inputPath, 'utf8'));
|
||||||
|
return require(inputPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getInputFromStdin() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
process.stdin.resume();
|
||||||
|
process.stdin.setEncoding('utf8');
|
||||||
|
|
||||||
|
let inputData = '';
|
||||||
|
process.stdin.on('data', chunk => (inputData += chunk));
|
||||||
|
/* istanbul ignore next */
|
||||||
|
process.stdin.on('error', err => reject(new Error('Could not read from stdin', err)));
|
||||||
|
process.stdin.on('end', () => {
|
||||||
|
try {
|
||||||
|
resolve(program.ndjson ? parseNdJson(inputData) : JSON.parse(inputData));
|
||||||
|
} catch (err) {
|
||||||
|
reject(new Error('Invalid data received from stdin', err));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function processOutput(outputPath, csv, config) {
|
||||||
|
if (!outputPath) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
config.pretty ? (new TablePrinter(config)).printCSV(csv) : console.log(csv);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await writeFile(outputPath, csv);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function processInMemory(config, opts) {
|
||||||
|
const input = await getInput(program.input, config.ndjson);
|
||||||
|
const output = new JSON2CSVParser(opts).parse(input);
|
||||||
|
await processOutput(program.output, output, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function processStream(config, opts) {
|
||||||
|
const input = getInputStream(program.input);
|
||||||
|
const transform = new Json2csvTransform(opts);
|
||||||
|
const output = getOutputStream(program.output, config);
|
||||||
|
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
input.pipe(transform).pipe(output);
|
||||||
|
input.on('error', reject);
|
||||||
|
transform.on('error', reject);
|
||||||
|
output.on('error', reject)
|
||||||
|
.on('finish', resolve);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
(async (program) => {
|
||||||
|
try {
|
||||||
|
const config = Object.assign({}, program.config ? require(program.config) : {}, program);
|
||||||
|
|
||||||
|
const transforms = [];
|
||||||
|
if (config.unwind) {
|
||||||
|
transforms.push(unwind({
|
||||||
|
paths: config.unwind === true ? undefined : config.unwind.split(','),
|
||||||
|
blankOut: config.unwindBlank
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.flattenObjects || config.flattenArrays) {
|
||||||
|
transforms.push(flatten({
|
||||||
|
objects: config.flattenObjects,
|
||||||
|
arrays: config.flattenArrays,
|
||||||
|
separator: config.flattenSeparator
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
const opts = {
|
||||||
|
transforms,
|
||||||
|
fields: config.fields
|
||||||
|
? (Array.isArray(config.fields) ? config.fields : config.fields.split(','))
|
||||||
|
: config.fields,
|
||||||
|
defaultValue: config.defaultValue,
|
||||||
|
quote: config.quote,
|
||||||
|
escapedQuote: config.escapedQuote,
|
||||||
|
delimiter: config.delimiter,
|
||||||
|
eol: config.eol,
|
||||||
|
excelStrings: config.excelStrings,
|
||||||
|
header: config.header,
|
||||||
|
includeEmptyRows: config.includeEmptyRows,
|
||||||
|
withBOM: config.withBom
|
||||||
|
};
|
||||||
|
|
||||||
|
await (config.streaming ? processStream : processInMemory)(config, opts);
|
||||||
|
} catch(err) {
|
||||||
|
let processedError = err;
|
||||||
|
if (program.input && err.message.includes(program.input)) {
|
||||||
|
processedError = new Error(`Invalid input file. (${err.message})`);
|
||||||
|
} else if (program.output && err.message.includes(program.output)) {
|
||||||
|
processedError = new Error(`Invalid output file. (${err.message})`);
|
||||||
|
} else if (program.config && err.message.includes(program.config)) {
|
||||||
|
processedError = new Error(`Invalid config file. (${err.message})`);
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(processedError);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
})(program);
|
117
node_modules/json2csv/bin/utils/TablePrinter.js
generated
vendored
Normal file
117
node_modules/json2csv/bin/utils/TablePrinter.js
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { Writable } = require('stream');
|
||||||
|
|
||||||
|
const MIN_CELL_WIDTH = 15;
|
||||||
|
|
||||||
|
class TablePrinter {
|
||||||
|
constructor(opts) {
|
||||||
|
this.opts = opts;
|
||||||
|
this._hasWritten = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
push(csv) {
|
||||||
|
const lines = csv.split(this.opts.eol);
|
||||||
|
|
||||||
|
if (!lines.length) return;
|
||||||
|
|
||||||
|
if (!this._hasWritten) this.setColumnWidths(lines[0]);
|
||||||
|
|
||||||
|
const top = this._hasWritten ? this.middleLine : this.topLine;
|
||||||
|
this.print(top, lines);
|
||||||
|
this._hasWritten = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
end(csv) {
|
||||||
|
let lines = csv.split(this.opts.eol);
|
||||||
|
if (!this._hasWritten) this.setColumnWidths(lines[0]);
|
||||||
|
const top = this._hasWritten ? this.middleLine : this.topLine;
|
||||||
|
this.print(top, lines, this.bottomLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
printCSV(csv) {
|
||||||
|
this.end(csv);
|
||||||
|
}
|
||||||
|
|
||||||
|
setColumnWidths(line) {
|
||||||
|
this.colWidths = line
|
||||||
|
.split(this.opts.delimiter)
|
||||||
|
.map(elem => Math.max(elem.length * 2, MIN_CELL_WIDTH));
|
||||||
|
|
||||||
|
this.topLine = `┌${this.colWidths.map(i => '─'.repeat(i)).join('┬')}┐`;
|
||||||
|
this.middleLine = `├${this.colWidths.map(i => '─'.repeat(i)).join('┼')}┤`;
|
||||||
|
this.bottomLine = `└${this.colWidths.map(i => '─'.repeat(i)).join('┴')}┘`;
|
||||||
|
}
|
||||||
|
|
||||||
|
print(top, lines, bottom) {
|
||||||
|
const table = `${top}\n`
|
||||||
|
+ lines
|
||||||
|
.map(row => this.formatRow(row))
|
||||||
|
.join(`\n${this.middleLine}\n`)
|
||||||
|
+ (bottom ? `\n${bottom}` : '');
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
formatRow(row) {
|
||||||
|
const wrappedRow = row
|
||||||
|
.split(this.opts.delimiter)
|
||||||
|
.map((cell, i) => cell.match(new RegExp(`(.{1,${this.colWidths[i] - 2}})`, 'g')) || []);
|
||||||
|
|
||||||
|
const height = wrappedRow.reduce((acc, cell) => Math.max(acc, cell.length), 0);
|
||||||
|
|
||||||
|
const processedCells = wrappedRow
|
||||||
|
.map((cell, i) => this.formatCell(cell, height, this.colWidths[i]));
|
||||||
|
|
||||||
|
return Array(height).fill('')
|
||||||
|
.map((_, i) => `│${processedCells.map(cell => cell[i]).join('│')}│`)
|
||||||
|
.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
formatCell(content, heigth, width) {
|
||||||
|
const paddedContent = this.padCellHorizontally(content, width);
|
||||||
|
return this.padCellVertically(paddedContent, heigth, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
padCellVertically(content, heigth, width) {
|
||||||
|
const vertPad = heigth - content.length;
|
||||||
|
const vertPadTop = Math.ceil(vertPad / 2);
|
||||||
|
const vertPadBottom = vertPad - vertPadTop;
|
||||||
|
const emptyLine = ' '.repeat(width);
|
||||||
|
|
||||||
|
return [
|
||||||
|
...Array(vertPadTop).fill(emptyLine),
|
||||||
|
...content,
|
||||||
|
...Array(vertPadBottom).fill(emptyLine)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
padCellHorizontally(content, width) {
|
||||||
|
return content.map((line) => {
|
||||||
|
const horPad = width - line.length - 2;
|
||||||
|
return ` ${line}${' '.repeat(horPad)} `;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
writeStream() {
|
||||||
|
let csv = '';
|
||||||
|
const table = this;
|
||||||
|
return new Writable({
|
||||||
|
write(chunk, encoding, callback) {
|
||||||
|
csv += chunk.toString();
|
||||||
|
const index = csv.lastIndexOf(table.opts.eol);
|
||||||
|
let lines = csv.substring(0, index);
|
||||||
|
csv = csv.substring(index + 1);
|
||||||
|
|
||||||
|
if (lines) table.push(lines);
|
||||||
|
callback();
|
||||||
|
},
|
||||||
|
final() {
|
||||||
|
table.end(csv);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = TablePrinter;
|
11
node_modules/json2csv/bin/utils/parseNdjson.js
generated
vendored
Normal file
11
node_modules/json2csv/bin/utils/parseNdjson.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
function parseNdJson(input) {
|
||||||
|
return input
|
||||||
|
.split('\n')
|
||||||
|
.map(line => line.trim())
|
||||||
|
.filter(line => line !== '')
|
||||||
|
.map(line=> JSON.parse(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = parseNdJson;
|
2337
node_modules/json2csv/dist/json2csv.esm.js
generated
vendored
Normal file
2337
node_modules/json2csv/dist/json2csv.esm.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user