How to use the wordwrap function in wordwrap

To help you get started, we’ve selected a few wordwrap 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 WTW-IM / jira-precommit-hook / src / joke.js View on Github external
return async () => {
    try {
      const json = await jokeRequest;
      const { joke } = JSON.parse(json).value;
      const wrap = wordwrap(size.width - 10);
      const wrapped = wrap(`Good work now enjoy this joke. You deserve it!\n\n${joke}\n\n` + //eslint-disable-line
                           chalk.grey('If you want to disable these jokes run: \n' +
                           '> ./node_modules/.bin/jira-precommit jokes disable'));
      console.log(boxen(
        wrapped,
        {
          padding: 1,
          margin: 1
        }
      ));
    } catch (err) {} // eslint-disable-line
  };
}
github StoDevX / AAO-React-Native / source / views / dictionary / report / submit.js View on Github external
export function stringifyDictionaryEntry(entry: WordType): string {
	// let js-yaml handle dumping the word, just in case
	let initialData = jsYaml.safeDump({word: entry.word}, {flowLevel: 4})

	let definition = `definition: |
${wrap(2, 80)(entry.definition)}
`

	return `${initialData}${definition}`
}
github expo / expo-cli / packages / expo-cli / src / appleApi / authenticate.ts View on Github external
async function _promptForAppleId({ appleId }: Options): Promise {
  const wrap = wordwrap(process.stdout.columns || 80);
  log(
    wrap(
      'Please enter your Apple Developer Program account credentials. ' +
        'These credentials are needed to manage certificates, keys and provisioning profiles ' +
        'in your Apple Developer account.'
    )
  );

  log(wrap(chalk.bold('The password is only used to authenticate with Apple and never stored.')));

  const { appleId: promptAppleId } = await prompt(
    {
      type: 'input',
      name: 'appleId',
      message: `Apple ID:`,
      validate: nonEmptyInput,
github expo / expo-cli / packages / expo-cli / src / commands / build / ios / appleApi / authenticate.js View on Github external
async function _promptForAppleId({ appleId }) {
  const wrap = wordwrap(process.stdout.columns || 80);
  log(
    wrap(
      'Please enter your Apple Developer Program account credentials. ' +
        'These credentials are needed to manage certificates, keys and provisioning profiles ' +
        'in your Apple Developer account.'
    )
  );

  log(wrap(chalk.bold('The password is only used to authenticate with Apple and never stored.')));

  if (!appleId) {
    ({ appleId } = await prompt(
      {
        type: 'input',
        name: 'appleId',
        message: `Apple ID:`,
github expo / expo-cli / packages / expo-cli / src / commands / init.ts View on Github external
choices: FEATURED_TEMPLATES.map(template => {
          if (typeof template === 'string') {
            return prompt.separator(template);
          } else {
            return {
              value: template.name,
              name:
                chalk.bold(padEnd(template.shortName, descriptionColumn)) +
                trimStart(
                  wordwrap(
                    descriptionColumn + 2,
                    process.stdout.columns || 80
                  )(template.description)
                ),
              short: template.name,
            };
          }
        }),
      },
github madebywild / konterball / src / javascripts / hud / message.js View on Github external
constructor(scene, config, font, antique, emitter) {
    this.emitter = emitter;
    this.scene = scene;
    this.font = font;
    this.config = config;
    this.wrap = wrap(CHAR_LIMIT);
    this.buttons = {};
    this.antique = antique;
    this.messageGroup = new Group();
    this.intersectedButton = null;
    this.scene.add(this.messageGroup);
    this.setMessage('waiting');
    this.showMessage();
    this.crazyGroup = new Group();
    this.scene.add(this.crazyGroup);
    this.buttons[config.rainbowText] = new Button(this.crazyGroup, this.font, config.rainbowText, 0, 2, this.emitter, 0.7 * 100, 0.2 * 100, 0.01 * 100, 0.04 * 100);
    this.buttons[config.rainbowText].buttonGroup.position.z = 200;
    this.buttons[config.rainbowText].buttonGroup.rotation.y = Math.PI;
  }
github expo / expo-cli / packages / expo-cli / src / commands / start / TerminalUI.js View on Github external
export const printServerInfo = async (projectDir, options = {}) => {
  if (options.webOnly) {
    Webpack.printConnectionInstructions(projectDir);
    printHelp();
    return;
  }
  const url = await UrlUtils.constructManifestUrlAsync(projectDir);
  const username = await UserManager.getCurrentUsernameAsync();
  log.newLine();
  log.nested(`  ${u(url)}`);
  log.newLine();
  urlOpts.printQRCode(url);
  const wrap = wordwrap(2, process.stdout.columns || 80);
  const wrapItem = wordwrap(4, process.stdout.columns || 80);
  const item = text => '  \u2022 ' + trimStart(wrapItem(text));
  const iosInfo = process.platform === 'darwin' ? `, or ${b('i')} for iOS simulator` : '';
  log.nested(wrap(u('To run the app with live reloading, choose one of:')));
  if (username) {
    log.nested(
      item(
        `Sign in as ${i(
          '@' + username
        )} in Expo client on Android or iOS. Your projects will automatically appear in the "Projects" tab.`
      )
    );
  }
  log.nested(item(`Scan the QR code above with the Expo app (Android) or the Camera app (iOS).`));
  log.nested(item(`Press ${b`a`} for Android emulator${iosInfo}.`));
  log.nested(item(`Press ${b`e`} to send a link to your phone with email.`));
github expo / expo-cli / packages / expo-cli / src / commands / start / TerminalUI.js View on Github external
export const printServerInfo = async (projectDir, options = {}) => {
  if (options.webOnly) {
    Webpack.printConnectionInstructions(projectDir);
    printHelp();
    return;
  }
  const url = await UrlUtils.constructManifestUrlAsync(projectDir);
  const username = await UserManager.getCurrentUsernameAsync();
  log.newLine();
  log.nested(`  ${u(url)}`);
  log.newLine();
  urlOpts.printQRCode(url);
  const wrap = wordwrap(2, process.stdout.columns || 80);
  const wrapItem = wordwrap(4, process.stdout.columns || 80);
  const item = text => '  \u2022 ' + trimStart(wrapItem(text));
  const iosInfo = process.platform === 'darwin' ? `, or ${b('i')} for iOS simulator` : '';
  log.nested(wrap(u('To run the app with live reloading, choose one of:')));
  if (username) {
    log.nested(
      item(
        `Sign in as ${i(
          '@' + username
        )} in Expo client on Android or iOS. Your projects will automatically appear in the "Projects" tab.`
      )
    );
  }
  log.nested(item(`Scan the QR code above with the Expo app (Android) or the Camera app (iOS).`));
  log.nested(item(`Press ${b`a`} for Android emulator${iosInfo}.`));
  log.nested(item(`Press ${b`e`} to send a link to your phone with email.`));
  if (!username) {

wordwrap

Wrap those words. Show them at what columns to start and stop.

MIT
Latest version published 9 years ago

Package Health Score

65 / 100
Full package analysis

Popular wordwrap functions