|
12 | 12 |
|
13 | 13 | <p align="center">Easy Script is a npm package which makes coding in JavaScript easy!</p> |
14 | 14 |
|
15 | | -## Usage |
16 | | -Using Easy Script is very easy to do. |
| 15 | +<h2 align="center">Usage</h2> |
| 16 | +<p align="center">If you want to learn how to use Easy Script, you can find all of the information you need on the <a href="https://github.com/EasyScriptJS/EasyScript/wiki/Usage">wiki</a>.</p> |
17 | 17 |
|
18 | | -1. Install the package using the following command: |
19 | | - |
20 | | -```bash |
21 | | -npm install easyscriptjs |
22 | | -``` |
23 | | - |
24 | | -2. Import the modules you require. |
25 | | - - You can find a list of all the modules [here](#modules). |
26 | | - |
27 | | -```js |
28 | | -// List all of the modules you want to use in the brackets |
29 | | -// Example: { flip, print, random } |
30 | | -const { print } = require("easyscriptjs"); |
31 | | -``` |
32 | | - |
33 | | -3. Use it! |
34 | | - |
35 | | -```js |
36 | | -const { print } = require("easyscriptjs"); |
37 | | - |
38 | | -print("Hello World"); |
39 | | -``` |
40 | | - |
41 | | -## Modules |
42 | | - |
43 | | -### flip |
44 | | -The flip module is a module which flips a coin and returns `heads` or `tails`. |
45 | | - |
46 | | -**Example** |
47 | | - |
48 | | -```js |
49 | | -// Import module |
50 | | -const { flip } = require("easyscriptjs"); |
51 | | - |
52 | | -// Generate a result |
53 | | -const result = flip(); |
54 | | - |
55 | | -// Log result to console |
56 | | -console.log(result); |
57 | | -``` |
58 | | - |
59 | | -### log |
60 | | -The log module lets you use a shortened version of `console.log` in Node.js. It also supports variables as well. |
61 | | - |
62 | | -**Examples** |
63 | | - |
64 | | -- With text: |
65 | | -```js |
66 | | -// Import module |
67 | | -const { log } = require("easyscriptjs"); |
68 | | - |
69 | | -// Logs text to console |
70 | | -log("Hello World"); |
71 | | -``` |
72 | | - |
73 | | -- With a variable: |
74 | | -```js |
75 | | -// Import module |
76 | | -const { log } = require("easyscriptjs"); |
77 | | - |
78 | | -// Text to be logged |
79 | | -const text = "Hello World"; |
80 | | - |
81 | | -// Logs the "text" variable to console |
82 | | -log(text); |
83 | | -``` |
84 | | - |
85 | | -### print |
86 | | -The print module allows you to use `console.log` as if it was Python. It also supports variables as well. |
87 | | - |
88 | | -**Examples** |
89 | | - |
90 | | -- With text: |
91 | | -```js |
92 | | -// Import module |
93 | | -const { print } = require("easyscriptjs"); |
94 | | - |
95 | | -// Logs the text to console |
96 | | -print("Hello World"); |
97 | | -``` |
98 | | - |
99 | | -- With a variable: |
100 | | -```js |
101 | | -// Import module |
102 | | -const { print } = require("easyscriptjs"); |
103 | | - |
104 | | -// Text to be logged |
105 | | -const text = "Hello World"; |
106 | | - |
107 | | -// Logs the "text" variable to console |
108 | | -print(text); |
109 | | -``` |
110 | | - |
111 | | -### random |
112 | | -The random module allows you to generate a random number. By default the highest number is `100`, but you can change that by specifying a number in the function. The highest number supported is `2,147,483,647` as that is the 32-bit integer limit. |
113 | | - |
114 | | -**Examples** |
115 | | - |
116 | | -- Without input: |
117 | | -```js |
118 | | -// Import module |
119 | | -const { random } = require("easyscriptjs"); |
120 | | - |
121 | | -// Generates a result from 1-100 |
122 | | -const result = random(); |
123 | | - |
124 | | -// Generates a random number from 1 to 100 (the default) |
125 | | -console.log(result); |
126 | | -``` |
127 | | - |
128 | | -- Example with input: |
129 | | -```js |
130 | | -// Import module |
131 | | -const { random } = require("easyscriptjs"); |
132 | | - |
133 | | -// Generates a random number from 1 to 30 |
134 | | -const result = random(30); |
135 | | - |
136 | | -// Logs the result to console |
137 | | -console.log(result); |
138 | | -``` |
| 18 | +<h2 align="center">Modules</h2> |
| 19 | +<p align="center">If you want to learn more about Easy Script's modules, you can find information on all of the modules on the <a href="https://github.com/EasyScriptJS/EasyScript/wiki/Modules">wiki</a>.</p> |
0 commit comments