New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aspiejs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aspiejs

A modified script that compiles to JavaScript.

  • 0.2.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Aspie JS

npm version GitHub top language GitHub license

npm downloads npm downloads jsDelivr hits (GitHub)

paypal

A modified script that compiles to JavaScript

This project is still in beta, and is mostly the same as JavaScript. This purpose of this module is to add some additional syntax to JavaScript. This may be updated with new features added in the future.

Whats New

  • added import and export key words (similar to typescript syntax)

Installation

npm install @aspiesoft/aspiejs


# install without terser (optional)
npm install --no-optional @aspiesoft/aspiejs

Setup

const aspieJS = require('@aspiesoft/aspiejs');

Usage


// to compile a file from aspieJS to JavaScript
aspieJS.file(__dirname+'/path/to/file.js', __dirname+'/path/to/file.min.js');

// to compile a string
const output = aspieJS.script(`
validFunction(){
  console.log('This function is valid in Aspie JS!')
}

log(2^2) // => console.log(Math.pow(2^2))
`);

// to compile a string in async (and minify with terser if available)
aspieJS.scriptAsync('My AspieJS Script!').then(output => {
  // do stuff...
});

// to compile a file in sync
aspieJS.fileSync(__dirname+'/path/to/file', __dirname+'/path/to/file.output');

Custom Syntax


// Math.pow
let n = 2 ^ 2
n ^= 5

// nth root (Math.sqrt)
let n = 4 \ 2
n \= 5 // 5th root (n = Math.pow(n, 1/5))

// absolute value (Math.abs)
|2 - 10| // output: 8
2 - 10 // output: -8

let circumference = pi // => let circumference = Math.PI

// rounding (used Math.round with some multiplication and division)
// JavaScripts .toFixed method does not handle negative values
log(circumference ~ 0) // output: 3
circumference ~= 2
log(circumference) // output 3.14

// typeof is modified to output other common var types
typeof 'string' === 'string'
typeof /regex/ === 'regex'
typeof [1, 2, 3] === 'array'
typeof {key: 'value'} === 'object'
typeof null === 'null'

// regex modifications
/number \c/ // => /number (?:-?[0-9]+(?:\\.[0-9]+|)|-?\\.[0-9]+)/

// in addition, objects are auto closed to prevent errors
{[1, 2], [3, 4} // compiles to => {[1, 2], [3, 4]}

Keywords

FAQs

Package last updated on 08 Jul 2022

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