How to use the wcwidth function in wcwidth

To help you get started, we’ve selected a few wcwidth 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 jeremy5189 / PDModerator / src / components / Attendee.vue View on Github external
'form.attendee_name': function () {
      this.form.attendee_name_wclen = wcWidth(this.form.attendee_name);
    },
    // eslint-disable-next-line
github mgrip / react-cli / src / output.js View on Github external
function textColumnCount(text: string): number {
  // leaving the wrapper for now since its been changed so much recently
  // emojis are hard 😓
  return wcwidth(stripAnsi(text));
}
github jeremy5189 / PDModerator / src / components / Attendee.vue View on Github external
checkForm() {
      let msg = '';
      let stat = true;
      if (this.form.attendee_name === '') {
        msg = '名稱為必填欄位';
        stat = false;
      } else if (wcWidth(this.form.attendee_name) > 20) {
        msg = '名稱超過 20 個字符';
        stat = false;
      } else if (wcWidth(this.form.summary) > 200) {
        msg = '發言摘要超過 200 個字符';
        stat = false;
      }
      return {
        status: stat,
        message: msg,
      };
    },
    dangerAlert(msg) {
github kevinptt0323 / ptt-client / src / utils / char.js View on Github external
export function getWidth(widthType, str) {
	switch (widthType) {
		case 'length':
			return str.length;
		case 'wcwidth':
			return wcwidth(str);
		case 'dbcs':
			return dbcswidth(str);
		default:
			throw `Invalid widthType "${widthType}"`;
	}
}
github zaaack / foy / src / cli-loading.ts View on Github external
      line => Math.max(1, Math.ceil(wcwidth(stripAnsi(line)) / columns))
    )
github jeremy5189 / PDModerator / src / components / Attendee.vue View on Github external
checkForm() {
      let msg = '';
      let stat = true;
      if (this.form.attendee_name === '') {
        msg = '名稱為必填欄位';
        stat = false;
      } else if (wcWidth(this.form.attendee_name) > 20) {
        msg = '名稱超過 20 個字符';
        stat = false;
      } else if (wcWidth(this.form.summary) > 200) {
        msg = '發言摘要超過 200 個字符';
        stat = false;
      }
      return {
        status: stat,
        message: msg,
      };
    },
    dangerAlert(msg) {
github jeremy5189 / PDModerator / src / components / Attendee.vue View on Github external
'form.summary': function () {
      this.form.summary_wclen = wcWidth(this.form.summary);
    },
  },
github kevinptt0323 / ptt-client / src / utils / char.ts View on Github external
export function getWidth(widthType: string, str: string): number {
	switch (widthType) {
		case 'length':
			return str.length;
		case 'wcwidth':
			return wcwidth(str);
		case 'dbcs':
			return dbcswidth(str);
		default:
			throw `Invalid widthType "${widthType}"`;
	}
}

wcwidth

Port of C's wcwidth() and wcswidth()

MIT
Latest version published 8 years ago

Package Health Score

67 / 100
Full package analysis

Popular wcwidth functions