npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vitruvio

v1.1.0

Published

Framework which extends JavaScript capabilities in order to allow developing OOP applications over an structural well designed architecture by defining: namespaces, classes, interfaces, enumerators, inheritance, exceptions and other resources.

Downloads

23

Readme

Vitruvio

Is a framework which extends JavaScript capabilities in order to allow developing OOP applications over an structural well designed architecture by defining: namespaces, classes, interfaces, enumerators, inheritance, exceptions and other resources. Altogether with the solid class system proposed, it offers:

Environments and browser support

Vitruvio runs server side on Node.JS and client side suports the following browsers on desktop and mobile devices:

How to use

Step 1, get it down!

Over NodeJS it can be easyly downloaded and installed with:

npm install vitruvio --save

or can be downloaded via Right click/Save as: latest realeased

Step 2, include it in your code!

Vitruvio exports the System namespace which is the main namespace of the framework and contains fundamental classes and base classes that define commonly-used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions. For this reason is highly recommended to name it on source code as System.

On NodeJS using require:

var System = require('vitruvio');

On html pages:

<...>
<script type="text/javascript" src="./public/js/vitruvio/vitruvio.min.js"></script>
<script>
  // System is already loaded or you can use System.ready(function)
  System.ready(function(System) {
    // Do some cool things...
  })
</script>
<...>

Step 3, get System's globals

var using = System.using; // Resources solver function

// Main functions and resources
var Namespace = using('System.Namespace');
var Class = using('System.Class');
var Interface = using('System.Interface');
var Enum = using('System.Enum');
...

Step 4, lets define some classes!

// on file src/com/example/Animal.js
Namespace('com.example', 
    /**
     * Animal class
     */
    Class('Animal', {
      'constructor' : function(specie) {
          this.specie = specie;
      },
      'getSpecie' : function() {
          return this.specie;
      }
    })    
)

// on file src/com/example/Dog.js
Namespace('com.example', 
    /**
     * Dog class
     */
    Class('Dog', {
      '$extends' : 'com.example.Animal',
      'constructor' : function(name, race, age) {
          this.$super('canis'); // initialize super class' constructor first
          this.name = name;
          this.race = race;
          this.age = age;
      },
      'getName' : function() {
          return this.name;
      },
      'getAge' : function() {
        ...
      },
      /**
       * @Override getSpecie
       */
      'getSpecie' : function() {
          return this.$super.getSpecie() + " - " + this.race;
      }
    })    
)

// on file src/main.js

// Load and get the Dog class reference asynchronously
using('com.example.Dog', function(Dog){
	var boxer = new Dog("Snoopy", "Boxer", 5);

	console.log(boxer.getName()) // Snoopy
	console.log(boxer.getSpecie()) // canis - Boxer
});

Once a class has been loaded, you can get its reference:

var MyClass = using('com.example.MyClass');

Is and As operators

One of the most advanced capabilities of Vitruvio framework is the ability to cast objects to a specific type and to check instances out by its type.

Is operator example: Pure JavaScript:

try {
  ...
} catch(e) {
    if(e.type == "Error") {
        // Do something
    }
    
    // or 
    
    if(e instanceof Error) {
        // Do something
    }
}

Vitruvio schema:

try {
  // Some code which throws an error.
  throw new CustomException("My Custom message");
} catch(e) {
    // The is operator in most cases will do the same as the instanceof JavaScript operator.
    if(e.is(CustomException)) {
      // Do something
    } else if(e.is(Exception)) { // Base System.Exception class
      // Do something
    } else { // Third party and basic JavaScript errors
      // Do something
    }
}

As operator: Pure JavaScript:

...

Vitruvio schema:

// on file src/com/example/ifaces/Runnable.js

Namespace('com.example.ifaces', 
  Interface('Runnable', {
    'run': function(task) {}
  })
)

// on file src/com/example/tasks/DownloadTask.js
Namespace('com.example.tasks', 
  Class('DownloadTask', {  
    '$implements' : 'com.example.ifaces.Runnable',
    'taskList' : [],
    'run': function(task) {
        taskList.push(task);
        // ...
    },
    'getTasks' : function() {
        return this.taskList;
    },
    // several methods and properties
  })
)

// on main.js file
var Runnable = using('com.example.ifaces.Runnable');
var DownloadTask = using('com.example.tasks.DownloadTask');

var task = new DownloadTask();

var runnable = task.as(Runnable); // the casted runnable instance will only contain the run method.