Skip to content

Commit f276fe8

Browse files
committed
Update script to avoid expression assignment
1 parent 482fbab commit f276fe8

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

lib/node_modules/@stdlib/repl/code-blocks/lib/db.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
'use strict';
77

8-
module.exports = {
8+
var db = {
99
"AFINN_111": "list = AFINN_111()\n",
1010
"AFINN_96": "list = AFINN_96()\n",
1111
"allocUnsafe": "buf = allocUnsafe( 100 )\n",
@@ -1355,3 +1355,5 @@ module.exports = {
13551355
"ztest": "\n// One-sample z-test:\nrnorm = base.random.normal.factory( 0.0, 2.0, { 'seed': 212 });\nx = new Array( 100 );\nfor ( var i = 0; i < x.length; i++ ) {\n x[ i ] = rnorm();\n}\nout = ztest( x, 2.0 )\n\n// Choose custom significance level and print output:\narr = [ 2, 4, 3, 1, 0 ];\nout = ztest( arr, 2.0, { 'alpha': 0.01 });\ntable = out.print()\n\n// Test for a mean equal to five:\narr = [ 4, 4, 6, 6, 5 ];\nout = ztest( arr, 1.0, { 'mu': 5 })\n\n// Perform one-sided tests:\narr = [ 4, 4, 6, 6, 5 ];\nout = ztest( arr, 1.0, { 'alternative': 'less' });\nout = ztest( arr, 1.0, { 'alternative': 'greater' });\n",
13561356
"ztest2": "\n// Drawn from Normal(0,2):\nx = [ -0.21, 0.14, 1.65, 2.11, -1.86, -0.29, 1.48, 0.81, 0.86, 1.04 ];\n\n// Drawn from Normal(1,2):\ny = [ -1.53, -2.93, 2.34, -1.15, 2.7, -0.12, 4.22, 1.66, 3.43, 4.66 ];\nout = ztest2( x, y, 2.0, 2.0 )\n\n// Print table output:\ntable = out.print();\n\n// Choose a different significance level than `0.05`:\nout = ztest2( x, y, 2.0, 2.0, { 'alpha': 0.4 });\ntable = out.print();\n\n// Perform one-sided tests:\nout = ztest2( x, y, 2.0, 2.0, { 'alternative': 'less' });\ntable = out.print()\nout = ztest2( x, y, 2.0, 2.0, { 'alternative': 'greater' });\ntable = out.print()\n\n// Test for a difference in means besides zero:\nrnorm = base.random.normal.factory({ 'seed': 372 });\nx = new Array( 100 );\nfor ( i = 0; i < x.length; i++ ) {\n x[ i ] = rnorm( 2.0, 1.0 );\n}\ny = new Array( 100 );\nfor ( i = 0; i < x.length; i++ ) {\n y[ i ] = rnorm( 0.0, 2.0 );\n}\nout = ztest2( x, y, 1.0, 2.0, { 'difference': 2.0 })\n"
13571357
};
1358+
1359+
module.exports = db;

lib/node_modules/@stdlib/repl/code-blocks/scripts/build.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ var debug = logger( 'repl:examples:build' );
1919
var EXAMPLES_OUTPUT = resolvePath( __dirname, '..', 'lib', 'db.js' );
2020

2121
// Output file preamble:
22-
var PREAMBLE = '/* eslint-disable quotes, max-lines */\n\n/*\n* This file is generated by scripts/build.js.\n*/\n\'use strict\';\n\n';
22+
var PREAMBLE = '/* eslint-disable quotes, max-lines */\n\n/*\n* This file is generated by scripts/build.js.\n*/\n\'use strict\';\n\nvar db = ';
23+
24+
// Output file append:
25+
var APPEND = 'module.exports = db;\n';
2326

2427
// Identifier for inserting 'See Also' links:
2528
var SEE_ALSO = '\n See Also\n --------\n';
@@ -136,7 +139,7 @@ function createExamples( docs ) {
136139
}
137140
}
138141
debug( 'Writing REPL example hash to file.' );
139-
out = PREAMBLE+'module.exports = '+JSON.stringify( out, null, '\t' )+';\n';
142+
out = PREAMBLE+JSON.stringify( out, null, '\t' )+';\n\n'+APPEND;
140143
writeFile( EXAMPLES_OUTPUT, out, fopts );
141144
} // end FUNCTION createExamples()
142145

lib/node_modules/@stdlib/repl/help/lib/db.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
'use strict';
77

8-
module.exports = {
8+
var db = {
99
"AFINN_111": "\nAFINN_111()\n Returns a list of English words rated for valence.\n\n The returned list contains 2477 English words (and phrases) rated for\n valence. Negative words have a negative valence [-5,0). Positive words have\n a positive valence (0,5]. Neutral words have a valence of 0.\n\n A few notes:\n\n - The list includes misspelled words. Their presence is intentional, as such\n misspellings frequently occur in social media content.\n - All words are lowercase.\n - Words may contain numbers; e.g., \"n00b\".\n - Some \"words\" are phrases; e.g., \"cool stuff\", \"not good\".\n - Words may contain apostrophes; e.g., \"can't stand\".\n - Words may contain diaeresis; e.g., \"naïve\".\n - Words may contain dashes; e.g., \"self-deluded\", \"self-confident\".\n\n Returns\n -------\n out: Array<Array>\n List of English words and their valence.\n\n Examples\n --------\n > var list = AFINN_111()\n [ [ 'abandon', -2 ], [ 'abandoned', -2 ], [ 'abandons', -2 ], ... ]\n\n References\n ----------\n - Nielsen, Finn Årup. 2011. \"A new ANEW: Evaluation of a word list for\n sentiment analysis in microblogs.\" In *Proceedings of the ESWC2011 Workshop\n on 'Making Sense of Microposts': Big Things Come in Small Packages.*,\n 718:93–98. CEUR Workshop Proceedings. <http://ceur-ws.org/Vol-718/paper_16.\n pdf>.\n\n * If you use the list for publication or third party consumption, please\n cite the listed reference.\n\n See Also\n --------\n AFINN_96\n",
1010
"AFINN_96": "\nAFINN_96()\n Returns a list of English words rated for valence.\n\n The returned list contains 1468 English words (and phrases) rated for\n valence. Negative words have a negative valence [-5,0). Positive words have\n a positive valence (0,5]. Neutral words have a valence of 0.\n\n A few notes:\n\n - The list is an earlier version of AFINN-111.\n - The list includes misspelled words. Their presence is intentional, as such\n misspellings frequently occur in social media content.\n - All words are lowercase.\n - Some \"words\" are phrases; e.g., \"cashing in\", \"cool stuff\".\n - Words may contain apostrophes; e.g., \"can't stand\".\n - Words may contain dashes; e.g., \"cover-up\", \"made-up\".\n\n Returns\n -------\n out: Array<Array>\n List of English words and their valence.\n\n Examples\n --------\n > var list = AFINN_96()\n [ [ 'abandon', -2 ], [ 'abandons', -2 ], [ 'abandoned', -2 ], ... ]\n\n References\n ----------\n - Nielsen, Finn Årup. 2011. \"A new ANEW: Evaluation of a word list for\n sentiment analysis in microblogs.\" In *Proceedings of the ESWC2011 Workshop\n on 'Making Sense of Microposts': Big Things Come in Small Packages.*,\n 718:93–98. CEUR Workshop Proceedings. <http://ceur-ws.org/Vol-718/paper_16.\n pdf>.\n\n * If you use the list for publication or third party consumption, please\n cite the listed reference.\n\n See Also\n --------\n AFINN_111\n",
1111
"allocUnsafe": "\nallocUnsafe( size )\n Allocates a buffer having a specified number of bytes.\n\n The underlying memory of returned buffers is not initialized. Memory\n contents are unknown and may contain sensitive data.\n\n When the size is less than half a buffer pool size, memory is allocated from\n the buffer pool for faster allocation of Buffer instances.\n\n Parameters\n ----------\n size: integer\n Number of bytes to allocate.\n\n Returns\n -------\n out: Buffer\n Buffer instance.\n\n Examples\n --------\n > var buf = allocUnsafe( 100 )\n <Buffer>\n\n See Also\n --------\n Buffer, array2buffer, arraybuffer2buffer, copyBuffer, string2buffer\n",
@@ -1355,3 +1355,5 @@ module.exports = {
13551355
"ztest": "\nztest( x, sigma[, options] )\n Computes a one-sample z-test.\n\n The function performs a one-sample z-test for the null hypothesis that the\n data in array or typed array `x` is drawn from a normal distribution with\n mean zero and standard deviation `sigma`.\n\n The returned object comes with a `.print()` method which when invoked will\n print a formatted output of the results of the hypothesis test.\n\n Parameters\n ----------\n x: Array<number>\n Data array.\n\n sigma: number\n Known standard deviation.\n\n options: Object (optional)\n Options.\n\n options.alpha: number (optional)\n Number in the interval `[0,1]` giving the significance level of the\n hypothesis test. Default: `0.05`.\n\n options.alternative: string (optional)\n Indicates whether the alternative hypothesis is that the mean of `x` is\n larger than `mu` (`greater`), smaller than `mu` (`less`) or equal to\n `mu` (`two-sided`). Default: `'two-sided'`.\n\n options.mu: number (optional)\n Hypothesized true mean under the null hypothesis. Set this option to\n test whether the data comes from a distribution with the specified `mu`.\n Default: `0`.\n\n Returns\n -------\n out: Object\n Test result object.\n\n out.alpha: number\n Used significance level.\n\n out.rejected: boolean\n Test decision.\n\n out.pValue: number\n P-value of the test.\n\n out.statistic: number\n Value of test statistic.\n\n out.ci: Array<number>\n 1-alpha confidence interval for mean.\n\n out.nullValue: number\n Assumed mean value under H0.\n\n out.sd: number\n Standard error.\n\n out.alternative: string\n Alternative hypothesis (`two-sided`, `less` or `greater`).\n\n out.method: string\n Name of test (`One-Sample z-test`).\n\n out.print: function\n Function to print formatted output.\n\n Examples\n --------\n // One-sample z-test:\n > var rnorm = base.random.normal.factory( 0.0, 2.0, { 'seed': 212 });\n > var x = new Array( 100 );\n > for ( var i = 0; i < x.length; i++ ) {\n ... x[ i ] = rnorm();\n ... }\n > var out = ztest( x, 2.0 )\n {\n alpha: 0.05,\n rejected: false,\n pValue: ~0.180,\n statistic: ~-1.34,\n ci: [ ~-0.66, ~0.124 ],\n ...\n }\n\n // Choose custom significance level and print output:\n > arr = [ 2, 4, 3, 1, 0 ];\n > out = ztest( arr, 2.0, { 'alpha': 0.01 });\n > table = out.print()\n One-sample z-test\n\n Alternative hypothesis: True mean is not equal to 0\n\n pValue: 0.0253\n statistic: 2.2361\n 99% confidence interval: [-0.3039,4.3039]\n\n Test Decision: Fail to reject null in favor of alternative at 1%\n significance level\n\n\n // Test for a mean equal to five:\n > var arr = [ 4, 4, 6, 6, 5 ];\n > out = ztest( arr, 1.0, { 'mu': 5 })\n {\n rejected: false,\n pValue: 1,\n statistic: 0,\n ci: [ ~4.123, ~5.877 ],\n // ...\n }\n\n // Perform one-sided tests:\n > arr = [ 4, 4, 6, 6, 5 ];\n > out = ztest( arr, 1.0, { 'alternative': 'less' });\n {\n alpha: 0.05,\n rejected: false,\n pValue: 1,\n statistic: 11.180339887498949,\n ci: [ -Infinity, 5.735600904580115 ],\n // ...\n }\n > out = ztest( arr, 1.0, { 'alternative': 'greater' });\n {\n alpha: 0.05,\n rejected: true,\n pValue: 0,\n statistic: 11.180339887498949,\n ci: [ 4.264399095419885, Infinity ],\n //...\n }\n\n See Also\n --------\n ztest2\n",
13561356
"ztest2": "\nztest2( x, y, sigmax, sigmay[, options] )\n Computes a two-sample z-test.\n\n By default, the function performs a two-sample z-test for the null\n hypothesis that the data in arrays or typed arrays `x` and `y` is\n independently drawn from normal distributions with equal means and known\n standard deviations `sigmax` and `sigmay`.\n\n The returned object comes with a `.print()` method which when invoked will\n print a formatted output of the results of the hypothesis test.\n\n Parameters\n ----------\n x: Array<number>\n First data array.\n\n y: Array<number>\n Second data array.\n\n sigmax: number\n Known standard deviation of first group.\n\n sigmay: number\n Known standard deviation of second group.\n\n options: Object (optional)\n Options.\n\n options.alpha: number (optional)\n Number in the interval `[0,1]` giving the significance level of the\n hypothesis test. Default: `0.05`.\n\n options.alternative: string (optional)\n Either `two-sided`, `less` or `greater`. Indicates whether the\n alternative hypothesis is that `x` has a larger mean than `y`\n (`greater`), `x` has a smaller mean than `y` (`less`) or the means are\n the same (`two-sided`). Default: `'two-sided'`.\n\n options.difference: number (optional)\n Number denoting the difference in means under the null hypothesis.\n Default: `0`.\n\n Returns\n -------\n out: Object\n Test result object.\n\n out.alpha: number\n Used significance level.\n\n out.rejected: boolean\n Test decision.\n\n out.pValue: number\n P-value of the test.\n\n out.statistic: number\n Value of test statistic.\n\n out.ci: Array<number>\n 1-alpha confidence interval for the mean.\n\n out.nullValue: number\n Assumed difference in means under H0.\n\n out.xmean: number\n Sample mean of `x`.\n\n out.ymean: number\n Sample mean of `y`.\n\n out.alternative: string\n Alternative hypothesis (`two-sided`, `less` or `greater`).\n\n out.method: string\n Name of test.\n\n out.print: function\n Function to print formatted output.\n\n Examples\n --------\n // Drawn from Normal(0,2):\n > var x = [ -0.21, 0.14, 1.65, 2.11, -1.86, -0.29, 1.48, 0.81, 0.86, 1.04 ];\n // Drawn from Normal(1,2):\n > var y = [ -1.53, -2.93, 2.34, -1.15, 2.7, -0.12, 4.22, 1.66, 3.43, 4.66 ];\n > var out = ztest2( x, y, 2.0, 2.0 )\n {\n alpha: 0.05,\n rejected: false,\n pValue: ~0.398,\n statistic: ~-0.844\n ci: [ ~-2.508, ~0.988 ],\n alternative: 'two-sided',\n method: 'Two-sample z-test',\n nullValue: 0,\n xmean: ~0.573,\n ymean: ~1.328\n }\n\n // Print table output:\n > var table = out.print();\n Two-sample z-test\n\n Alternative hypothesis: True difference in means is not equal to 0\n\n pValue: 0.3986\n statistic: -0.8441\n 95% confidence interval: [-2.508,0.998]\n\n Test Decision: Fail to reject null in favor of alternative at 5%\n significance level\n\n // Choose a different significance level than `0.05`:\n > out = ztest2( x, y, 2.0, 2.0, { 'alpha': 0.4 });\n > table = out.print();\n Two-sample z-test\n\n Alternative hypothesis: True difference in means is not equal to 0\n\n pValue: 0.3986\n statistic: -0.8441\n 60% confidence interval: [-1.5078,-0.0022]\n\n Test Decision: Reject null in favor of alternative at 40% significance level\n\n // Perform one-sided tests:\n > out = ztest2( x, y, 2.0, 2.0, { 'alternative': 'less' });\n > table = out.print()\n Two-sample z-test\n\n Alternative hypothesis: True difference in means is less than 0\n\n pValue: 0.1993\n statistic: -0.8441\n 95% confidence interval: [-Infinity,0.7162]\n\n Test Decision: Fail to reject null in favor of alternative at 5%\n significance level\n\n\n > out = ztest2( x, y, 2.0, 2.0, { 'alternative': 'greater' });\n > table = out.print()\n Two-sample z-test\n\n Alternative hypothesis: True difference in means is greater than 0\n\n pValue: 0.8007\n statistic: -0.8441\n 95% confidence interval: [-2.2262,Infinity]\n\n Test Decision: Fail to reject null in favor of alternative at 5%\n significance level\n\n // Test for a difference in means besides zero:\n > var rnorm = base.random.normal.factory({ 'seed': 372 });\n > x = new Array( 100 );\n > for ( i = 0; i < x.length; i++ ) {\n ... x[ i ] = rnorm( 2.0, 1.0 );\n ... }\n > y = new Array( 100 );\n ... for ( i = 0; i < x.length; i++ ) {\n ... y[ i ] = rnorm( 0.0, 2.0 );\n ... }\n > out = ztest2( x, y, 1.0, 2.0, { 'difference': 2.0 })\n {\n rejected: false,\n pValue: ~0.35,\n statistic: ~-0.935\n ci: [ ~1.353, ~2.229 ],\n // ...\n }\n\n See Also\n --------\n ztest\n"
13571357
};
1358+
1359+
module.exports = db;

lib/node_modules/@stdlib/repl/help/scripts/build.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ var ROOT = resolvePath( __dirname, '..', '..', '..' );
3535
var HELP_OUTPUT = resolvePath( __dirname, '..', 'lib', 'db.js' );
3636

3737
// Output file preamble:
38-
var PREAMBLE = '/* eslint-disable quotes, max-lines */\n\n/*\n* This file is generated by scripts/build.js.\n*/\n\'use strict\';\n\n';
38+
var PREAMBLE = '/* eslint-disable quotes, max-lines */\n\n/*\n* This file is generated by scripts/build.js.\n*/\n\'use strict\';\n\nvar db = ';
39+
40+
// Output file append:
41+
var APPEND = 'module.exports = db;\n';
3942

4043
// Identifier for inserting 'See Also' links:
4144
var SEE_ALSO = '\n See Also\n --------\n';
@@ -205,7 +208,7 @@ function createHelp() {
205208
out[ alias ] = file;
206209
}
207210
debug( 'Writing REPL text hash to file.' );
208-
out = PREAMBLE+'module.exports = '+JSON.stringify( out, null, '\t' )+';\n';
211+
out = PREAMBLE+JSON.stringify( out, null, '\t' )+';\n\n'+APPEND;
209212
writeFile( HELP_OUTPUT, out, fopts );
210213
} // end FUNCTION createHelp()
211214

0 commit comments

Comments
 (0)