0.8.2 • Published 7 years ago

atscript v0.8.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

atscript

NPM Version NPM Downloads

Little preprocessor for javascript.

Installation

npm install atscript

Features

@ -> this

// example
@bar; -> this.bar;
return @; -> return this;

API

Initialization

let atscript = require("atscript");

// using uglify-es minify
let options = {
    minify: true
}

Options

optiondefaultdescription
minifyfalseuglify-es minify function with compress={toplevel:true} option

.render(code, options)

let code = "return @bar;";

let result = atscript.render(code);
// -> "return this.bar;"

.renderFile(filePath, options)

// test.js

class Foo {
    bar(value) {
        @asd = value;
        return @baz;
    }
    
    getThis() {
        return @;
    }
}
// index.js

let result = atscript.renderFile("test.js");
// ->
class Foo {
    bar(value) {
        this.asd = value;
        return this.baz;
    }
    
    getThis() {
        return this;
    }
}

License

MIT