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 🙏

© 2024 – Pkg Stats / Ryan Hefner

noof

v0.2.3

Published

Craydent Node Object Oriented Framework

Downloads

6

Readme

Craydent NOOF 0.2.3

by Clark Inada

NOOF (Node Object Oriented Framework) module is a framework to enable object oriented practices to JavaScript. With this module, you are able define:

  • Namespaces
  • Interfaces
  • Abstract Classes
  • Public Classes
  • Overloading methods
  • Private methods/properties
  • Protected methods/properties
  • Public methods/properties
  • Constructors
  • Destructors
  • Strongly typed variables and parameters

NOOF provides the ability to created extensions to classes and intreface implementation which are all checked on start/load as well as the ability to import namespaces to the current scope.

###**Note: A semi-colon (;) as the end of every NOOF directive is required. *Note: Checking method parameter/variable types can only be done through run time so it is still important to run unit tests to test your own code.

Usages

There are 2 ways to require NOOF

var $n = require('noof');

// OR

// when using this require, remove the "$n." prefix in all the examples below.
require('noof/global');

Defining typed method parameters & variables (the type is case sensitive)

private.variable = "";
private.String.str = "";

protected.variable = "";
protected.String.str = "";

public.variable = "";
public.String.str = "";


private.method.foo = function () { /* your code goes here */ };
protected.method.foo = function () { /* your code goes here */ };
public.method.foo = function () { /* your code goes here */ };

// Specify a return type.
// Return types are checked at runtime and will throw errors when specified type is not returned
private.method.Boolean.isTrue = function () { /* your code goes here */ };
protected.method.Boolean.isTrue = function () { /* your code goes here */ };
public.method.Boolean.isTrue = function () { /* your code goes here */ };

Overloading methods

public.method.foo(Number.a) = function(a) { /* your code goes here */ };
public.method.foo(String.a, Number.b) = function(a, b) { /* your code goes here */ };
public.method.foo(Object.a, String.b, Boolean.c) = function (a, b, c) { /* your code goes here */ };
public.method.foo(Number.a, Array.d, Date.c) = function(a, d, c) { /* your code goes here */ };
public.method.foo(String.a, String.b, String.c, String.d) = function(a, b, c, d) { /* your code goes here */ };

Defining Namespaces

var $n = require('noof');
// this will declare User in the public scope as well as the namespace scope
$n.Namespace("NOOF", 
    $n.Public(function User (params) {
        public.type = "User";
        public.first_name = "";
        public.last_name = "";
        public.method.foo(Number.a) = function(a) { /* your code goes here */ };
        public.method.foo(String.a, Number.b) = function(a, b) { /* your code goes here */ };
    })
)
// this will only declare User in the namespace scope
$n.Namespace("NOOF", 
    function User (params) {
        public.type = "User";
        public.first_name = "";
        public.last_name = "";
        public.method.foo(Number.a) = function(a) { /* your code goes here */ };
        public.method.foo(String.a, Number.b) = function(a, b) { /* your code goes here */ };
    }
)

Using Namespaces

var $n = require('noof');
$n.Namespace("NOOF", 
    function User (params) {
        public.type = "User";
        public.first_name = "";
        public.last_name = "";
        public.method.foo(Number.a) = function(a) { /* your code goes here */ };
        public.method.foo(String.a, Number.b) = function(a, b) { /* your code goes here */ };
    }
)
function use_namespace() {
    var NOOF = $n.Use('NOOF');
    ver u = new NOOF.User();
}

function use_namespace1() {
    var User = $n.Use('NOOF.User');
    ver u = new User();
}

function use_namespace() {
    eval($n.Use('NOOF.User', true)); // setting the second argument to true returns a stringified version of the classes.
    ver u = new User();            // this is useful for closure when the class needs to use a variable in the parent scope.
}

Defining Interfaces

var $n = require('noof');
$n.Interface(function IClass () {
	public.String.name;
	public.method.foo(String.a);
	public.method.foo(Number.a);
	public.method.foo(a, b);
	public.method.foo(a, b, c);
	public.method.foo(a, d, c);
	public.method.bar;
})

Defining Abstract Classes

var $n = require('noof');
$n.Abstract(function Base() {
	public.String._id = null;
	public.Date.now = null;
	protected.Array.vals = [];

	public.method.foo(String.a) = function(a) { /* your code goes here */ };
	public.method.foobar = function* () { /* your code goes here */ };
});

Defining Public

var $n = require('noof');
$n.Public(function User (params) {
    public.type = "User";
    public.first_name = "";
    public.last_name = "";
    public.method.foo(Number.a) = function(a) { /* your code goes here */ };
    public.method.foo(String.a, Number.b) = function(a, b) { /* your code goes here */ };
})

Implementing Interfaces

var $n = require('noof');
$n.Public(function NewClass () {
	public.String.name = "";
	public.method.foo(String.a) = function(a) { /* your code goes here */ };
	public.method.foo(Number.a) = function(a) { /* your code goes here */ };
	public.method.foo(String.a, Number.b) = function(a, b) { /* your code goes here */ };
	public.method.foo(Object.a, String.b, Boolean.c) = function (a, b, c) { /* your code goes here */ };
	public.method.foo(Number.a, Array.d, Date.c) = function(a, d, c) { /* your code goes here */ };
	public.method.foo(String.a, String.b, String.c, String.d) = function(a, b, c, d) { /* your code goes here */ };

	public.method.bar = function*(a,b) { /* your code goes here */ };
    	
}).implementsInterface(IClass);

Extending Classes

var $n = require('noof');
$n.Public(function NewClass () {
	public.String.name = "Clark";
	public.method.foo(Number.a) = function(a) { /* your code goes here */ };
	public.method.foo(String.a, Number.b) = function(a, b) { /* your code goes here */ };
	public.method.foo(Object.a, String.b, Boolean.c) = function (a, b, c) { /* your code goes here */ };
	public.method.foo(Number.a, Array.d, Date.c) = function (a, d, c) { /* your code goes here */ };
	public.method.foo(String.a, String.b, String.c, String.d) = function (a, b, c, d) { /* your code goes here */ };

	public.method.bar = function*(a, b) { /* your code goes here */ }
}).extendsFrom(Base);

Extending Class and then Implementing Interface

var $n = require('noof');
$n.Public(function NewClass () {
	public.String.name = "Clark";
	public.method.foo(Number.a) = function (a) { /* your code goes here */ };
	public.method.foo(String.a, Number.b) = function (a, b) { /* your code goes here */ };
	public.method.foo(Object.a, String.b, Boolean.c) = function (a, b, c) { /* your code goes here */ };
	public.method.foo(Number.a, Array.d, Date.c) = function (a, d, c) { /* your code goes here */ };
	public.method.foo(String.a, String.b, String.c, String.d) = function (a, b, c, d) { /* your code goes here */ };

	public.method.bar = function*(a, b) { /* your code goes here */ }
}).extendsFrom(Base).implementsInterface(IClass);

Installation

$ npm i --save noof

Download

The Craydent NOOF is released under the Dual licensed under the MIT or GPL Version 2 licenses.