JSPM

  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q48402F
  • License MIT

A ts style version of js

Package Exports

  • jas-script
  • jas-script/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jas-script) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JAS

"JAS" is simply Javascript Actions Script based on the idea of a unique style js syntaxes

Example

const jas = require("jas-script");
const compiler = new jas();
compile.compile("./test/code.js");

test/code.js

//A simple discord bot code on jas
const discord = need(`eris`);
client.connect()
client.on("error", (err) => print(err));

Docs

Table of contents:-

  1. Basics
  2. Inter Process Database
  3. Difference

Understanding the Basics

First of all make an index.js file

const jas = require("jas-script");
const module = new jas("./test/code.js");
module.compile();

Now create a folder test and inside the folder make a file code.js

Contents:-

print(`Hello world!`);

now just run node index.js and you'll see the result

JAS-System-info: Found file ./test/code.ts
Hello world

Inter process jas database

The object is tempbase

The jas database has the following functions as a general db

/*
Set data to tempbase
*/
tempbase.set(`Hello`, "world");
tempbase.set(`number`, 1);

/*
Get data from tempbase
*/
tempbase.fetch(`Hello`); //returns "world"

/*
Delete data from tempbase
*/
tempbase.delete(`Hello`);

/*
Add data to tempbase
*/
tempbase.add(`number`, 3); //number is now 4

/*
Subtract data from tembase
*/
tempbase.subtract(`number`, 3); //number is now 1

Difference between js and jas

Following the differences between js and jas

1. require() is now need()

js

const fs = require("fs");

jas

const fs = need("fs");

2. Constructor

new module(...options) is now a(module, ...options)

js

const jas = require("jas-script");
const compiler = new jas("./test/code.js");

same code in jas

const jas = need("jas-script");
const compiler =  a(jas, "./test/code.js");
/*
You can still use new if you're not accustomed to it
*/
const compiler = new jas("./test/code.js"); //using legacy one

3. Process object changes

In jas process.cwd() will return "home/vm" and process.mainCwd() will return the correct dir

js

console.log(process.cwd())
//returns dir

jas

print(process.cwd())
//returns "home/vm"
print(process.mainCwd())
//returns dir name

NOTE

1. JAS cannot be used to make packages

2. JAS script once loaded cannot be terminated until node process dies

3. JAS script is still in BETA