Skip to content

Support Plugin Interface #9

@tebaly

Description

@tebaly

For example in other languages your code "1337 characters" is useless. For me, this path of library is useless.

I would like to add the functionality of locally used templates. It would be nice to write a plugin and make it possible to connect it via the library. There are many languages - there can be many plug-ins, their development can go independently.

You can extract this part of your library in a separate plugin to show how it can be done by other developers for other languages (Russian etc.)

    /**
     * A mapping that maps regular characters to 1337 characters.
     *
     * @type {{o: string, g: string, b: Array, t: string, s: string, a: string, e: string, z: string, i: string, l: string}}
     */
    this.map1337 = {
      o: '0',
      g: '9',
      b: ['8', '6'],
      t: '7',
      s: '5',
      a: '4',
      e: '3',
      z: '2',
      i: '1',
      l: '1'
    };
  }

//...
        if (typeof this.map1337[character] === 'undefined') {
          pattern += (character + (!last ? any : ''));

          continue;
        }

        if (typeof this.map1337[character] === 'string') {
          pattern += ('((' + character + '|' + this.map1337[character] + ')' + (!last ? any : '') + ')');

          continue;
        }

        pattern += '((' + character;

        for (var m = 0; m < this.map1337[character].length; m++) {
          pattern += '|' + this.map1337[character][m];
        }

//...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions