abbreviatedjs

1.1.5 • Public • Published

Ab.JS

Make writing JS easier

lil tool i use internally

Install

npm install --save-dev abbreviatedjs

commands

npx abv --file [.ajs file]
# ^^ To compile a file ^^
npx abv --dir [dir]
# ^^ To compile all the .ajs files in [dir]

use --ts to use .ats files

abbreviations

In the form [{abbreviation}, {commonjs equivatent}]

  [`lg`, `console.log`],
  [`er`, `console.error`],
  [`wrn`, `console.warn`],
  [`cls`, `console.clear()`], // no parentheses needed, no args
  [`vv`, `var`],
  [`vl`, `let`],
  [`vc`, `const`],
  [`eq`, `==`],
  [`seq`, `===`],
  [`el`, `else`],
  [`pl`, `+=`],
  [`mn`, `-=`],
  [`fun`,`function`],
  [`as`, `async`],
  [`aw`, `await`],
  [`to_i`, `parseInt`],
  [`to_f`, `parseFloat`],
  [`err`, `new Error`],
  [`tt`, `true`],
  [`ff`, `false`],
  [`dte`, `new Date`],
  [`cth`, `catch`],
  [`jp`, `JSON.parse`],
  [`jst`, `JSON.stringify`],
  [`brk`, `break`],
  [`clss`, `class`],
  [`expt`, `export`],
  [`imp`, `import`],
  [`req`, `require`],
  [`ret`, `return`],
  [`swt`, `switch`],
  [`sta`, `static`],
  [`fori`, ` for (let i = 0;`],
  [`efori`, `; i++)`],
  [`dft`, ` default`]
]

suffixes

  [`.to_s`, `.toString()`],

example script

fun main() {
  fori i<100 efori {
    lg(i.to_s);
  }
  /* >> '1'
   * >> '2'
   * >>  ...
   * >> '99'
   */
}

This script is a main() function that iterates 100 times 0..99, and prints stringified versions to the console.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i abbreviatedjs

    Weekly Downloads

    1

    Version

    1.1.5

    License

    ISC

    Unpacked Size

    8.32 kB

    Total Files

    3

    Last publish

    Collaborators

    • rave-names