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

vnls

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vnls - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

1669

lib/vnls.js

@@ -1,916 +0,845 @@

if (!String.prototype.trim) {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
};
}
/**
* VNLS javascript server/ client framework
* Copyright (C) 2011 [Jorrit Duin](https://github.com/venalis/VNLS)
* [Wiki](https://github.com/venalis/VNLS/wiki)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses>.
*
*/
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(searchElement) {
"use strict";
if (this == null) {
throw new TypeError;
}
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 1) {
n = Number(arguments[1]);
if (n != n) {
n = 0;
} else if (n != 0 && n != Infinity && n != -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
};
}
/** {Object} global VNLS object */
var VNLS = new function() {
"use strict";
var CLASSES = "_classes_", VERSION = "master", INIT = "__init__", ENV = "";
function _VnlsFrameWork() {
if (typeof window !== "undefined" && typeof window.location !== "undefined") {
ENV = "browser";
} else if (typeof require === "function") {
if (process) {
ENV = "nodejs";
}
}
this._namespace = "VNLS";
}
_VnlsFrameWork.prototype.version = function() {
return VERSION;
'use strict';
/** Type {String} for the classes namespace */
var CLASSES = '_classes_';
/** Type {String} the veersion */
var VERSION = '__vnls_version__';
/** Type {String} var name for triggering Object constuctors */
var INIT = '__init__';
/** Type {String} env browser || nodejs */
var ENV = '';
/**
* Constructor
* Determines the environment
* Set the props for the 'MAIN' namespace (VNLS)
*/
function _VnlsFrameWork() {
if(typeof window !== 'undefined' && typeof window.location !== 'undefined'){
ENV = 'browser';
}else if(typeof require === 'function'){
if(process) {
ENV = 'nodejs';
}
};
_VnlsFrameWork.prototype.inherits = function(fn, ob, strict) {
if (typeof strict == "undefined") {
strict = true;
}
var fn_prototype = {};
for (var key in fn.prototype) {
fn_prototype[key] = fn.prototype[key];
}
fn.prototype = this.copy(ob);
for (var key in fn_prototype) {
if (fn.prototype.hasOwnProperty(key)) {
if (strict && !(key === INIT)) {
throw "inherits() overwrites: " + key;
}
}
fn.prototype[key] = fn_prototype[key];
}
fn.prototype.constructor = fn;
return fn;
this._namespace = 'VNLS';
}
_VnlsFrameWork.prototype.version = function() {
return VERSION;
}
/**
*
* Inherit an object and pass it to a Class definition
* @param {Function} fn, Literal function
* @param {Object} ob, Object to copy from
* @param {bool} strict (Do or don't overwrite props)
*
* @returns {Object} extended javascript Cladd
*
* If 'strict' == true,
* overwriting properties and methods are allowed
*/
_VnlsFrameWork.prototype.inherits = function(fn, ob, strict) {
if(typeof strict == 'undefined') {
strict = true;
};
_VnlsFrameWork.prototype.copy = function(obj) {
var type = VNLS.jsType(obj);
if (type === "Array" || type === "Arguments") {
var out = [], i = 0, len = obj.length;
for (; i < len; i++) {
out[i] = this.copy(obj[i]);
}
return out;
}
if (type === "Object") {
var out = {}, i;
for (i in obj) {
out[i] = this.copy(obj[i]);
}
return out;
}
return obj;
var fn_prototype = {};
for (var key in fn.prototype) {
fn_prototype[key] = fn.prototype[key]
};
_VnlsFrameWork.prototype.addClass = function(ns, fn) {
if (ns === "") {
ns = CLASSES;
} else {
ns = CLASSES + "." + ns;
fn.prototype = this.copy(ob);
for (var key in fn_prototype) {
if(fn.prototype.hasOwnProperty(key)) {
if(strict && !(key === INIT)) {
throw 'inherits() overwrites: ' + key;
}
ns = VNLS.ns(ns, {});
var function_name = this.getFunctionName(fn());
if (typeof fn() !== "function") {
throw "Class definition needs to be a function " + class_name;
}
if (function_name === "") {
throw "Class-name could not be determined, check your syntax.";
}
if (ns.hasOwnProperty(function_name)) {
throw "Class already registered: " + function_name;
}
ns[function_name] = fn();
return this;
}
fn.prototype[key] = fn_prototype[key];
};
_VnlsFrameWork.prototype.getObject = function(ns, class_name) {
if (ns === "") {
ns = CLASSES;
} else {
ns = CLASSES + "." + ns;
}
ns = VNLS.ns(ns);
var pass_prams = [];
for (var i = 0, len = arguments.length; i < len; i++) {
if (i > 1) {
pass_prams.push(arguments[i]);
}
}
if (ns.hasOwnProperty(class_name)) {
var ob = new ns[class_name];
if (typeof ob[INIT] === "function") {
ob[INIT].apply(ob, pass_prams);
}
return ob;
} else {
throw "Object not found:" + class_name;
}
fn.prototype.constructor = fn;
return fn;
};
/**
* Copy an Array or Object to a new 'reference'
* @param {Object} obj or array
* @returns {Object} copy
*/
_VnlsFrameWork.prototype.copy = function(obj) {
var type = VNLS.jsType(obj);
var out;
var i;
var len = 0;
if(type === 'Array' || type === 'Arguments'){
out = [];
i = 0;
len = obj.length;
for(; i < len; i++){
out[i] = this.copy(obj[i]);
}
return out;
};
_VnlsFrameWork.prototype.ns = function(ns, ob, strict) {
var item, ns_path = [], i, len, current_ns;
if (typeof strict === "undefined") {
strict = true;
}
if (typeof ns === "undefined") {
ns = "";
}
if (typeof ns !== "string") {
throw "namespace should be a string";
}
if (/(\.\.|^\.|^[0-9]|\.$|[^a-z0-9_\.])/.test(ns)) {
throw "invalid namespace [a-z0-9_]";
}
if (!(typeof ob === "object" || typeof ob === "undefined")) {
throw "argument 2 is not an object";
}
ns_path = false;
current_ns = VNLS;
if (ns !== "") {
ns_path = ns.split(".");
}
i = 0;
len = ns_path.length;
if (ns_path) {
for (; i < len; i++) {
if (typeof current_ns[ns_path[i]] === "undefined" && typeof ob === "object") {
current_ns[ns_path[i]] = {};
current_ns[ns_path[i]]._namespace = ns_path.slice(0, i + 1).join(".");
} else {
if (VNLS.jsType(current_ns[ns_path[i]]) !== "Object") {
throw "Could not get this namespace";
}
}
current_ns = current_ns[ns_path[i]];
}
}
if (typeof ob === "undefined") {
return current_ns;
}
for (item in ob) {
if (strict && typeof current_ns[item] !== "undefined") {
throw "Extending not possible, strict is true";
}
current_ns[item] = ob[item];
}
return current_ns;
if(type === 'Object'){
out = {};
for (i in obj) {
out[i] = this.copy(obj[i]);
}
return out;
};
_VnlsFrameWork.prototype.nsInfo = function(ns) {
var res = [], iface, a, tmp, i, len;
if (!(VNLS.jsType(ns) === "String" || VNLS.jsType(ns) === "undefined")) {
return res;
return obj;
};
/**
* Add a class defition
* @param {String} ns, namespace
* @param {Function} fn, constructor type function
*
* @returns {Object} self
*/
_VnlsFrameWork.prototype.addClass = function(ns, fn) {
if(ns === ''){
ns = CLASSES;
}else{
ns = CLASSES + '.' + ns;
}
/* Forcing a namespace */
ns = VNLS.ns(ns, {});
var function_name = this.getFunctionName(fn());
if(typeof fn() !== 'function'){
throw 'Class definition needs to be a function ' + class_name;
}
if(function_name === ''){
throw 'Class-name could not be determined, check your syntax.';
}
if(ns.hasOwnProperty(function_name)){
throw 'Class already registered: ' + function_name;
}
ns[function_name] = fn();
return this;
}
/**
* Get initialse an object
* @param {String} ns, namespace
* @param {String} class_name
* @param any ,multiple arguments are passed to the new object constructor
*
* @returns {Object}
*/
_VnlsFrameWork.prototype.getObject = function(ns, class_name) {
if(ns === '') {
ns = CLASSES;
}else{
ns = CLASSES + '.' + ns;
}
ns = VNLS.ns(ns);
var pass_prams = [];
for(var i = 0, len = arguments.length; i < len; i++){
if(i > 1){
pass_prams.push(arguments[i]);
}
}
if(ns.hasOwnProperty(class_name)){
var ob = new ns[class_name]();
if(typeof ob[INIT] === 'function'){
ob[INIT].apply(ob, pass_prams);
}
return ob;
}else{
throw 'Object not found:' + class_name;
}
}
/**
* Get an namespace object or extend a namespace object
* @param {String} ns, name space
* @param {Object} ob, extens namespace with ob
* @param {bool} strict, do or don't overwrite exsisting methods
*
* @returns {Object} namespace
*/
_VnlsFrameWork.prototype.ns = function(ns, ob, strict) {
var item;
var ns_path = [];
var i;
var len;
var current_ns;
if(typeof strict === 'undefined'){
strict = true;
}
if(typeof ns === 'undefined'){
ns = '';
}
if(typeof ns !== 'string'){
throw 'namespace should be a string';
}
if(/(\.\.|^\.|^[0-9]|\.$|[^a-z0-9_\.])/.test(ns)){
throw 'invalid namespace [a-z0-9_]';
}
if(!(typeof ob === 'object' || typeof ob === 'undefined')){
throw 'argument 2 is not an object';
}
ns_path = false;
current_ns = VNLS; // Default namespace
if(ns !== '') {
ns_path = ns.split('.');
}
i = 0;
len = ns_path.length;
if(ns_path){
for(;i < len; i++){
// Create the namespaces ifit not EXCISTS
// Only create an object ifwe have an object as argument
// If we create a 'new' object we add a namespace prop with it.
if(
typeof current_ns[ns_path[i]] === 'undefined' &&
typeof ob === 'object'
){
current_ns[ns_path[i]] = {};
current_ns[ns_path[i]]._namespace = ns_path.slice(0, i + 1).join('.');
}else{
if(VNLS.jsType(current_ns[ns_path[i]]) !== 'Object'){
// We only extend or get 'real' objects
throw 'Could not get this namespace';
}
}
try {
iface = VNLS.ns(ns);
} catch (e) {
return res;
}
if (!ns) {
ns = "VNLS";
} else {
ns = "VNLS." + ns;
}
for (a in iface) {
if (VNLS.jsType(iface[a]) === "Object" && !/^_\w+/.test(a) && iface[a].hasOwnProperty("_namespace")) {
tmp = VNLS.nsInfo(iface[a]._namespace);
i = 0;
len = tmp.length;
for (; i < len; i++) {
res.push(tmp[i]);
}
} else if (VNLS.jsType(iface[a]) === "Function" && !/^_\w+/.test(a)) {
res.push(ns + "." + a);
}
}
return res;
};
_VnlsFrameWork.prototype.checkArgs = function(args, validator) {
var i, len, html = /^HTML\w*Element$/;
if (!(VNLS.jsType(args) === "Arguments" || VNLS.jsType(args) === "Array")) return false;
if (args.length != validator.length) {
return false;
}
current_ns = current_ns[ns_path[i]];
}
}
if(typeof ob === 'undefined'){
// We 'll just return the namespace
return current_ns;
}
for(item in ob){
if(strict && typeof current_ns[item] !== 'undefined'){
throw 'Extending not possible, strict is true';
}
// We don't copy, just mix-in
// current_ns[item] = VNLS.copy(ob[item]);
current_ns[item] = ob[item];
}
return current_ns;
};
/**
* Retrieve namespace info
* Show which public methods are available
*
* @param {String} ns, namespace
*
* @returns {Array}
*/
_VnlsFrameWork.prototype.nsInfo = function(ns) {
var res = [];
var iface;
var a;
var tmp;
var i;
var len;
if(!(VNLS.jsType(ns) === 'String' || VNLS.jsType(ns) === 'undefined')){
return res;
}
try{
iface = VNLS.ns(ns);
}catch(e){
return res;
}
if(!ns){
ns = 'VNLS'
}else{
ns = 'VNLS.' + ns;
}
for(a in iface){
if(VNLS.jsType(iface[a]) === 'Object'
&& !(/^_\w+/.test(a))
&& iface[a].hasOwnProperty('_namespace')){
tmp = VNLS.nsInfo(iface[a]._namespace);
i = 0;
len = args.length;
for (; i < len; i++) {
if (!(VNLS.jsType(args[i]) === validator[i] || html.test(validator[i]) && html.test(VNLS.jsType(args[i])))) {
return false;
}
len = tmp.length;
for(; i < len; i++){
res.push(tmp[i]);
}
return true;
};
_VnlsFrameWork.prototype.getGlobals = function(ob) {
var global_object = false, res = [], i;
if (typeof ob === "undefined") {
if (this.getEnv() === "nodejs") {
global_object = global;
} else {
global_object = window;
}
}
if (VNLS.jsType(ob) === "Object") {
global_object = ob;
}
if (!global_object) {
throw "Argument is not an object";
}
for (i in global_object) {
res.push(i);
}
global_object = false;
return res;
};
_VnlsFrameWork.prototype.getFunctionName = function(fn) {
var funcNameRegex = /function (.{1,})\(/;
var results = funcNameRegex.exec(fn.toString());
return results && results.length > 1 ? results[1] : "";
};
_VnlsFrameWork.prototype.jsType = function(fn) {
if (typeof fn === "undefined") return "undefined";
return {}.toString.call(fn).match(/\s([a-z|A-Z]+)/)[1];
};
_VnlsFrameWork.prototype.getEnv = function() {
return ENV;
};
return new _VnlsFrameWork;
};
}else if(VNLS.jsType(iface[a]) === 'Function' && !(/^_\w+/.test(a))){
res.push(ns + '.' + a);
}
}
return res;
}
if (VNLS.getEnv() === "nodejs") {
if (typeof global.VNLS === "undefined") {
global.VNLS = VNLS;
/**
* Check Arguments or an array against jsType's
* There is also a check on the number of params
* Minor challenge: There is no room for optional params
* @param {Array} args, arguments array
* @param {Array} validator, array with validators
* @Example:
*
* VNLS.checkArgs(arguments,['String','Number','Function'])
*/
_VnlsFrameWork.prototype.checkArgs = function(args, validator) {
var i;
var len;
var html = /^HTML\w*Element$/;
if(!(VNLS.jsType(args) === 'Arguments' || VNLS.jsType(args) === 'Array')){
return false;
}
if(args.length != validator.length){
// Incorrect args length
return false;
}
i = 0;
len = args.length;
for(; i < len; i++){
if(
!(
(VNLS.jsType(args[i]) === validator[i]) ||
(html.test(validator[i]) && html.test(VNLS.jsType(args[i])))
)
){
return false;
}
}
return true;
}
/**
* Method for getting the global objects by name
* optional in an object / namespace
* It may be used to detect posible memory leaks
* in the/a (global) namespace
* @param {Object} ob
* @returns {Array}
*/
_VnlsFrameWork.prototype.getGlobals = function(ob) {
var global_object = false;
var res = [];
var i;
if(typeof ob === 'undefined'){
if(this.getEnv() === 'nodejs'){
global_object = global;
}else{
global_object = window;
}
}
if(VNLS.jsType(ob) === 'Object'){
global_object = ob;
}
if(!global_object){
throw 'Argument is not an object';
}
for(i in global_object){
res.push(i);
}
global_object = false;
return res;
};
/**
* Utility to get a functions actual name
* @param {Function}
*
* @returns {String} an empty string when a name is not found
*/
_VnlsFrameWork.prototype.getFunctionName = function(fn){
var funcNameRegex = /function (.{1,})\(/;
var results = (funcNameRegex).exec(fn.toString());
return (results && results.length > 1) ? results[1] : '';
};
/**
* A better typeof
* [Borrowed from toType]{@link http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/}
*
* @param {Any} fn, any type
*
* VNLS.jsType({a: 4}); //'Object'
* VNLS.jsType([1, 2, 3]); //'Array'
* VNLS.jsType(VNLS.fn.jsType(arguments)); //Arguments
* VNLS.jsType(new ReferenceError); //'Error'
* VNLS.jsType(new Date); //'Date'
* VNLS.jsType(/a-z/); //'RegExp'
* VNLS.jsType(Math); //'Math'
* VNLS.jsType(JSON); //'JSON'
* VNLS.jsType(new Number(4)); //'Number'
* VNLS.jsType(new String('abc')); //'String'
* VNLS.jsType(new Boolean(true)); //'Boolean'
*/
_VnlsFrameWork.prototype.jsType = function(fn) {
if(typeof fn === 'undefined'){
return 'undefined';
}
return ({}).toString.call(fn).match(/\s([a-z|A-Z]+)/)[1];
};
/**
* Get the current environment
* @returns string 'browser' || 'nodejs'
*/
_VnlsFrameWork.prototype.getEnv = function() {
return ENV;
}
return new _VnlsFrameWork();
}
if (VNLS.getEnv() === "nodejs") {
VNLS.addClass("utils", function() {
"use strict";
function EventEmitter() {
return;
}
EventEmitter = require("events").EventEmitter;
return EventEmitter;
});
} else {
VNLS.addClass("utils", function() {
"use strict";
function EventEmitter() {
this._emitter = {
listeners: {},
oncelisteners: {},
counter: 0,
max: 10
};
}
EventEmitter.prototype.addListener = function(type, listener) {
if (this._emitter.counter > this._emitter.max) {
alert("MaxListeners exceeded use: 'setMaxListeners(n)' to raise");
}
if (typeof this._emitter.listeners[type] == "undefined") {
this._emitter.listeners[type] = [];
}
this._emitter.counter++;
this._emitter.listeners[type].push(listener);
this.emit("newListener", listener);
return this;
};
EventEmitter.prototype.on = function(type, listener) {
this.addListener(type, listener);
return this;
};
EventEmitter.prototype.once = function(type, listener) {
if (this._emitter.counter >= this._emitter.max) {
alert("MaxListeners exceeded use: 'setMaxListeners(n)' to raise");
}
if (typeof this._emitter.oncelisteners[type] == "undefined") {
this._emitter.oncelisteners[type] = [];
}
this._emitter.counter++;
this._emitter.oncelisteners[type].push(listener);
this.emit("newListener", listener);
return this;
};
EventEmitter.prototype.emit = function(event) {
var i, len, pass_prams = [], listeners;
if (typeof event == "string") {
event = {
type: event
};
}
if (!event.target) {
event.target = this;
}
if (!event.type) {
throw new Error("Event object missing 'type' property.");
}
if (this._emitter.listeners[event.type] instanceof Array) {
i = 0;
len = arguments.length;
for (; i < len; i++) {
if (i > 0) {
pass_prams.push(arguments[i]);
}
}
listeners = this._emitter.listeners[event.type];
i = 0;
len = listeners.length;
for (; i < len; i++) {
listeners[i].apply(event.target, pass_prams);
}
}
if (this._emitter.oncelisteners[event.type] instanceof Array) {
pass_prams = [];
i = 0;
len = arguments.length;
for (; i < len; i++) {
if (i > 0) {
pass_prams.push(arguments[i]);
}
}
listeners = this._emitter.oncelisteners[event.type];
i = 0;
len = listeners.length;
for (; i < len; i++) {
listeners[i].apply(event.target, pass_prams);
}
this._removeAllOnceListeners(event.type);
}
return this;
};
EventEmitter.prototype.listeners = function(type) {
if (this._emitter.listeners[type] instanceof Array) {
return this._emitter.listeners[type];
}
return [];
};
EventEmitter.prototype.removeListener = function(type, listener) {
var i, len, listeners;
if (this._emitter.listeners[type] instanceof Array) {
listeners = this._emitter.listeners[type];
i = 0;
len = listeners.length;
for (; i < len; i++) {
if (listeners[i] === listener) {
this._emitter.counter--;
listeners.splice(i, 1);
break;
}
}
}
if (this._emitter.oncelisteners[type] instanceof Array) {
listeners = this._emitter.oncelisteners[type];
i = 0;
len = listeners.length;
for (; i < len; i++) {
if (listeners[i] === listener) {
this._emitter.counter--;
listeners.splice(i, 1);
break;
}
}
}
return this;
};
EventEmitter.prototype.removeAllListeners = function(type) {
if (typeof type == "string") {
if (this._emitter.listeners[type] instanceof Array) {
this._emitter.counter -= this._emitter.listeners[type].length;
this._emitter.listeners[type] = undefined;
}
if (this._emitter.oncelisteners[type] instanceof Array) {
this._emitter.counter -= this._emitter.oncelisteners[type].length;
this._emitter.oncelisteners[type] = undefined;
}
} else {
this._emitter.counter = 0;
this._emitter.listeners = {};
this._emitter.oncelisteners = {};
}
return this;
};
EventEmitter.prototype.setMaxListeners = function(n) {
this._emitter.max = n;
return this;
};
EventEmitter.prototype._removeAllOnceListeners = function(type) {
if (typeof type == "string") {
if (this._emitter.oncelisteners[type] instanceof Array) {
this._emitter.counter -= this._emitter.oncelisteners[type].length;
this._emitter.oncelisteners[type] = undefined;
}
}
return this;
};
return EventEmitter;
});
// Make VNLS global in environments
if(VNLS.getEnv() === 'nodejs') {
if(typeof global.VNLS === 'undefined') {
global.VNLS = VNLS;
}
}
VNLS.addClass("utils", function() {
"use strict";
function Promise() {
this.pOptions = {};
}
var emitter = VNLS.getObject("utils", "EventEmitter");
VNLS.inherits(Promise, emitter);
Promise.prototype.__init__ = function() {};
Promise.prototype.Do = function() {
this._promiseReset();
this._checkArguments(arguments);
var self = this;
this.once("prun", function registerPrun() {
self._promiseExecute();
});
return this.thenDo.apply(this, arguments);
if(VNLS.getEnv() === 'nodejs') {
// In A nodejs environment
// we use the standard NodeJs EventEmitter
VNLS.addClass('utils', function() {
'use strict';
function EventEmitter() {
return;
};
Promise.prototype.thenDo = function() {
this._checkArguments(arguments);
this.pOptions.eLevel++;
this._registerPTasks(arguments);
return this;
EventEmitter = require('events').EventEmitter;
return EventEmitter;
});
} else {
// This is the Browser version of the EventEmitter
// 'Reverse engineered'
VNLS.addClass('utils', function() {
'use strict';
function EventEmitter() {
this._emitter = {
listeners: {},
oncelisteners: {},
counter: 0,
max: 10
}
};
Promise.prototype.thenWait = function(ms) {
if (typeof ms !== "number") throw "argument of wrong type";
this.pOptions.eLevel++;
var args = [ "wait:" + ms, function(promise) {
setTimeout(function() {
promise.done();
}, ms);
} ];
this._registerPTasks(args);
return this;
EventEmitter.prototype.addListener = function(type, listener) {
if(this._emitter.counter > this._emitter.max){
alert('MaxListeners exceeded use: setMaxListeners(n) to raise');
}
if(typeof this._emitter.listeners[type] == 'undefined'){
this._emitter.listeners[type] = [];
};
this._emitter.counter++;
this._emitter.listeners[type].push(listener);
this.emit('newListener', listener);
return this;
};
Promise.prototype.orDo = function() {
this._checkArguments(arguments);
this._registerPTasks(arguments);
return this;
EventEmitter.prototype.on = function(type, listener) {
this.addListener(type, listener);
return this;
};
Promise.prototype.whenDone = function(fn) {
this.once("pdone", fn);
return this;
EventEmitter.prototype.once = function(type, listener) {
if(this._emitter.counter >= this._emitter.max) {
alert('MaxListeners exceeded use: setMaxListeners(n) to raise');;
}
if(typeof this._emitter.oncelisteners[type] === 'undefined') {
this._emitter.oncelisteners[type] = [];
};
this._emitter.counter++;
this._emitter.oncelisteners[type].push(listener);
this.emit('newListener', listener);
return this;
};
Promise.prototype.whenException = function(fn) {
this.on("pexception", fn);
return this;
};
Promise.prototype.whenFail = function(fn) {
this.once("pfail", fn);
this.emit("prun", this);
return this;
};
Promise.prototype._checkArguments = function(args) {
var len = args.length;
var i = 0;
var type;
if (len < 1) {
throw "No promises detected";
EventEmitter.prototype.emit = function(event) {
var i;
var len;
var pass_prams = [];
var listeners;
if(typeof event === 'string') {
event = {
type: event
};
}
if(!event.target) {
event.target = this;
}
if(!event.type) { // Falsy
throw new Error('Event object missing type property.');
}
// Fire NORMAL listeners
if(this._emitter.listeners[event.type] instanceof Array) {
i = 0;
len = arguments.length;
for (; i < len; i++) {
if(i > 0) {
pass_prams.push(arguments[i]);
}
}
listeners = this._emitter.listeners[event.type]
i = 0;
len = listeners.length;
for (; i < len; i++) {
type = typeof args[i];
if (i < 2) {
if (!(type === "function" || type === "string" || type === "number")) {
throw "Only to allow functions as arguments in a promise";
}
} else {
if (type !== "function") throw "Only to allow functions as arguments in a promise";
}
listeners[i].apply(event.target, pass_prams);
}
};
Promise.prototype._registerPTasks = function(args) {
var n_args = VNLS.copy(args), self = this, level = this.pOptions.eLevel, description = "", t_val, timeout = -1;
var f_arg = typeof n_args[0];
var s_arg = typeof n_args[1];
if (f_arg === "string" || f_arg === "number") {
t_val = n_args.shift();
if (f_arg === "string") description = t_val;
if (f_arg === "number") timeout = t_val;
};
// Fire ONCE listeners and clear them
if(this._emitter.oncelisteners[event.type] instanceof Array) {
pass_prams = [];
i = 0;
len = arguments.length;
for (; i < len; i++) {
if(i > 0) {
pass_prams.push(arguments[i]);
}
}
if (s_arg === "string" || s_arg === "number") {
t_val = n_args.shift();
if (s_arg === "string" && description !== "") {
description = t_val;
}
if (s_arg === "number" && timeout < 0) {
timeout = t_val;
}
listeners = this._emitter.oncelisteners[event.type];
i = 0;
len = listeners.length;
for (; i < len; i++) {
listeners[i].apply(event.target, pass_prams);
}
if (description === "") {
description = "Level:" + level;
}
if (!this.pOptions._status[level]) {
this.pOptions._status[level] = [];
}
this.pOptions._status[level].push({
fuctions: n_args.length,
timeout: timeout,
description: description,
success: 0,
errors: 0,
done: false,
tasks: n_args
});
// Clear the once listeners
this._removeAllOnceListeners(event.type);
}
return this;
};
Promise.prototype._promiseExecute = function() {
var self = this;
this.pOptions.current_level++;
var current_level = this.pOptions.current_level, level_length = this.pOptions._status.length, ts_check = this.pOptions.ts, self = this, len, block_length, block_index, task_length, task_index, active = function() {
return self.pOptions.ts === ts_check || current_level === this.pOptions.current_level;
};
if (current_level > level_length - 1 || this.pOptions._status.length === 0) {
return;
// Do we need to pass the _once_listeners as well?
EventEmitter.prototype.listeners = function(type) {
if(this._emitter.listeners[type] instanceof Array) {
return this._emitter.listeners[type];
}
return [];
};
EventEmitter.prototype.removeListener = function(type, listener) {
// Remove from normal listeners
var i, len, listeners;
if(this._emitter.listeners[type] instanceof Array) {
listeners = this._emitter.listeners[type];
i = 0;
len = listeners.length;
for (; i < len; i++) {
if(listeners[i] === listener) {
this._emitter.counter--;
listeners.splice(i, 1);
break;
}
}
block_length = this.pOptions._status[current_level].length;
block_index = 0;
for (; block_index < block_length; block_index++) {
if (!active()) {
return;
}
task_length = this.pOptions._status[current_level][block_index].tasks.length;
task_index = 0;
for (; task_index < task_length; task_index++) {
if (!active()) {
return;
}
var light_promise = {
timer: undefined,
ts: this.pOptions.ts,
task_index: task_index,
current_level: current_level,
block_level: block_index,
active: function() {
if (this.ts === self.pOptions.ts) {
return this.current_level >= self.pOptions.current_level;
} else {
return false;
}
},
done: function() {
if (this.active()) {
self._PromiseReport("pdone", this.task_index, this.current_level, this.block_level);
}
this.__destroy();
},
fail: function() {
if (this.active()) {
self._PromiseReport("pfail", this.task_index, this.current_level, this.block_level);
}
this.__destroy();
},
__destroy: function() {
if (this.timer) clearTimeout(this.timer);
var task_index = this.task_index;
var i;
for (i in this) {
delete this[i];
}
this.done = function() {};
this.fail = function() {};
this.active = function() {
return false;
};
},
__setTimeOut: function(to) {
var self = this;
this.timer = setTimeout(function() {
self.fail();
}, to);
}
};
if (this.pOptions._status[current_level][block_index].timeout > 0) {
light_promise.__setTimeOut(this.pOptions._status[current_level][block_index].timeout);
}
if (this.listeners("pexception").length === 0) {
this.pOptions._status[current_level][block_index].tasks[task_index].apply(null, [ light_promise ]);
} else {
try {
this.pOptions._status[current_level][block_index].tasks[task_index].apply(null, [ light_promise ]);
} catch (e) {
this.emit("pexception", e);
light_promise.fail();
}
}
}
}
// Remove from ONCE listeners
if(this._emitter.oncelisteners[type] instanceof Array) {
listeners = this._emitter.oncelisteners[type];
i = 0;
len = listeners.length
for (; i < len; i++) {
if(listeners[i] === listener) {
this._emitter.counter--;
listeners.splice(i, 1);
break;
}
}
}
return this;
};
Promise.prototype._PromiseReport = function(status, fn_index, then_level, or_level) {
if (then_level < this.pOptions.current_level) {
return;
EventEmitter.prototype.removeAllListeners = function(type) {
if(typeof type === 'string') {
if(this._emitter.listeners[type] instanceof Array) {
this._emitter.counter -= this._emitter.listeners[type].length;
this._emitter.listeners[type] = undefined;
}
var status_object = this.pOptions._status[then_level][or_level];
if (status === "pdone") {
status_object.success++;
} else {
status_object.errors++;
if(this._emitter.oncelisteners[type] instanceof Array) {
this._emitter.counter -= this._emitter.oncelisteners[type].length;
this._emitter.oncelisteners[type] = undefined;
}
if (status_object.success === status_object.fuctions) {
if (this.pOptions._status.length - 1 === this.pOptions.current_level) {
this.emit("pdone");
this._promiseReset();
} else {
this._promiseExecute();
}
return;
}
if (status_object.success + status_object.errors == status_object.fuctions) {
status_object.done = true;
this._checkCurrentPLevel();
}
}else{
this._emitter.counter = 0;
this._emitter.listeners = {};
this._emitter.oncelisteners = {};
}
return this;
};
Promise.prototype._checkCurrentPLevel = function() {
if (this.pOptions.current_level > this.pOptions._status.length - 1) {
throw "Execution level out of range";
EventEmitter.prototype.setMaxListeners = function(n) {
this._emitter.max = n;
return this;
};
EventEmitter.prototype._removeAllOnceListeners = function(type) {
if(typeof type === 'string') {
if(this._emitter.oncelisteners[type] instanceof Array) {
this._emitter.counter -= this._emitter.oncelisteners[type].length;
this._emitter.oncelisteners[type] = undefined;
}
var or_length = this.pOptions._status[this.pOptions.current_level].length, then_level = this.pOptions.current_level, or_counter = 0, error_a = [], done_counter = 0;
for (; or_counter < or_length; or_counter++) {
if (this.pOptions._status[then_level][or_counter].done === true) {
error_a.push(this.pOptions._status[then_level][or_counter].description);
done_counter++;
}
}
if (done_counter === or_length) {
this.emit("pfail", {
blocks: error_a
});
this._promiseReset();
}
}
return this;
};
Promise.prototype._promiseReset = function() {
var d = new Date;
this.removeAllListeners("pdone");
this.removeAllListeners("pfail");
this.removeAllListeners("pexception");
this.removeAllListeners("prun");
this.pOptions = {};
this.pOptions.timeout = -1;
this.pOptions.ts = d.getTime();
this.pOptions.eLevel = -1;
this.pOptions.current_level = -1;
this.pOptions._status = [];
};
return Promise;
});
return EventEmitter;
});
};
VNLS.ns("validate.structure", {
checkDoc: function(structure, doc, callback) {
if (!VNLS.checkArgs(arguments, [ "Object", "Object", "Function" ])) {
arguments[arguments.length - 1]("Wrong arguments", null);
VNLS.ns('string', {
// 'A' = 0
// '/' = 63
map64: [
'A', 'B', 'C', 'D', 'E' ,'F' ,'G' ,'H',
'I' ,'J', 'K', 'L', 'M' ,'N', 'O' ,'P',
'Q' ,'R' ,'S', 'T', 'U' ,'V', 'W', 'X',
'Y' ,'Z', 'a', 'b', 'c', 'd', 'e' ,'f',
'g' ,'h', 'i', 'j', 'k', 'l', 'm' ,'n',
'o' ,'p', 'q' ,'r' ,'s', 't', 'u' ,'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/'
],
/**
* Encode a utf-8 string to base64
* @param {String} s
* @returns {String}
*/
enc64: function(s){
s = unescape(encodeURIComponent(s));
if(VNLS.getEnv() === 'nodejs'){
return new Buffer(s, 'binary').toString('base64');
}else if(window && typeof window.btoa !== 'undefined'){
return window.btoa(s);
}else{
throw 'Use a modern browser with window.btoa';
}
},
/**
* Decode a base64 string to a utf-8 string
* @param {String} s
* @returns {String}
*/
dec64: function(s){
if(VNLS.getEnv() === 'nodejs'){
s = new Buffer(s, 'base64').toString('binary');
}else if(window && typeof window.atob !== 'undefined'){
s = window.atob(s);
}else{
throw 'Use a modern browser with window.atob';
}
return decodeURIComponent(escape(s));
},
/**
* Compress a string
*
* @param {String} s
* @param {Function} callback(err, string)
* @returns {Object} self
*/
comp: function(s,cb){
var self = this;
if(!VNLS.checkArgs(arguments, ['String', 'Function'])) {
throw 'Wrong arguments';
}
setTimeout(function compress(){
var res = null;
try{
res = self._deflate(s);
cb(null,res);
}catch(e){
cb(e,null);
}
},1);
return this;
},
/**
* De-Compress a string
* @param {String} s
* @param {Function} callback(err,string)
* @returns {Object} self
*/
decomp: function(s,cb){
var self = this;
if(!VNLS.checkArgs(arguments, ['String', 'Function'])) {
throw 'Wrong arguments';
}
setTimeout(function decompress(){
var res = null;
try{
res = self._inflate(s);
cb(null,res);
}catch(e){
cb(e,null);
}
},1);
return this;
},
/**
* Compress a base 64 encoded string
* by creating a full/optimal 2 byte sequence
* @param {String} s
* @returns {String}
*/
_compB64: function(s){
var re = /=/g;
s = s.replace(re, '');
var len = s.length;
var bits = len * 6;
var remb = (bits % 16) + 4;
if(remb > 16){
remb -= 16;
}
var unused = 16 - remb;
var i = 0;
var out = ''; // UTF-16 string for output
var bits = 16; // Available storage block
var n = 0; // Base64 map value
var rem_value = 0; // Remaining VALUE
var storage = 0; // A full 16 bits value
var rem = 0;
var tmp = 0;
bits -= 4;
storage = unused << bits;
for(;i < len;i++){
n = this.map64.indexOf(s[i]);
if(bits >= 6){
bits -= 6;
storage += n << bits;
if(bits == 0){
out += String.fromCharCode(storage);
bits = 16;
storage = 0;
}
var i = 0, len = structure.required.length, cleanDoc = {};
for (; i < len; i++) {
if (!doc.hasOwnProperty(structure.required[i])) {
callback({
type: "required",
field: structure.required[i]
}, null);
return this;
}
}else{
rem = 6 - bits;
tmp = n >> rem;
out += String.fromCharCode(storage + tmp);
rem_value = n - (tmp << rem);
bits = 16 - rem;
storage = rem_value << bits;
}
if(i == (len - 1) && bits > 0 && bits < 16){
out += String.fromCharCode(storage);
}
}
return out;
},
/**
* Return a decompressed base64 encoded string.
*
* @param {String} s is a sequence utf-16 bits
*/
_deCompB64: function(s){
var len = s.length;
var i = len;
var n;
var out = '';
var bits;
var skipb = 0;
var rem = 0;
var rem_val = null;
for(;i;i--){
n = s.charCodeAt(len - i);
bits = 16;
if(i === len){
// Get the skipb
bits -= 4;
skipb = n >> bits;
n -= skipb << bits;
}
for(;bits;){
if(rem > 0){
bits -= rem;
ret_val = n >> bits;
n -= ret_val << bits;
out += this.map64[ret_val + rem_val];
rem = 0;
}
for (i in structure.validators) {
if (doc.hasOwnProperty(i)) {
if (!this.checkKey(doc[i], structure.validators[i])) {
callback({
type: "value",
field: i
}, null);
return this;
}
}
cleanDoc[i] = doc[i];
if(i === 1 && (bits <= skipb)){
bits = 0;
}else if(bits >= 6){
bits -= 6;
ret_val = n >> bits;
out += this.map64[ret_val];
n -= ret_val << bits;
}else if(bits > 0){
rem = 6 - bits;
rem_val = n << rem;
bits = 0;
}
callback(null, cleanDoc);
return this;
},
checkKey: function(val, validator) {
if (validator instanceof RegExp) {
return validator.test(val);
} else if (typeof validator == "function") {
return validator(val);
}
return false;
}
}
});
return out;
},
VNLS.ns("lang", {
get: function(lang, key, def) {
if (typeof key !== "string") {
throw "Only strings allowd";
}
if (typeof def === "undefined") {
def = key;
}
if (typeof lang === "undefined") {
lang = "en";
}
if (typeof def !== "string") {
throw "Only strings allowd";
}
if (typeof this[lang] === "undefined") {
return def;
} else {
return this[lang][key] || def;
}
},
set: function(lang, ob) {
VNLS.ns("lang." + lang, ob);
/**
* Compressed a string
* @param {String} s UTF-16 xompressed string
*/
_deflate: function(s){
var out = '';
var i;
var len;
var val;
len = s.length;
if(len < 1 || typeof s !== 'string'){
return s;
}
// Ensure 1 byte chars (0 / 254)
s = unescape(encodeURIComponent(s));
if((len % 2) === 1){
// Ad an extra byte for byte allignment
// Odd bytes won't fill a 16 bits slot
s += String.fromCharCode(0);
}
i = 0;
len = s.length;
for(; i < len; i += 2){
val = (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i));
out += String.fromCharCode(val);
}
return out;
},
/**
* Expand a compressed string
* @param {String} s UTF-16
* @returns {String}
*/
_inflate: function(s){
if(s.length < 1 || typeof s !== 'string'){
return s;
}
var n;
var out = '';
var high;
var low;
var i;
var len;
i = 0;
len = s.length;
for(; i < len; i++){
n = s.charCodeAt(i);
high = n >> 8;
low = n - (high << 8);
out += String.fromCharCode(low);
if(i == len - 1 && high == 0){
// Skip byte
}else{
out += String.fromCharCode(high);
}
}
return decodeURIComponent(escape(out));
}
});
VNLS.ns("string", {
map64: [ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/" ],
enc64: function(s) {
s = unescape(encodeURIComponent(s));
if (VNLS.getEnv() === "nodejs") {
return (new Buffer(s, "binary")).toString("base64");
} else if (window && typeof window.btoa !== "undefined") {
return window.btoa(s);
} else {
throw "Use a modern browser with window.btoa";
}
},
dec64: function(s) {
if (VNLS.getEnv() === "nodejs") {
s = (new Buffer(s, "base64")).toString("binary");
} else if (window && typeof window.atob !== "undefined") {
s = window.atob(s);
} else {
throw "Use a modern browser with window.atob";
}
return decodeURIComponent(escape(s));
},
comp: function(s, cb) {
var self = this;
if (!VNLS.checkArgs(arguments, [ "String", "Function" ])) {
throw "Wrong arguments";
}
setTimeout(function compress() {
var res = null;
try {
res = self._deflate(s);
cb(null, res);
} catch (e) {
cb(e, null);
}
}, 1);
return this;
},
decomp: function(s, cb) {
var self = this;
if (!VNLS.checkArgs(arguments, [ "String", "Function" ])) {
throw "Wrong arguments";
}
setTimeout(function decompress() {
var res = null;
try {
res = self._inflate(s);
cb(null, res);
} catch (e) {
cb(e, null);
}
}, 1);
return this;
},
_compB64: function(s) {
var re = /=/g;
s = s.replace(re, "");
var len = s.length;
var bits = len * 6;
var remb = bits % 16 + 4;
if (remb > 16) {
remb -= 16;
}
var unused = 16 - remb;
var i = 0;
var out = "";
var bits = 16;
var n = 0;
var rem_value = 0;
var storage = 0;
var rem = 0;
var tmp = 0;
bits -= 4;
storage = unused << bits;
for (; i < len; i++) {
n = this.map64.indexOf(s[i]);
if (bits >= 6) {
bits -= 6;
storage += n << bits;
if (bits == 0) {
out += String.fromCharCode(storage);
bits = 16;
storage = 0;
}
} else {
rem = 6 - bits;
tmp = n >> rem;
out += String.fromCharCode(storage + tmp);
rem_value = n - (tmp << rem);
bits = 16 - rem;
storage = rem_value << bits;
}
if (i == len - 1 && bits > 0 && bits < 16) {
out += String.fromCharCode(storage);
}
}
return out;
},
_deCompB64: function(s) {
var len = s.length;
var i = len;
var n, out = "", bits;
var skipb = 0;
var rem = 0;
var rem_val = null;
for (; i; i--) {
n = s.charCodeAt(len - i);
bits = 16;
if (i === len) {
bits -= 4;
skipb = n >> bits;
n -= skipb << bits;
}
for (; bits; ) {
if (rem > 0) {
bits -= rem;
ret_val = n >> bits;
n -= ret_val << bits;
out += this.map64[ret_val + rem_val];
rem = 0;
}
if (i === 1 && bits <= skipb) {
bits = 0;
} else if (bits >= 6) {
bits -= 6;
ret_val = n >> bits;
out += this.map64[ret_val];
n -= ret_val << bits;
} else if (bits > 0) {
rem = 6 - bits;
rem_val = n << rem;
bits = 0;
}
}
}
return out;
},
_deflate: function(s) {
var out = "", i, len, val;
len = s.length;
if (len < 1 || typeof s !== "string") {
return s;
}
s = unescape(encodeURIComponent(s));
if (len % 2 === 1) {
s += String.fromCharCode(0);
}
i = 0;
len = s.length;
for (; i < len; i += 2) {
val = (s.charCodeAt(i + 1) << 8) + s.charCodeAt(i);
out += String.fromCharCode(val);
}
return out;
},
_inflate: function(s) {
if (s.length < 1 || typeof s !== "string") {
return s;
}
var n, out = "", high, low, i, len;
i = 0;
len = s.length;
for (; i < len; i++) {
n = s.charCodeAt(i);
high = n >> 8;
low = n - (high << 8);
out += String.fromCharCode(low);
if (i == len - 1 && high == 0) {} else {
out += String.fromCharCode(high);
}
}
return decodeURIComponent(escape(out));
}
});

@@ -1,1 +0,1 @@

String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Array.prototype.indexOf||(Array.prototype.indexOf=function(searchElement){"use strict";if(this==null)throw new TypeError;var t=Object(this),len=t.length>>>0;if(len===0)return-1;var n=0;arguments.length>1&&(n=Number(arguments[1]),n!=n?n=0:n!=0&&n!=Infinity&&n!=-Infinity&&(n=(n>0||-1)*Math.floor(Math.abs(n))));if(n>=len)return-1;var k=n>=0?n:Math.max(len-Math.abs(n),0);for(;k<len;k++)if(k in t&&t[k]===searchElement)return k;return-1});var VNLS=new function(){"use strict";var CLASSES="_classes_",VERSION="master",INIT="__init__",ENV="";function _VnlsFrameWork(){typeof window!="undefined"&&typeof window.location!="undefined"?ENV="browser":typeof require=="function"&&process&&(ENV="nodejs"),this._namespace="VNLS"}return _VnlsFrameWork.prototype.version=function(){return VERSION},_VnlsFrameWork.prototype.inherits=function(fn,ob,strict){typeof strict=="undefined"&&(strict=!0);var fn_prototype={};for(var key in fn.prototype)fn_prototype[key]=fn.prototype[key];fn.prototype=this.copy(ob);for(var key in fn_prototype){if(fn.prototype.hasOwnProperty(key)&&strict&&key!==INIT)throw"inherits() overwrites: "+key;fn.prototype[key]=fn_prototype[key]}return fn.prototype.constructor=fn,fn},_VnlsFrameWork.prototype.copy=function(obj){var type=VNLS.jsType(obj);if(type==="Array"||type==="Arguments"){var out=[],i=0,len=obj.length;for(;i<len;i++)out[i]=this.copy(obj[i]);return out}if(type==="Object"){var out={},i;for(i in obj)out[i]=this.copy(obj[i]);return out}return obj},_VnlsFrameWork.prototype.addClass=function(ns,fn){ns===""?ns=CLASSES:ns=CLASSES+"."+ns,ns=VNLS.ns(ns,{});var function_name=this.getFunctionName(fn());if(typeof fn()!="function")throw"Class definition needs to be a function "+class_name;if(function_name==="")throw"Class-name could not be determined, check your syntax.";if(ns.hasOwnProperty(function_name))throw"Class already registered: "+function_name;return ns[function_name]=fn(),this},_VnlsFrameWork.prototype.getObject=function(ns,class_name){ns===""?ns=CLASSES:ns=CLASSES+"."+ns,ns=VNLS.ns(ns);var pass_prams=[];for(var i=0,len=arguments.length;i<len;i++)i>1&&pass_prams.push(arguments[i]);if(ns.hasOwnProperty(class_name)){var ob=new ns[class_name];return typeof ob[INIT]=="function"&&ob[INIT].apply(ob,pass_prams),ob}throw"Object not found:"+class_name},_VnlsFrameWork.prototype.ns=function(ns,ob,strict){var item,ns_path=[],i,len,current_ns;typeof strict=="undefined"&&(strict=!0),typeof ns=="undefined"&&(ns="");if(typeof ns!="string")throw"namespace should be a string";if(/(\.\.|^\.|^[0-9]|\.$|[^a-z0-9_\.])/.test(ns))throw"invalid namespace [a-z0-9_]";if(typeof ob!="object"&&typeof ob!="undefined")throw"argument 2 is not an object";ns_path=!1,current_ns=VNLS,ns!==""&&(ns_path=ns.split(".")),i=0,len=ns_path.length;if(ns_path)for(;i<len;i++){if(typeof current_ns[ns_path[i]]=="undefined"&&typeof ob=="object")current_ns[ns_path[i]]={},current_ns[ns_path[i]]._namespace=ns_path.slice(0,i+1).join(".");else if(VNLS.jsType(current_ns[ns_path[i]])!=="Object")throw"Could not get this namespace";current_ns=current_ns[ns_path[i]]}if(typeof ob=="undefined")return current_ns;for(item in ob){if(strict&&typeof current_ns[item]!="undefined")throw"Extending not possible, strict is true";current_ns[item]=ob[item]}return current_ns},_VnlsFrameWork.prototype.nsInfo=function(ns){var res=[],iface,a,tmp,i,len;if(VNLS.jsType(ns)!=="String"&&VNLS.jsType(ns)!=="undefined")return res;try{iface=VNLS.ns(ns)}catch(e){return res}ns?ns="VNLS."+ns:ns="VNLS";for(a in iface)if(VNLS.jsType(iface[a])==="Object"&&!/^_\w+/.test(a)&&iface[a].hasOwnProperty("_namespace")){tmp=VNLS.nsInfo(iface[a]._namespace),i=0,len=tmp.length;for(;i<len;i++)res.push(tmp[i])}else VNLS.jsType(iface[a])==="Function"&&!/^_\w+/.test(a)&&res.push(ns+"."+a);return res},_VnlsFrameWork.prototype.checkArgs=function(args,validator){var i,len,html=/^HTML\w*Element$/;if(VNLS.jsType(args)!=="Arguments"&&VNLS.jsType(args)!=="Array")return!1;if(args.length!=validator.length)return!1;i=0,len=args.length;for(;i<len;i++)if(!(VNLS.jsType(args[i])===validator[i]||html.test(validator[i])&&html.test(VNLS.jsType(args[i]))))return!1;return!0},_VnlsFrameWork.prototype.getGlobals=function(ob){var global_object=!1,res=[],i;typeof ob=="undefined"&&(this.getEnv()==="nodejs"?global_object=global:global_object=window),VNLS.jsType(ob)==="Object"&&(global_object=ob);if(!global_object)throw"Argument is not an object";for(i in global_object)res.push(i);return global_object=!1,res},_VnlsFrameWork.prototype.getFunctionName=function(fn){var funcNameRegex=/function (.{1,})\(/,results=funcNameRegex.exec(fn.toString());return results&&results.length>1?results[1]:""},_VnlsFrameWork.prototype.jsType=function(fn){return typeof fn=="undefined"?"undefined":{}.toString.call(fn).match(/\s([a-z|A-Z]+)/)[1]},_VnlsFrameWork.prototype.getEnv=function(){return ENV},new _VnlsFrameWork};VNLS.getEnv()==="nodejs"&&typeof global.VNLS=="undefined"&&(global.VNLS=VNLS),VNLS.getEnv()==="nodejs"?VNLS.addClass("utils",function(){"use strict";function EventEmitter(){return}return EventEmitter=require("events").EventEmitter,EventEmitter}):VNLS.addClass("utils",function(){"use strict";function EventEmitter(){this._emitter={listeners:{},oncelisteners:{},counter:0,max:10}}return EventEmitter.prototype.addListener=function(type,listener){return this._emitter.counter>this._emitter.max&&alert("MaxListeners exceeded use: 'setMaxListeners(n)' to raise"),typeof this._emitter.listeners[type]=="undefined"&&(this._emitter.listeners[type]=[]),this._emitter.counter++,this._emitter.listeners[type].push(listener),this.emit("newListener",listener),this},EventEmitter.prototype.on=function(type,listener){return this.addListener(type,listener),this},EventEmitter.prototype.once=function(type,listener){return this._emitter.counter>=this._emitter.max&&alert("MaxListeners exceeded use: 'setMaxListeners(n)' to raise"),typeof this._emitter.oncelisteners[type]=="undefined"&&(this._emitter.oncelisteners[type]=[]),this._emitter.counter++,this._emitter.oncelisteners[type].push(listener),this.emit("newListener",listener),this},EventEmitter.prototype.emit=function(event){var i,len,pass_prams=[],listeners;typeof event=="string"&&(event={type:event}),event.target||(event.target=this);if(!event.type)throw new Error("Event object missing 'type' property.");if(this._emitter.listeners[event.type]instanceof Array){i=0,len=arguments.length;for(;i<len;i++)i>0&&pass_prams.push(arguments[i]);listeners=this._emitter.listeners[event.type],i=0,len=listeners.length;for(;i<len;i++)listeners[i].apply(event.target,pass_prams)}if(this._emitter.oncelisteners[event.type]instanceof Array){pass_prams=[],i=0,len=arguments.length;for(;i<len;i++)i>0&&pass_prams.push(arguments[i]);listeners=this._emitter.oncelisteners[event.type],i=0,len=listeners.length;for(;i<len;i++)listeners[i].apply(event.target,pass_prams);this._removeAllOnceListeners(event.type)}return this},EventEmitter.prototype.listeners=function(type){return this._emitter.listeners[type]instanceof Array?this._emitter.listeners[type]:[]},EventEmitter.prototype.removeListener=function(type,listener){var i,len,listeners;if(this._emitter.listeners[type]instanceof Array){listeners=this._emitter.listeners[type],i=0,len=listeners.length;for(;i<len;i++)if(listeners[i]===listener){this._emitter.counter--,listeners.splice(i,1);break}}if(this._emitter.oncelisteners[type]instanceof Array){listeners=this._emitter.oncelisteners[type],i=0,len=listeners.length;for(;i<len;i++)if(listeners[i]===listener){this._emitter.counter--,listeners.splice(i,1);break}}return this},EventEmitter.prototype.removeAllListeners=function(type){return typeof type=="string"?(this._emitter.listeners[type]instanceof Array&&(this._emitter.counter-=this._emitter.listeners[type].length,this._emitter.listeners[type]=undefined),this._emitter.oncelisteners[type]instanceof Array&&(this._emitter.counter-=this._emitter.oncelisteners[type].length,this._emitter.oncelisteners[type]=undefined)):(this._emitter.counter=0,this._emitter.listeners={},this._emitter.oncelisteners={}),this},EventEmitter.prototype.setMaxListeners=function(n){return this._emitter.max=n,this},EventEmitter.prototype._removeAllOnceListeners=function(type){return typeof type=="string"&&this._emitter.oncelisteners[type]instanceof Array&&(this._emitter.counter-=this._emitter.oncelisteners[type].length,this._emitter.oncelisteners[type]=undefined),this},EventEmitter}),VNLS.addClass("utils",function(){"use strict";function Promise(){this.pOptions={}}var emitter=VNLS.getObject("utils","EventEmitter");return VNLS.inherits(Promise,emitter),Promise.prototype.__init__=function(){},Promise.prototype.Do=function(){this._promiseReset(),this._checkArguments(arguments);var self=this;return this.once("prun",function registerPrun(){self._promiseExecute()}),this.thenDo.apply(this,arguments)},Promise.prototype.thenDo=function(){return this._checkArguments(arguments),this.pOptions.eLevel++,this._registerPTasks(arguments),this},Promise.prototype.thenWait=function(ms){if(typeof ms!="number")throw"argument of wrong type";this.pOptions.eLevel++;var args=["wait:"+ms,function(promise){setTimeout(function(){promise.done()},ms)}];return this._registerPTasks(args),this},Promise.prototype.orDo=function(){return this._checkArguments(arguments),this._registerPTasks(arguments),this},Promise.prototype.whenDone=function(fn){return this.once("pdone",fn),this},Promise.prototype.whenException=function(fn){return this.on("pexception",fn),this},Promise.prototype.whenFail=function(fn){return this.once("pfail",fn),this.emit("prun",this),this},Promise.prototype._checkArguments=function(args){var len=args.length,i=0,type;if(len<1)throw"No promises detected";for(;i<len;i++){type=typeof args[i];if(i<2){if(type!=="function"&&type!=="string"&&type!=="number")throw"Only to allow functions as arguments in a promise"}else if(type!=="function")throw"Only to allow functions as arguments in a promise"}},Promise.prototype._registerPTasks=function(args){var n_args=VNLS.copy(args),self=this,level=this.pOptions.eLevel,description="",t_val,timeout=-1,f_arg=typeof n_args[0],s_arg=typeof n_args[1];if(f_arg==="string"||f_arg==="number")t_val=n_args.shift(),f_arg==="string"&&(description=t_val),f_arg==="number"&&(timeout=t_val);if(s_arg==="string"||s_arg==="number")t_val=n_args.shift(),s_arg==="string"&&description!==""&&(description=t_val),s_arg==="number"&&timeout<0&&(timeout=t_val);description===""&&(description="Level:"+level),this.pOptions._status[level]||(this.pOptions._status[level]=[]),this.pOptions._status[level].push({fuctions:n_args.length,timeout:timeout,description:description,success:0,errors:0,done:!1,tasks:n_args})},Promise.prototype._promiseExecute=function(){var self=this;this.pOptions.current_level++;var current_level=this.pOptions.current_level,level_length=this.pOptions._status.length,ts_check=this.pOptions.ts,self=this,len,block_length,block_index,task_length,task_index,active=function(){return self.pOptions.ts===ts_check||current_level===this.pOptions.current_level};if(current_level>level_length-1||this.pOptions._status.length===0)return;block_length=this.pOptions._status[current_level].length,block_index=0;for(;block_index<block_length;block_index++){if(!active())return;task_length=this.pOptions._status[current_level][block_index].tasks.length,task_index=0;for(;task_index<task_length;task_index++){if(!active())return;var light_promise={timer:undefined,ts:this.pOptions.ts,task_index:task_index,current_level:current_level,block_level:block_index,active:function(){return this.ts===self.pOptions.ts?this.current_level>=self.pOptions.current_level:!1},done:function(){this.active()&&self._PromiseReport("pdone",this.task_index,this.current_level,this.block_level),this.__destroy()},fail:function(){this.active()&&self._PromiseReport("pfail",this.task_index,this.current_level,this.block_level),this.__destroy()},__destroy:function(){this.timer&&clearTimeout(this.timer);var task_index=this.task_index,i;for(i in this)delete this[i];this.done=function(){},this.fail=function(){},this.active=function(){return!1}},__setTimeOut:function(to){var self=this;this.timer=setTimeout(function(){self.fail()},to)}};this.pOptions._status[current_level][block_index].timeout>0&&light_promise.__setTimeOut(this.pOptions._status[current_level][block_index].timeout);if(this.listeners("pexception").length===0)this.pOptions._status[current_level][block_index].tasks[task_index].apply(null,[light_promise]);else try{this.pOptions._status[current_level][block_index].tasks[task_index].apply(null,[light_promise])}catch(e){this.emit("pexception",e),light_promise.fail()}}}},Promise.prototype._PromiseReport=function(status,fn_index,then_level,or_level){if(then_level<this.pOptions.current_level)return;var status_object=this.pOptions._status[then_level][or_level];status==="pdone"?status_object.success++:status_object.errors++;if(status_object.success===status_object.fuctions){this.pOptions._status.length-1===this.pOptions.current_level?(this.emit("pdone"),this._promiseReset()):this._promiseExecute();return}status_object.success+status_object.errors==status_object.fuctions&&(status_object.done=!0,this._checkCurrentPLevel())},Promise.prototype._checkCurrentPLevel=function(){if(this.pOptions.current_level>this.pOptions._status.length-1)throw"Execution level out of range";var or_length=this.pOptions._status[this.pOptions.current_level].length,then_level=this.pOptions.current_level,or_counter=0,error_a=[],done_counter=0;for(;or_counter<or_length;or_counter++)this.pOptions._status[then_level][or_counter].done===!0&&(error_a.push(this.pOptions._status[then_level][or_counter].description),done_counter++);done_counter===or_length&&(this.emit("pfail",{blocks:error_a}),this._promiseReset())},Promise.prototype._promiseReset=function(){var d=new Date;this.removeAllListeners("pdone"),this.removeAllListeners("pfail"),this.removeAllListeners("pexception"),this.removeAllListeners("prun"),this.pOptions={},this.pOptions.timeout=-1,this.pOptions.ts=d.getTime(),this.pOptions.eLevel=-1,this.pOptions.current_level=-1,this.pOptions._status=[]},Promise}),VNLS.ns("validate.structure",{checkDoc:function(structure,doc,callback){VNLS.checkArgs(arguments,["Object","Object","Function"])||arguments[arguments.length-1]("Wrong arguments",null);var i=0,len=structure.required.length,cleanDoc={};for(;i<len;i++)if(!doc.hasOwnProperty(structure.required[i]))return callback({type:"required",field:structure.required[i]},null),this;for(i in structure.validators){if(doc.hasOwnProperty(i)&&!this.checkKey(doc[i],structure.validators[i]))return callback({type:"value",field:i},null),this;cleanDoc[i]=doc[i]}return callback(null,cleanDoc),this},checkKey:function(val,validator){return validator instanceof RegExp?validator.test(val):typeof validator=="function"?validator(val):!1}}),VNLS.ns("lang",{get:function(lang,key,def){if(typeof key!="string")throw"Only strings allowd";typeof def=="undefined"&&(def=key),typeof lang=="undefined"&&(lang="en");if(typeof def!="string")throw"Only strings allowd";return typeof this[lang]=="undefined"?def:this[lang][key]||def},set:function(lang,ob){VNLS.ns("lang."+lang,ob)}})
var VNLS=new function(){"use strict";var CLASSES="_classes_",VERSION="UNDETERMINED",INIT="__init__",ENV="";function _VnlsFrameWork(){typeof window!="undefined"&&typeof window.location!="undefined"?ENV="browser":typeof require=="function"&&process&&(ENV="nodejs"),this._namespace="VNLS"}return _VnlsFrameWork.prototype.version=function(){return VERSION},_VnlsFrameWork.prototype.inherits=function(fn,ob,strict){typeof strict=="undefined"&&(strict=!0);var fn_prototype={};for(var key in fn.prototype)fn_prototype[key]=fn.prototype[key];fn.prototype=this.copy(ob);for(var key in fn_prototype){if(fn.prototype.hasOwnProperty(key)&&strict&&key!==INIT)throw"inherits() overwrites: "+key;fn.prototype[key]=fn_prototype[key]}return fn.prototype.constructor=fn,fn},_VnlsFrameWork.prototype.copy=function(obj){var type=VNLS.jsType(obj),out,i,len=0;if(type==="Array"||type==="Arguments"){out=[],i=0,len=obj.length;for(;i<len;i++)out[i]=this.copy(obj[i]);return out}if(type==="Object"){out={};for(i in obj)out[i]=this.copy(obj[i]);return out}return obj},_VnlsFrameWork.prototype.addClass=function(ns,fn){ns===""?ns=CLASSES:ns=CLASSES+"."+ns,ns=VNLS.ns(ns,{});var function_name=this.getFunctionName(fn());if(typeof fn()!="function")throw"Class definition needs to be a function "+class_name;if(function_name==="")throw"Class-name could not be determined, check your syntax.";if(ns.hasOwnProperty(function_name))throw"Class already registered: "+function_name;return ns[function_name]=fn(),this},_VnlsFrameWork.prototype.getObject=function(ns,class_name){ns===""?ns=CLASSES:ns=CLASSES+"."+ns,ns=VNLS.ns(ns);var pass_prams=[];for(var i=0,len=arguments.length;i<len;i++)i>1&&pass_prams.push(arguments[i]);if(ns.hasOwnProperty(class_name)){var ob=new ns[class_name];return typeof ob[INIT]=="function"&&ob[INIT].apply(ob,pass_prams),ob}throw"Object not found:"+class_name},_VnlsFrameWork.prototype.ns=function(ns,ob,strict){var item,ns_path=[],i,len,current_ns;typeof strict=="undefined"&&(strict=!0),typeof ns=="undefined"&&(ns="");if(typeof ns!="string")throw"namespace should be a string";if(/(\.\.|^\.|^[0-9]|\.$|[^a-z0-9_\.])/.test(ns))throw"invalid namespace [a-z0-9_]";if(typeof ob!="object"&&typeof ob!="undefined")throw"argument 2 is not an object";ns_path=!1,current_ns=VNLS,ns!==""&&(ns_path=ns.split(".")),i=0,len=ns_path.length;if(ns_path)for(;i<len;i++){if(typeof current_ns[ns_path[i]]=="undefined"&&typeof ob=="object")current_ns[ns_path[i]]={},current_ns[ns_path[i]]._namespace=ns_path.slice(0,i+1).join(".");else if(VNLS.jsType(current_ns[ns_path[i]])!=="Object")throw"Could not get this namespace";current_ns=current_ns[ns_path[i]]}if(typeof ob=="undefined")return current_ns;for(item in ob){if(strict&&typeof current_ns[item]!="undefined")throw"Extending not possible, strict is true";current_ns[item]=ob[item]}return current_ns},_VnlsFrameWork.prototype.nsInfo=function(ns){var res=[],iface,a,tmp,i,len;if(VNLS.jsType(ns)!=="String"&&VNLS.jsType(ns)!=="undefined")return res;try{iface=VNLS.ns(ns)}catch(e){return res}ns?ns="VNLS."+ns:ns="VNLS";for(a in iface)if(VNLS.jsType(iface[a])==="Object"&&!/^_\w+/.test(a)&&iface[a].hasOwnProperty("_namespace")){tmp=VNLS.nsInfo(iface[a]._namespace),i=0,len=tmp.length;for(;i<len;i++)res.push(tmp[i])}else VNLS.jsType(iface[a])==="Function"&&!/^_\w+/.test(a)&&res.push(ns+"."+a);return res},_VnlsFrameWork.prototype.checkArgs=function(args,validator){var i,len,html=/^HTML\w*Element$/;if(VNLS.jsType(args)!=="Arguments"&&VNLS.jsType(args)!=="Array")return!1;if(args.length!=validator.length)return!1;i=0,len=args.length;for(;i<len;i++)if(!(VNLS.jsType(args[i])===validator[i]||html.test(validator[i])&&html.test(VNLS.jsType(args[i]))))return!1;return!0},_VnlsFrameWork.prototype.getGlobals=function(ob){var global_object=!1,res=[],i;typeof ob=="undefined"&&(this.getEnv()==="nodejs"?global_object=global:global_object=window),VNLS.jsType(ob)==="Object"&&(global_object=ob);if(!global_object)throw"Argument is not an object";for(i in global_object)res.push(i);return global_object=!1,res},_VnlsFrameWork.prototype.getFunctionName=function(fn){var funcNameRegex=/function (.{1,})\(/,results=funcNameRegex.exec(fn.toString());return results&&results.length>1?results[1]:""},_VnlsFrameWork.prototype.jsType=function(fn){return typeof fn=="undefined"?"undefined":{}.toString.call(fn).match(/\s([a-z|A-Z]+)/)[1]},_VnlsFrameWork.prototype.getEnv=function(){return ENV},new _VnlsFrameWork};VNLS.getEnv()==="nodejs"&&typeof global.VNLS=="undefined"&&(global.VNLS=VNLS),VNLS.getEnv()==="nodejs"?VNLS.addClass("utils",function(){"use strict";function EventEmitter(){return}return EventEmitter=require("events").EventEmitter,EventEmitter}):VNLS.addClass("utils",function(){"use strict";function EventEmitter(){this._emitter={listeners:{},oncelisteners:{},counter:0,max:10}}return EventEmitter.prototype.addListener=function(type,listener){return this._emitter.counter>this._emitter.max&&alert("MaxListeners exceeded use: setMaxListeners(n) to raise"),typeof this._emitter.listeners[type]=="undefined"&&(this._emitter.listeners[type]=[]),this._emitter.counter++,this._emitter.listeners[type].push(listener),this.emit("newListener",listener),this},EventEmitter.prototype.on=function(type,listener){return this.addListener(type,listener),this},EventEmitter.prototype.once=function(type,listener){return this._emitter.counter>=this._emitter.max&&alert("MaxListeners exceeded use: setMaxListeners(n) to raise"),typeof this._emitter.oncelisteners[type]=="undefined"&&(this._emitter.oncelisteners[type]=[]),this._emitter.counter++,this._emitter.oncelisteners[type].push(listener),this.emit("newListener",listener),this},EventEmitter.prototype.emit=function(event){var i,len,pass_prams=[],listeners;typeof event=="string"&&(event={type:event}),event.target||(event.target=this);if(!event.type)throw new Error("Event object missing type property.");if(this._emitter.listeners[event.type]instanceof Array){i=0,len=arguments.length;for(;i<len;i++)i>0&&pass_prams.push(arguments[i]);listeners=this._emitter.listeners[event.type],i=0,len=listeners.length;for(;i<len;i++)listeners[i].apply(event.target,pass_prams)}if(this._emitter.oncelisteners[event.type]instanceof Array){pass_prams=[],i=0,len=arguments.length;for(;i<len;i++)i>0&&pass_prams.push(arguments[i]);listeners=this._emitter.oncelisteners[event.type],i=0,len=listeners.length;for(;i<len;i++)listeners[i].apply(event.target,pass_prams);this._removeAllOnceListeners(event.type)}return this},EventEmitter.prototype.listeners=function(type){return this._emitter.listeners[type]instanceof Array?this._emitter.listeners[type]:[]},EventEmitter.prototype.removeListener=function(type,listener){var i,len,listeners;if(this._emitter.listeners[type]instanceof Array){listeners=this._emitter.listeners[type],i=0,len=listeners.length;for(;i<len;i++)if(listeners[i]===listener){this._emitter.counter--,listeners.splice(i,1);break}}if(this._emitter.oncelisteners[type]instanceof Array){listeners=this._emitter.oncelisteners[type],i=0,len=listeners.length;for(;i<len;i++)if(listeners[i]===listener){this._emitter.counter--,listeners.splice(i,1);break}}return this},EventEmitter.prototype.removeAllListeners=function(type){return typeof type=="string"?(this._emitter.listeners[type]instanceof Array&&(this._emitter.counter-=this._emitter.listeners[type].length,this._emitter.listeners[type]=undefined),this._emitter.oncelisteners[type]instanceof Array&&(this._emitter.counter-=this._emitter.oncelisteners[type].length,this._emitter.oncelisteners[type]=undefined)):(this._emitter.counter=0,this._emitter.listeners={},this._emitter.oncelisteners={}),this},EventEmitter.prototype.setMaxListeners=function(n){return this._emitter.max=n,this},EventEmitter.prototype._removeAllOnceListeners=function(type){return typeof type=="string"&&this._emitter.oncelisteners[type]instanceof Array&&(this._emitter.counter-=this._emitter.oncelisteners[type].length,this._emitter.oncelisteners[type]=undefined),this},EventEmitter}),VNLS.ns("string",{map64:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],enc64:function(s){s=unescape(encodeURIComponent(s));if(VNLS.getEnv()==="nodejs")return(new Buffer(s,"binary")).toString("base64");if(window&&typeof window.btoa!="undefined")return window.btoa(s);throw"Use a modern browser with window.btoa"},dec64:function(s){if(VNLS.getEnv()==="nodejs")s=(new Buffer(s,"base64")).toString("binary");else{if(!window||typeof window.atob=="undefined")throw"Use a modern browser with window.atob";s=window.atob(s)}return decodeURIComponent(escape(s))},comp:function(s,cb){var self=this;if(!VNLS.checkArgs(arguments,["String","Function"]))throw"Wrong arguments";return setTimeout(function compress(){var res=null;try{res=self._deflate(s),cb(null,res)}catch(e){cb(e,null)}},1),this},decomp:function(s,cb){var self=this;if(!VNLS.checkArgs(arguments,["String","Function"]))throw"Wrong arguments";return setTimeout(function decompress(){var res=null;try{res=self._inflate(s),cb(null,res)}catch(e){cb(e,null)}},1),this},_compB64:function(s){var re=/=/g;s=s.replace(re,"");var len=s.length,bits=len*6,remb=bits%16+4;remb>16&&(remb-=16);var unused=16-remb,i=0,out="",bits=16,n=0,rem_value=0,storage=0,rem=0,tmp=0;bits-=4,storage=unused<<bits;for(;i<len;i++)n=this.map64.indexOf(s[i]),bits>=6?(bits-=6,storage+=n<<bits,bits==0&&(out+=String.fromCharCode(storage),bits=16,storage=0)):(rem=6-bits,tmp=n>>rem,out+=String.fromCharCode(storage+tmp),rem_value=n-(tmp<<rem),bits=16-rem,storage=rem_value<<bits),i==len-1&&bits>0&&bits<16&&(out+=String.fromCharCode(storage));return out},_deCompB64:function(s){var len=s.length,i=len,n,out="",bits,skipb=0,rem=0,rem_val=null;for(;i;i--){n=s.charCodeAt(len-i),bits=16,i===len&&(bits-=4,skipb=n>>bits,n-=skipb<<bits);for(;bits;)rem>0&&(bits-=rem,ret_val=n>>bits,n-=ret_val<<bits,out+=this.map64[ret_val+rem_val],rem=0),i===1&&bits<=skipb?bits=0:bits>=6?(bits-=6,ret_val=n>>bits,out+=this.map64[ret_val],n-=ret_val<<bits):bits>0&&(rem=6-bits,rem_val=n<<rem,bits=0)}return out},_deflate:function(s){var out="",i,len,val;len=s.length;if(len<1||typeof s!="string")return s;s=unescape(encodeURIComponent(s)),len%2===1&&(s+=String.fromCharCode(0)),i=0,len=s.length;for(;i<len;i+=2)val=(s.charCodeAt(i+1)<<8)+s.charCodeAt(i),out+=String.fromCharCode(val);return out},_inflate:function(s){if(s.length<1||typeof s!="string")return s;var n,out="",high,low,i,len;i=0,len=s.length;for(;i<len;i++){n=s.charCodeAt(i),high=n>>8,low=n-(high<<8),out+=String.fromCharCode(low);if(i!=len-1||high!=0)out+=String.fromCharCode(high)}return decodeURIComponent(escape(out))}})

@@ -5,4 +5,4 @@ {

"description": "Small javascript framework",
"version": "0.1.0",
"homepage": "https://github.com/venalis/VNLS",
"version": "0.2.0",
"homepage": "https://github.com/jorritd/vnls",
"author": "Jorrit Duin <jorrit.duin@gmail.com> ",

@@ -12,3 +12,3 @@ "keywords": [

"browser",
"promise"
"server"
],

@@ -21,3 +21,3 @@ "directories" : {

"type": "git",
"url": "git://github.com/venalis/VNLS.git"
"url": "git://github.com/jorritd/vnls.git"
},

@@ -27,8 +27,7 @@ "main": "lib/vnls.js",

"bugs": {
"url": "https://github.com/venalis/VNLS/issues"
"url": "https://github.com/jorritd/vnls/issues"
},
"devDependencies": {
"jake":"0.2.15",
"docco":"0.3.0",
"jasmine-node":"1.0.20",
"jasmine-node":"1.14.2",
"nodewatch":"0.1.0",

@@ -35,0 +34,0 @@ "uglify-js":"1.2.5"

@@ -22,7 +22,7 @@ ## VNLS

#### Nodejs:
On node nodejs `npm install VNLS`
On node nodejs `npm install vnls`
Then, somewhere at the top of your code
require('VNLS');
require('vnls');

@@ -29,0 +29,0 @@ There is no need to bind it to a var because var VNLS is made global to the nodejs process

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