Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createUI (market, asks, bids) {
console.clear()
const baseCurrencySymbol = market.split('/')[0].toUpperCase()
const windowWidth = size.get().width
const { mainTableWidth, innerTableWidth } = calculateTableWidths(windowWidth)
const table = new Table({
head: ['ASKS', 'BIDS'],
style: { head: ['gray'] },
colWidths: [mainTableWidth, mainTableWidth]
})
// The extensive options are required because the default for cli-table is to have
// borders between every row and column.
const innerTableOptions = {
head: ['Price', `Depth (${baseCurrencySymbol})`],
style: { head: ['gray'] },
colWidths: [innerTableWidth, innerTableWidth],
chars: {
'top': '',
'top-mid': '',
function createUI (market, asks, bids) {
console.clear()
const windowHeight = size.get().height
// Fill as many orders as the screen allows less other info displayed
const maxLengthPerSide = Math.floor((windowHeight - NON_MARKET_INFO) / 2)
const baseCurrencySymbol = market.split('/')[0].toUpperCase()
const parentTable = new Table({
head: [],
chars: {
'top-mid': '',
'bottom-mid': '',
'left-mid': '',
'mid': '',
'mid-mid': '',
'right-mid': '',
'middle': ''
},
function createUI (market, asks, bids) {
const baseCurrencySymbol = market.split('/')[0].toUpperCase()
const windowWidth = size.get().width
const { mainTableWidth, innerTableWidth } = calculateTableWidths(windowWidth)
const table = new Table({
head: ['ASKS', 'BIDS'],
style: { head: ['gray'] },
colWidths: [mainTableWidth, mainTableWidth]
})
// The extensive options are required because the default for cli-table is to have
// borders between every row and column.
const innerTableOptions = {
head: ['Price', `Depth (${baseCurrencySymbol})`],
style: { head: ['gray'] },
colWidths: [innerTableWidth, innerTableWidth],
chars: {
'top': '',
'top-mid': '',
const got = require('got');
const supportsColor = require('supports-color');
const windowSize = require('window-size');
const uuid = require('uuid');
const osName = require('os-name');
const isCi = require('is-ci');
const _ = require('lodash');
const debug = require('debug')('release-it:metrics');
const pkg = require('../package.json');
const noop = Promise.resolve();
const cast = value => (value ? 1 : 0);
const cid = uuid.v4();
const dimensions = windowSize ? windowSize.get() : { width: 0, height: 0 };
const vp = `${dimensions.width}x${dimensions.height}`;
const depths = ['1-bit', '4-bit', '8-bit', '24-bits'];
const sd = depths[supportsColor.level || 0];
const payload = config => ({
v: 1,
tid: 'UA-108828841-1',
cid,
vp,
sd,
cd1: pkg.version,
cd2: process.version,
cd3: osName(),
cd4: cast(!config.isCI),
cd5: cast(config.isDryRun),
cd6: cast(config.isVerbose),
function createUI (market, orders) {
const windowWidth = size.get().width
const unitWidth = Math.floor(windowWidth / 16)
const orderTable = new Table({
head: ['Order ID', 'Status', 'Side', 'Amount', 'Limit Price', 'Time', 'Created At'],
colWidths: [2 * unitWidth, unitWidth, unitWidth, 3 * unitWidth, 3 * unitWidth, unitWidth, 3 * unitWidth],
style: { head: ['gray'] }
})
const ui = []
ui.push('')
ui.push(String(`Orders: ${market.toUpperCase()}`).bold.white)
ui.push('')
orders.forEach((order) => {
const price = order.isMarketOrder ? 'MARKET' : order.limitPrice
checkWindowSize() {
let size = windowSize.get();
if (size.height < 40 || size.width < 118) {
this.logger.warn(__("tip: you can resize the terminal or disable the dashboard with") + " embark run --nodashboard".bold.underline);
}
}
function getWindowSize() {
const windowSize = require('window-size');
if (windowSize) {
return windowSize.get();
}
return {width: 240, height: 75};
}
async run ( name: string ) {
if ( !Config.scripts.enabled ) return;
const script = Config.scripts[name];
if ( !script ) return;
const size = _.get ( windowSize.get (), 'width', 40 );
try {
Utils.log ( chalk.yellow ( `┌─ script:${name} ${'─'.repeat ( size - 12 - name.length )}┐` ) );
await execa.shell ( `${script} && exit 0`, { stdout: 'inherit', stderr: 'inherit' } );
Utils.log ( chalk.yellow ( `└${'─'.repeat ( size - 2 )}┘` ) );
} catch ( e ) {
Utils.log ( e );
Utils.exit ( `[script] An error occurred while executing the "${chalk.bold ( name )}" script` );
}
function createUI (market, orders) {
const windowWidth = size.get().width
const unitWidth = Math.floor(windowWidth / 16)
const orderTable = new Table({
head: ['Order ID', 'Side', 'Amount', 'Limit Price', 'Time', 'Status'],
colWidths: [5 * unitWidth, unitWidth, 3 * unitWidth, 3 * unitWidth, unitWidth, 2 * unitWidth],
style: { head: ['gray'] }
})
const ui = []
ui.push('')
ui.push(String(`Orders: ${market.toUpperCase()}`).bold.white)
ui.push('')
orders.forEach((order) => {
const price = order.isMarketOrder ? 'MARKET' : order.limitPrice