How to use table - 10 common examples

To help you get started, we’ve selected a few table examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brickblock-io / smart-contracts / test / misc / ExchangeRateGasCosts.js View on Github external
callbackGasLimit,
        ratePenalty,
        { from: owner }
      )
      data.push(['setCurrencySettings', txSetCurrencySettings.receipt.gasUsed])

      //getCurrencySettings
      const txFetchRate = await exr.fetchRate(queryType, {
        from: owner,
        value: 1e18,
      })

      data.push(['txFetchRate', txFetchRate.receipt.gasUsed])

      // eslint-disable-next-line
      console.log(table(data))
    })
  })
github apache / griffin / ui / js / controllers / viewrule-ctrl.js View on Github external
$http.get(getModelUrl).then(function successCallback(data){
          $scope.ruleData = data.data;
          $scope.sourceLength = $scope.ruleData.evaluateRule.rules.split('AND').length;
          console.log($scope.sourceLength);

          // console.log(JSON.parse($scope.ruleData.source.config));
          $scope.sourceDB = $scope.ruleData.source.config.database;
          console.log($scope.sourceDB);
          $scope.targetDB = $scope.ruleData.target.config.database;
          $scope.sourceTable = $scope.ruleData.source.config["table.name"];
          $scope.targetTable = $scope.ruleData.target.config["table.name"];
          console.log($scope.targetTable);
          console.log($scope.targetDB);
          console.log($scope.ruleData.evaluateRule.rules.split('AND'));
//          $scope.targetLength = $scope.ruleData.evaluateRule.rules.split(';').length;

          $scope.getNumber = function(n){return new Array(n);}
        // }).error(function(data){
        //   // errorMessage(0, 'Save model failed, please try again!');
        //   toaster.pop('error', data.message);
        // });
         },function errorCallback(response) {
          toaster.pop('error', 'Error when geting record', response.message);
github apollographql / apollo-tooling / packages / apollo / src / commands / service / check.ts View on Github external
formatMarkdown({
          checkSchemaResult,
          graphName: graphID,
          serviceName,
          tag: config.tag,
          graphCompositionID
        })
      );
    }

    if (compositionErrors) {
      // Add a cosmetic line break
      console.log("");

      this.log(
        table(
          [
            ["Service", "Field", "Message"],
            ...compositionErrors.map(Object.values)
          ],
          {
            columns: {
              2: {
                width: 50,
                wrapWord: true
              }
            }
          }
        )
      );

      // Return a non-zero error code
github apollographql / apollo-tooling / packages / apollo / src / commands / service / check.ts View on Github external
const sortedChanges = sortBy(changes, [
      change => change.code,
      change => change.description
    ]);

    const breakingChanges = sortedChanges.filter(
      change => change.severity === ChangeSeverity.FAILURE
    );

    sortBy(breakingChanges, change => change.severity);

    const nonBreakingChanges = sortedChanges.filter(
      change => change.severity !== ChangeSeverity.FAILURE
    );

    result += table([
      ["Change", "Code", "Description"],
      ...[
        ...breakingChanges.map(formatChange).map(Object.values),
        // Add an empty line between, but only if there are both breaking changes and non-breaking changes.
        // nonBreakingChanges.length && breakingChanges.length ? {} : null,
        ...nonBreakingChanges.map(formatChange).map(Object.values)
      ].filter(Boolean)
    ]);
  }

  if (targetUrl) {
    result += `\n\nView full details at: ${targetUrl}${
      graphCompositionID ? `?graphCompositionId=${graphCompositionID}` : ``
    }`;
  }
github wildbit / postmark-cli / src / commands / servers / list.ts View on Github external
const serverTable = (servers: Servers, showTokens: boolean): string => {
  let headings = ['Server', 'Settings']
  let serverTable: any[] = [headings]

  // Create server rows
  servers.Servers.forEach(server =>
    serverTable.push(serverRow(server, showTokens))
  )
  return table(serverTable, { border: getBorderCharacters('norc') })
}
github hyperledger / caliper / packages / caliper-core / lib / master / report / report.js View on Github external
printTable(tableArray) {
        // tableArray[0] = array of column titles
        // tableArray[1+] = array column values
        let t = table.table(tableArray, {border: table.getBorderCharacters('ramac')});
        Logger.info('\n' + t);
    }
github wildbit / postmark-cli / src / commands / templates / push.ts View on Github external
layouts.length > 0
      ? `${layouts.length} ${pluralize(layouts.length, 'layout', 'layouts')}`
      : ''

  // Log template and layout files
  if (templates.length > 0) {
    log(`\n${templatesLabel}`)
    log(
      table([templatesHeader, ...templates], {
        border: getBorderCharacters('norc'),
      })
    )
  }
  if (layouts.length > 0) {
    log(`\n${layoutsLabel}`)
    log(table([header, ...layouts], { border: getBorderCharacters('norc') }))
  }

  // Log summary
  log(
    chalk.yellow(
      `${templatesLabel}${
        templates.length > 0 && layouts.length > 0 ? ' and ' : ''
      }${layoutsLabel} will be pushed to Postmark.`
    )
  )
}
github trheyi / xpmjs / service / user.js View on Github external
function User( option )  {

	option = option || {};
	

	this.ss = new Session( option );
	this.host = option['https'] || option['host'];
	
	this.api = 'https://' +  this.host + '/_a/baas/user';

	// 1.5.1 + 废弃
	this.prefix= option['table.prefix'] || '';
	// 1.5.1 + 废弃
	this.table_name = option['user.table'] || 'user';
	// 1.5.1 + 废弃
	this.tab = new Table( option, this.table_name );
	// 1.5.1 + 废弃
	this.cid =  option.app || '';


	// 1.5.1 新增: 用户数据处理云端应用
	this.handler = option['user'] || '';
	this.appid = option['appid']; // 小程序ID,可不填写
	this.secret = option['secret']; // 云端鉴权 secret 格式为 appid|secret


	// 用户退出
	this.logout = function() {
github apache / griffin / ui / js / controllers / rule-ctrl.js View on Github external
$http.get(getModelUrl).then(function successCallback(data){
  			  $scope.deletedRow = data.data;
              $scope.sourceTable = $scope.deletedRow.source.config["table.name"];
              $scope.targetTable = $scope.deletedRow.target.config["table.name"];
  		  });
        // $scope.deletedRow = row;
github vtex / react-jsonschema-table / src / reducers / items-reducer.js View on Github external
delete newState.staging[item]
          const stagingIndex = newState.stagingItems.indexOf(item)
          newState.stagingItems.splice(stagingIndex, 1)
          newState.checkedItems.splice(ref.length - 1 - index, 1)
        } else {
          // To Do: delete document in API (not staged)
        }
      })
      return newState
    }

    case types.ADD_ITEM: {
      const { id, schema, lang } = action
      const newState = Object.assign({}, state)
      addStaging(newState, id, STATUS.NEW, { id: { value: id } }, schema, lang)
      addToHistoryChanges(newState, id, STATUS.NEW, null)
      return newState
    }

    case types.UPDATE_ITEM: {
      const { id, schema, changes, lang } = action
      const newState = Object.assign({}, state)
      const changesKey = Object.keys(changes)[0]
      let hydratedChanges = changes
      if (schema.properties[changesKey].type === 'object' && state.staging[id].document[changesKey]) {
        // TO DO: make deep merge if field is object inside object inside object...
        hydratedChanges[changesKey] = {
          value: {
            ...state.staging[id].document[changesKey],
            ...changes[changesKey].value,
          }
        }