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

ds-beta

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ds-beta

an open source Framework to create your app easy

  • 0.0.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

DreamScript

DreamScript is an OpenSource superset of JavaScript that compiles to clean JavaScript output.

Build Status Coverage License

NPM

DS Installation

  • Install NodeJs
  • Open your Console
  • Install globally using NPM

npm install -g dreamscript

  • or as a library

npm install --save dreamscript

Get Started

  • Command
~$ dreamscript run <your file or directory file>
atau
~$ ds run <your file or directory file>
atau
~$ ds <your file or directory file>

for help:
~$ ds -h
  • Directory

Example

.
├── code
└── lib
    ├── index.ds
    └── code.ds

$ dreamscript d code lib

this command will compile all files in the lib folder and write the compilation results to the code folder with the same name and the extension js

.
├── code
│   ├── index.js
│   └── code.js
└── lib
    ├── index.ds
    └── code.ds

Example Compile

const ds = require("dreamscript");

var code = `
    func ds(){
        write("hello, world");
    }
    ds();
`;

// compile code
ds.compile(code).then(compiled => {
    console.log(compiled);
});

  • You can see other examples at Example

DreamScript Codes

  • DS Function
func ds(){
    write("hello, earth");
}
ds();
  • If Statement
var me = "jelek";

tulis("sekarang saya " + saya);

jika(saya tidak "ganteng"){
    saya = "ganteng";
}

tulis("sekarang saya " + saya);
  • ulangi
ulangi(var i sebanyak 20 kali){
    tulis(i);
}
  • selama atau while
var i = 10;
selama(i > 0){
    i--;
    tulis(i);
}
  • untuk atau for
untuk(var i = 0;i kurangDari 10;i++){
    tulis(i);
}
  • perulangan dan objek
var a = 1;

untuk(var i = 1;i kurangDari 10;i++){
    a *= i;
    tulis(i);
}

var manusia = {
    nama: "dinda",
    uang: "Rp" + a
}

tulis(manusia.nama + " mempunyai uang sebanyak " + manusia.uang);
  • Math Basic
write(3 + 2 - 12 + 32 * 21 / 2);
  • Input
var name = inp("Whats Your Name: ");
write("hi" + name);
  • Kelas atau class
kelas Mamalia{
    konstruksi(){
        ini.bertulangBelakang = benar
        ini.menyusui = benar
    }
}

kelas Kucing turunan Mamalia{
    konstruksi(){
        // selalu panggil fungsi super() untuk mengunakan variabel induk
        super();
        tulis(ini.menyusui);
    }
}

var neko = buat Kucing();
  • Pyramid
var baris = 5;
var k = 0;
var i = 1;
var j = 1;

selama(i <= baris){
    var hasil = "";
    untuk(j = 1; j <= baris dikurangi i; j++){
        hasil += " ";
    }
    selama(k bukan 2 dikali i dikurangi 1){
        hasil += "*";
        k++;
    }
    tulis(hasil);
    i++;
    k = 0;
}
  • Number
var a = inp("angka a: "); 
var b = inp("angka b: "); 

write(a + b) // "32"

var c = numb(inp("angka c: "));
var d = numb(inp("angka d: ")); 

write(c + d) // 5
  • Teks atau String
tulis(2 + 2); // 4

tulis(Teks(2 + 2)); // "22"

Difference Syntax

DreamScriptJavaScript
func()function()
write()console.log()
type{}class{}
struct()constructor()
inp()~~~

CREDITS

Keywords

FAQs

Package last updated on 20 Oct 2021

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