require('protos.js');
var users = [];
users.load('users.txt'); // arrays can load data
if (!users.has('mike')) { // arrays can check content
users.push('mike')
users.save('users.txt') // arrays can save data
}
if ('mike'.in(users)) { // strings can also check if exists in arrays
'mike is here'.log() // strings can console.log
'John'.appendFile('users.txt') // strings can append to file
}
var str = 'test';
str.log(); // same as console.log(str);
str.save('file.txt');
str.save('file.txt', function() {
'async saved!'.log();
});
var str = ''.load('data.txt');
['a','b','c','d'].cut(1,3);
['a','b','c','d'].cut(1,-1); // -1 means last item (like python)
// STRING MANIPULATION MADE EASY (python style)
var el = 'hello'.cut(1,3);
var lo = 'hello'.cut(3,-1);
var num = '3'.toInt();
// JSON FILES
var struct = {}.load('file.json'); // load json files into js object
struct.save('file.json'); // save js object into json file
struct.save('file.json', function() { // save async
'saved'.log();
});
struct.dir() // same as console.dir(struct);
// FUZZY HASHING thanks to ctph.js
'hello'.compare('hell') // 50%
'hello'.compare('hello') // 100%
'hello'.compare('abcd') // 0%
var hash = 'hello'.fuzzyHash();
// calling a function on all items
objects.call('method',[params]);