Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/ai/convert-layout

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ai/convert-layout

  • v0.0.0-20231017072106-a218490354c7
  • Source
  • Go
  • Socket score

Version published
Created
Source

Convert Layout

A JavaScript library to convert text from one keyboard layout to other.

Useful to prevent errors on english-only fields, like a credit card owner field.

var ru = require('convert-layout/ru');

bankcardName.keyup(function () {
  bankcardName.value = ru.toEn(bankcardName.value);
});
Sponsored by Evil Martians

Usage

There are two ways to load a keyboard layout definition. If you plan on using a single layout, just load the file directly:

var ru = require('convert-layout/ru');

Also you can get a object with all layouts (but app size will be bigger):

var layouts = require('convert-layout');
layout = layouts[name];

Every layout has fromEn and toEn methods:

ru.toEn('руддщ')    //=> "hello"
ru.fromEn('ghbdtn') //=> "привет"

Layouts

Currently supported keyboard layouts:

  • Arabic
  • Belarusian
  • English (QWERTY, Dvorak, Colemak)
  • German
  • Greek
  • Kazakh
  • Korean
  • Russian
  • Spanish
  • Ukrainian
  • Hebrew
  • Persian
  • Czech

If you want to add a new keyboard layout definition:

  1. Fork a project. Create a branch.
  2. Add a CODE.json file with layout buttons map. See example in ru.json. Lower case letters will be converted to upper case automatically. However, all non-letters symbols should be added both in uppercase and lowercase.
  3. Run yarn test. Project will be built automatically.
  4. Add layout to the list above.
  5. Send a pull request.

FAQs

Package last updated on 17 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc