All files / repl/lib defaults.js

100% Statements 120/120
100% Branches 2/2
100% Functions 1/1
100% Lines 120/120

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 12111x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 116x 11x 11x 11x 11x 11x  
/**
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
'use strict';
 
// MODULES //
 
var stdin = require( '@stdlib/streams/node/stdin' );
var stdout = require( '@stdlib/streams/node/stdout' );
var DEFAULT_KEYBINDINGS = require( './default_keybindings.js' );
var WELCOME = require( './welcome_text.js' );
 
 
// MAIN //
 
/**
* Returns default options.
*
* @private
* @returns {Object} default options
*
* @example
* var opts = defaults();
* // returns {...}
*/
function defaults() {
	return {
		// Default input stream:
		'input': stdin,
 
		// Default output stream:
		'output': stdout,
 
		// Input prompt:
		'inputPrompt': 'In [%d]: ',
 
		// Output prompt:
		'outputPrompt': 'Out[%d]: ',
 
		// Number of empty lines between successive commands:
		'padding': 1,
 
		// Flag indicating whether the input and output streams should be treated like a TTY (terminal) and whether the REPL should use ANSI/VT100 escape codes when writing to the output stream:
		'isTTY': void 0,
 
		// Number of milliseconds to execute a command before terminating execution:
		'timeout': 4294967295,
 
		// Flag indicating whether to run a REPL in a sandboxed context:
		'sandbox': true,
 
		// Welcome message:
		'welcome': WELCOME,
 
		// File path specifying where to save REPL command history:
		'save': '',
 
		// File path specifying a JavaScript file to load and evaluate line-by-line (e.g., a previous REPL history file):
		'load': '',
 
		// File path specifying where to save REPL commands and printed output:
		'log': '',
 
		// Flag indicating whether log information, confirmation messages, and other possible REPL diagnostics should be silenced:
		'quiet': false,
 
		// REPL keybindings:
		'keybindings': DEFAULT_KEYBINDINGS,
 
		// User settings:
		'settings': {
			// Flag indicating whether to automatically insert matching brackets, parentheses, and quotes:
			'autoClosePairs': true,
 
			// Flag indicating whether to automatically delete adjacent matching brackets, parentheses, and quotes:
			'autoDeletePairs': true,
 
			// Flag indicating whether to enable automatically page return values requiring a display size exceeding the visible screen (note: default depends on whether TTY):
			'autoPage': void 0,
 
			// Flag indicating whether to enable bracketed-paste mode (note: default depends on whether TTY):
			'bracketedPaste': void 0,
 
			// Flag indicating whether to enable the display of completion previews for auto-completion (note: default depends on whether TTY):
			'completionPreviews': void 0,
 
			// Flag indicating whether to automatically disable bracketed-paste upon exiting the REPL (note: default depends on whether TTY):
			'autoDisableBracketedPasteOnExit': void 0,
 
			// Flag indicating whether to enable syntax highlighting (note: default depends on whether TTY):
			'syntaxHighlighting': void 0,
 
			// Theme for syntax highlighting:
			'theme': 'stdlib-ansi-basic',
 
			// Flag indicating whether to enable eager evaluation (note: default depends on whether TTY):
			'eagerEvaluation': void 0
		}
	};
}
 
 
// EXPORTS //
 
module.exports = defaults;