How to use the punycode.ucs2.decode function in punycode

To help you get started, we’ve selected a few punycode 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 webhintio / hint / scripts / check-commit-message.js View on Github external
const checkFirstLine = (line) => {
    const ALLOWED_TAGS = [
        'Fix:',
        'Breaking:',
        'Build:',
        'Chore:',
        'Docs:',
        'New:',
        'Update:',
        'Upgrade:'
    ];

    let issues = [];

    if (ucs2.decode(line).length > 72) {
        issues.push('[Line 1] Has over 72 characters.');
    }

    const tag = ALLOWED_TAGS.filter((allowedTag) => {
        return line.startsWith(allowedTag);
    })[0];

    if (!tag) {
        issues.push(`[Line 1] Does not start with one of the following tags: \n\n     ${ALLOWED_TAGS.join('\n     ')}\n`);
    }

    const afterTag = tag ? line.split(tag)[1] : line;

    if (!afterTag) {
        issues.push(`[Line 1] No summary.`);
github annexare / Countries / emoji-flag.js View on Github external
const getUnicode = (emoji) => {
  return ucs2.decode(emoji)
    .map(code => 'U+' + Number(code).toString(16).toUpperCase())
    .join(' ');
};
github webhintio / hint / scripts / check-commit-message.js View on Github external
const checkLine = (line, lineNumber) => {
    const chars = ucs2.decode(line);
    let issues = [];

    /*
     * If the line has more then 72 characters, and the part just before
     * and after the 72 limit contains spaces (i.e. it's not something
     * like a long URL), suggest splitting the line into multiple lines.
     */

    if ((chars.length > 72) &&
        (chars.slice(60, chars.length).includes(32))) {
        issues.push(`[Line ${lineNumber}] Has over 72 characters, and should be split into multiple lines.`);
    }

    issues = [...issues, ...checkWording(line, lineNumber)];

    return issues;
github annexare / Countries / dist / index.js View on Github external
const getUnicode = (emoji) => {
  return ucs2.decode(emoji)
    .map(code => 'U+' + Number(code).toString(16).toUpperCase())
    .join(' ');
};
github webhintio / hint / packages / hint-manifest-app-name / src / hint.ts View on Github external
const checkIfPropertyValueIsUnderLimit = (resource: string, content: string | undefined, propertyName: string, shortNameLengthLimit: number, getLocation: JSONLocationFunction) => {
            if (content && (ucs2.decode(content).length > shortNameLengthLimit)) {
                const message = getMessage('shouldHavePropertyShort', context.language, [propertyName, shortNameLengthLimit.toString()]);
                const location = getLocation(propertyName, { at: 'value' });

                context.report(resource, message, { location, severity: Severity.warning });

                return false;
            }

            return true;
        };
github nfroidure / svgicons2svgfont / src / index.js View on Github external
glyph.unicode.forEach((unicode, i) => {
        const unicodeStr = ucs2
          .decode(unicode)
          .map(point => '&#x' + point.toString(16).toUpperCase() + ';')
          .join('');
        const d = glyphPath.round(this._options.round).encode();

        this.push(
          '    

punycode

A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis