How to use the typical.isString function in typical

To help you get started, we’ve selected a few typical 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 75lb / command-line-usage / lib / content.js View on Github external
lines () {
    const content = this._content
    const defaultPadding = { left: '  ', right: ' ' }

    if (content) {
      /* string content */
      if (t.isString(content)) {
        const table = new Table({ column: chalkFormat(content) }, {
          padding: defaultPadding,
          maxWidth: 80
        })
        return table.renderLines()

      /* array of strings */
      } else if (Array.isArray(content) && content.every(t.isString)) {
        const rows = content.map(string => ({ column: chalkFormat(string) }))
        const table = new Table(rows, {
          padding: defaultPadding,
          maxWidth: 80
        })
        return table.renderLines()

      /* array of objects (use table-layout) */
github 75lb / table-layout / es5 / lib / rows.js View on Github external
var hasValue = data.some(function (row) {
          var value = row[columnName];
          return t.isDefined(value) && !t.isString(value) || t.isString(value) && /\S+/.test(value);
        });
        return !hasValue;
github 75lb / usage-stats / es5 / bin / commands / command.js View on Github external
value: function cliView(data) {
      if (t.isString(data) || !t.isDefined(data)) {
        return data;
      } else {
        return require('util').inspect(data, { depth: 13, colors: true });
      }
    }
  }]);
github 75lb / command-line-usage / es5 / content.js View on Github external
value: function lines() {
      var content = this._content;
      var defaultPadding = { left: '  ', right: ' ' };

      if (content) {
        if (t.isString(content)) {
          var table = new Table({ column: ansi.format(content) }, {
            padding: defaultPadding,
            maxWidth: 80
          });
          return table.renderLines();
        } else if (Array.isArray(content) && content.every(t.isString)) {
          var rows = content.map(function (string) {
            return { column: ansi.format(string) };
          });
          var _table = new Table(rows, {
            padding: defaultPadding,
            maxWidth: 80
          });
          return _table.renderLines();
        } else if (Array.isArray(content) && content.every(t.isPlainObject)) {
          var _table2 = new Table(content.map(function (row) {
github 75lb / usage-stats / src / bin / commands / command.js View on Github external
cliView (data) {
    if (t.isString(data) || !t.isDefined(data)) {
      return data
    } else {
      return require('util').inspect(data, { depth: 13, colors: true })
    }
  }
}

typical

Isomorphic, functional type-checking for Javascript

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis