From 71cf6179fcf627c3bf26c209baf7ef3796bc045d Mon Sep 17 00:00:00 2001 From: joarrries Date: Fri, 28 Aug 2020 20:45:01 +0800 Subject: [PATCH 1/2] format the code examples --- docs/tutorials/bitcoin-price-feed/aggregations.md | 8 ++++---- docs/tutorials/bitcoin-price-feed/fine-tuning.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/tutorials/bitcoin-price-feed/aggregations.md b/docs/tutorials/bitcoin-price-feed/aggregations.md index 05e3df7b..6bd1c361 100644 --- a/docs/tutorials/bitcoin-price-feed/aggregations.md +++ b/docs/tutorials/bitcoin-price-feed/aggregations.md @@ -44,7 +44,7 @@ returns the average mean of the `Float` values that pass the filter: // values that pass the filter. const aggregator = new Witnet.Aggregator({ filters: [ - [ Witnet.Types.FILTERS.deviationStandard, 1.5 ] + [Witnet.Types.FILTERS.deviationStandard, 1.5] ], reducer: Witnet.Types.REDUCERS.averageMean }) @@ -66,7 +66,7 @@ similar to the aggregation function: // values that pass the filter. const tally = new Witnet.Tally({ filters: [ - [ Witnet.Types.FILTERS.deviationStandard, 1.0 ] + [Witnet.Types.FILTERS.deviationStandard, 1.0] ], reducer: Witnet.Types.REDUCERS.averageMean }) @@ -102,7 +102,7 @@ const coindesk = new Witnet.Source("https://api.coindesk.com/v1/bpi/currentprice // values that pass the filter. const aggregator = new Witnet.Aggregator({ filters: [ - [ Witnet.Types.FILTERS.deviationStandard, 1.5 ] + [Witnet.Types.FILTERS.deviationStandard, 1.5] ], reducer: Witnet.Types.REDUCERS.averageMean }) @@ -112,7 +112,7 @@ const aggregator = new Witnet.Aggregator({ // values that pass the filter. const tally = new Witnet.Tally({ filters: [ - [ Witnet.Types.FILTERS.deviationStandard, 1.0 ] + [Witnet.Types.FILTERS.deviationStandard, 1.0] ], reducer: Witnet.Types.REDUCERS.averageMean }) diff --git a/docs/tutorials/bitcoin-price-feed/fine-tuning.md b/docs/tutorials/bitcoin-price-feed/fine-tuning.md index 4535460d..468946e9 100644 --- a/docs/tutorials/bitcoin-price-feed/fine-tuning.md +++ b/docs/tutorials/bitcoin-price-feed/fine-tuning.md @@ -184,7 +184,7 @@ const coindesk = new Witnet.Source("https://api.coindesk.com/v1/bpi/currentprice // values that pass the filter. const aggregator = new Witnet.Aggregator({ filters: [ - [ Witnet.Types.FILTERS.deviationStandard, 1.5 ] + [Witnet.Types.FILTERS.deviationStandard, 1.5] ], reducer: Witnet.Types.REDUCERS.averageMean }) @@ -194,7 +194,7 @@ const aggregator = new Witnet.Aggregator({ // values that pass the filter. const tally = new Witnet.Tally({ filters: [ - [ Witnet.Types.FILTERS.deviationStandard, 1.0 ] + [Witnet.Types.FILTERS.deviationStandard, 1.0] ], reducer: Witnet.Types.REDUCERS.averageMean }) From 3023618a50c650771f9c91c99cb531991749c58a Mon Sep 17 00:00:00 2001 From: joarrries Date: Sat, 29 Aug 2020 15:21:42 +0800 Subject: [PATCH 2/2] reformat --- docs/protocol/data-requests/examples.md | 80 ++++++++++++------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/docs/protocol/data-requests/examples.md b/docs/protocol/data-requests/examples.md index 4d46012d..99d315f1 100644 --- a/docs/protocol/data-requests/examples.md +++ b/docs/protocol/data-requests/examples.md @@ -22,9 +22,9 @@ new Witnet.Script() [ STRING_PARSEJSON, BYTES_ASMAP, - [ MAP_GET, "weather" ], + [MAP_GET, "weather"], BYTES_ASMAP, - [ MAP_GET, "temp" ], + [MAP_GET, "temp"], BYTES_ASFLOAT ] ``` @@ -33,9 +33,9 @@ new Witnet.Script() [ 69, 116, - [ 97, "weather" ], + [97, "weather"], 116, - [ 97, "temp" ], + [97, "temp"], 114 ] ``` @@ -56,19 +56,19 @@ new Witnet.Script([Witnet.TYPES.ARRAY, Witnet.TYPES.FLOAT]) ```ts tab="RADON-AST" [ - [ ARRAY_FILTER, FILTER_GREATERTHAN, -30 ], - [ ARRAY_FILTER, FILTER_LESSTHAN, 50 ], - [ ARRAY_FILTER, FILTER_DEVIATIONSTANDARD, 2 ], - [ ARRAY_REDUCE, REDUCER_AVERAGEMEAN ] + [ARRAY_FILTER, FILTER_GREATERTHAN, -30], + [ARRAY_FILTER, FILTER_LESSTHAN, 50], + [ARRAY_FILTER, FILTER_DEVIATIONSTANDARD, 2], + [ARRAY_REDUCE, REDUCER_AVERAGEMEAN] ] ``` ```ts tab="RADON-JSON" [ - [ 83, 0, -30 ], - [ 83, 1, 50 ], - [ 83, 5 ], - [ 87, 3 ] + [83, 0, -30], + [83, 1, 50], + [83, 5], + [87, 3] ] ``` @@ -96,15 +96,15 @@ new Witnet.Script([Witnet.TYPES.ARRAY, Witnet.TYPES.FLOAT]) ```ts tab="RADON-AST" [ - [ ARRAY_FILTER, FILTER_DEVIATIONSTANDARD, 2 ], - [ ARRAY_REDUCE, REDUCER_AVERAGEMEAN ] + [ARRAY_FILTER, FILTER_DEVIATIONSTANDARD, 2], + [ARRAY_REDUCE, REDUCER_AVERAGEMEAN] ] ``` ```ts tab="RADON-JSON" [ - [ 83, 5, 2 ], - [ 87, 3 ] + [83, 5, 2], + [87, 3] ] ``` @@ -142,11 +142,11 @@ new Witnet.Script([Witnet.TYPES.STRING]) [ STRING_PARSEJSON, BYTES_ASMAP, - [ MAP_GET , "bpi" ], + [MAP_GET , "bpi"], BYTES_ASMAP, - [ MAP_GET, "USD" ], + [MAP_GET, "USD"], BYTES_ASMAP, - [ MAP_GET, "rate_float" ], + [MAP_GET, "rate_float"], BYTES_ASFLOAT ] ``` @@ -155,11 +155,11 @@ new Witnet.Script([Witnet.TYPES.STRING]) [ 69, 116, - [ 97, "bpi" ], + [97, "bpi"], 116, - [ 97, "usd" ], + [97, "usd"], 116, - [ 97, "rate_float" ], + [97, "rate_float"], 114 ] ``` @@ -192,15 +192,15 @@ new Witnet.Script([Witnet.TYPES.ARRAY, Witnet.TYPES.FLOAT]) ```ts tab="RADON-AST" [ - [ ARRAY_FILTER, FILTER_DEVIATIONSTANDARD, 2 ], - [ ARRAY_REDUCE, REDUCER_AVERAGEMEAN ] + [ARRAY_FILTER, FILTER_DEVIATIONSTANDARD, 2], + [ARRAY_REDUCE, REDUCER_AVERAGEMEAN] ] ``` ```ts tab="RADON-JSON" [ - [ 83, 5, 2 ], - [ 87, 3 ] + [83, 5, 2], + [87, 3] ] ``` @@ -252,9 +252,9 @@ new Witnet.Script([Witnet.TYPES.STRING]) [ STRING_PARSEJSON, BYTES_TOMAP, - [ MAP_GET, "data" ], + [MAP_GET, "data"], BYTES_TOARRAY, - [ ARRAY_GET, 0 ], + [ARRAY_GET, 0], BYTES_ASARRAY ] ``` @@ -263,9 +263,9 @@ new Witnet.Script([Witnet.TYPES.STRING]) [ 69, 116, - [ 97, "data" ], + [97, "data"], 112, - [ 85, 0 ], + [85, 0], 115 ] ``` @@ -296,23 +296,23 @@ new Witnet.Script([Witnet.TYPES.ARRAY, Witnet.TYPES.INTEGER]) ```ts tab="RADON-AST" [ - [ ARRAY_FILTER, FILTER_GREATEROREQUALTHAN, 0 ], - [ ARRAY_FILTER, FILTER_LESSOREQUALTHAN, 255 ], - [ ARRAY_REDUCE, REDUCER_AVERAGEMEAN ], + [ARRAY_FILTER, FILTER_GREATEROREQUALTHAN, 0], + [ARRAY_FILTER, FILTER_LESSOREQUALTHAN, 255], + [ARRAY_REDUCE, REDUCER_AVERAGEMEAN], FLOAT_ROUND, - [ INTEGER_GREATERTHAN, 127 ], - [ INTEGER_MATCH, { true: "tails" }, "heads" ] + [INTEGER_GREATERTHAN, 127], + [INTEGER_MATCH, { true: "tails" }, "heads"] ] ``` ```ts tab="RADON-JSON" [ - [ 83, 129, 0 ], - [ 83, 128, 255 ], - [ 87, 3 ], + [83, 129, 0], + [83, 128, 255], + [87, 3], 60, - [ 36, 127 ], - [ 16, { true: 'tails' }, 'heads' ] + [36, 127], + [16, {true: 'tails'}, 'heads'] ] ```