Skip to content

Latest commit

 

History

History
119 lines (80 loc) · 3.63 KB

File metadata and controls

119 lines (80 loc) · 3.63 KB

npm license

NoShift.js

NoShift.js

English | 日本語

Shift キーを押さずに JavaScript を書ける Joke 言語


記号 (!, ", (, ), {, } …) を入力するときに Shift を押すのが面倒なので、Shift を押さずに JavaScript が書けるようにした Joke 言語です。
^ プレフィックスのシーケンスで Shift が必要な記号を表現し、.nsjs ファイルは nsc CLI を使って JavaScript にコンパイルされます。

Important

⚠ 破壊的変更 (v0.15.0): 構文が大幅に変更されました。^3#(以前は大文字化)に、^6 は大文字化(以前は &)に、^\_(以前は |)に変更されました。新しいキーワードエイリアス: or||, and&&, @or|, @and&.nsjs ファイルを更新してください。


記号マップ

この変換表は NoShift.js 開発者のキーボード(JIS 配列)が基準です。

開発者のキーボード

NoShift JS NoShift JS
^1 ! ^^ ~
^2 " ^\ _
^3 # ^@ `
^4 $ ^[ {
^5 % ^] }
^6x X(大文字化) ^; +
^7 ' ^: *
^8 ( ^, <
^9 ) ^. >
^- = ^/ ?
^0 ^ (XOR)

テンプレート式: ^4^[${

キーワード: or||, and&&, @or|, @and&


クイックスタート

グローバルインストール

npm install -g noshift.js@latest
nsc create my-project

ローカルインストール

npm install -D noshift.js@latest
npx nsc create my-project

サンプル

// src/index.nsjs
const name ^- ^2^6no^6shift.js^2;
console.log^8^2^6hello from ^2 ^; name ^; ^2!^2^9;

コンパイル後:

const name = "NoShift.js";
console.log("Hello from " + name + "!");

プログラマティック API

コード内からライブラリとしても使えます:

// ESM
import { compile } from "noshift.js";

// CJS
const { compile } = require("noshift.js");

const result = compile('console.log^8^2^6hello^2^9;');
console.log(result.outputText);
// => console.log("Hello");

関連リンク / エコシステム


ライセンス

MIT © otoneko.