neamonjs

0.1.2 • Public • Published

NeamonJS

  • A lightweight and easy to use language based and written on javascript.
  • Allows you to reload modules in real time.
  • If you need help write to me at Telegram @nelonn
  • If you encounter any of those fell free to open an issue in our github repository.

Download & Update

You can download it from npm:

npm i neamonjs

You can update to a newer version to receive updates using npm.

npm update neamonjs

Changelog

...

Setting Up

The first option (allows you to package the application)
index.js:

const neamon = require('neamonjs');
neamon(__dirname, 'script.njs');

The second option (no .js files)
package.json:

...
"scripts": {
  "start": "neamon script.njs"
},
...

Example

Example modules:

hello_world.njs:

exports.sayHello = () => {
  console.log('Hello World!');
};

script.njs:

const hello_world = get('./hello_world.njs');

hello_world.sayHello();

Differences from JS

get

Warning, getrequire!
Use get(filename) only for .njs files
and use require(filename) for everyone else

Exports

exports = 'simple_string';

This will return an error, you need to do this:

exports.string = 'simple_string';

Map

Now Map has a find method:

const testMap = new Map();
testMap.set('some_key', { string: 'some string', number: 10 });
console.log(testMap.find(e => e.number === 10));
  • Output:
{ string: 'some string', number: 10 }

New Methods & Classes

sleep

const asyncFunction = async () => {
  await sleep(1000); // sleep 1000ms
  console.log('hello');
};
asyncFunction();
  • Output after 1000ms:
hello

KeyArray

const key_array = new KeyArray();
key_array.add('sun');
key_array.add(['moon', 'earth']);

console.log(key_array.get('sun')); // true

key_array.delete('sun');
console.log(key_array.get('sun')); // false

console.log(key_array);
  • Output:
KeyArray(2) [ 'moon', 'earth' ]

/neamonjs/

    Package Sidebar

    Install

    npm i neamonjs

    Weekly Downloads

    8

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    20.8 kB

    Total Files

    19

    Last publish

    Collaborators

    • nelonn