Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
VNLS is small javascript framework. It's purpose is to provide boundaries to the very flexible Javascript language and provides a way to write code in a consistent and uniform manner that can be used on the server, Nodejs AND in the browser.
And don't we all like to 'Write once and use many'? Consider this framework as an experiment in multi-platform coding.
On node nodejs npm install vnls
Then, somewhere at the top of your code
require('vnls');
There is no need to bind it to a var because var VNLS is made global to the nodejs process so it's behavior is exactly like in a browser environment. All-though this IS a kind of pollution on nodejs.
In a browser (you may also download the file first):
<script type="text/javascript" src="https://raw.githubusercontent.com/jorritd/vnls/master/lib/vnls.min.js"></script>
A class is an object definition but never used directly.
We are going to write a class in the 'test' namespace.
The __init__
method is called upon creation.
VNLS.addClass('test',function(){
function MyClass() {
};
MyClass.prototype.__init__ = function(str){
this.text = str;
}
MyClass.prototype.getText = function(){
return this.text
}
return MyClass;
});
We 'r going to use the previous class twice:
the method getObject
must have least 2 arguments.
__init__
method)To create an object:
var my_class_1 = VNLS.getObject('test',"MyClass","foo");
var my_class_2 = VNLS.getObject('test',"MyClass","bar");
console.log(my_class_1.getText());
console.log(my_class_2.getText());
A namespace is used to extend the global VNLS object. All it's methods are therefor singletons.
VNLS.ns('my.test',{
myMethod : function(){
return 'test';
}
})
or:
VNLS.ns('private',(function(){
var privateFn = function(){
.....
}
var api = {
exposeMe: function(){
}
}
return api;
})());
VNLS.my.test.myMethod();
or
VNLS.ns('my.test').myMethod()
In normal use there are no dependencies, it will run in the browser and on nodejs out of the box.
When contributing, experimenting or if you want to build your own, use the following node_modules.
npm install jasmine-node
npm install nodewatch
npm install uglify-js
npm install -g jake
For jake these are the commands:
jake compress
: build minified version in './lib/*'jake test
: run the specsjake autotest
: run the specs on a filechange for TDDFor testing in a browser environment just point your browser to 'specs/index.html'.
It should run the same specs as jake test
does. (The tests cover both browser and server)
FAQs
Small javascript framework
The npm package vnls receives a total of 4 weekly downloads. As such, vnls popularity was classified as not popular.
We found that vnls demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.