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

nail

v0.1.0-beta1

Published

Nail is a cutomizable, framework-independent tool for js/coffee class creation.

Downloads

2

Readme

nail - simple modular classes

Nail is a simple but flexble tool for creating coffe/java script classes.

Nail uses the powefull nail-core API to handlethe propertiesmethods and iheritance with seperate replacable modules.

Class definitions in nail are well strcutured and tool friendly.

This Document

To ensure that the examle code is up to date it is run as a test- This requires underscore, should and an instrumented version of nail. In your productive code nail = require 'nail' should be enough.

nail    = require '../coverage/instrument/lib/module.js'
should  = require 'should'
_       = require 'underscore'

Overview

The nail concept:

  • class definitions are objects
  • every key in the definition is a class
  • every aspect of a class has a seperate block

Nail uses the API defined by nail-core and modules from nail-common.

Usage

###Creating a class The following code defines the class Person and adds it to exports and the namespace 'my-module'.

nail.to exports, 'my-module', Person:
  fields:
    firstName:  null
    lastName:   null
  properties:
    fullName:
      get:-> "#{@lastName}, #{@firstName}"
  methods:
    greet: -> return "hello, #{@fullName}"

Now our package exports the constructor for Person.

describe 'Person', ->
  it 'is a function', ->
    (_.isFunction exports.Person).should.be.ok

###creating an instance Values are injected into the new Instance.

dalia = new exports.Person
  firstName: 'Dalia'
  lastName:  'Scarlet'
it 'injects data', ->
  dalia.firstName.should.equal 'Dalia'
  dalia.lastName.should.equal  'Scarlet'
it 'creates properties', ->
  dalia.fullName.should.equal  'Scarlet, Dalia'
it 'creates methods', ->
  dalia.greet().should.equal 'hello, Scarlet, Dalia'

###using namespaces Using namespaces will give every class a unique name.

This simple generic factory functionm creates instance of Person from JSON.

it "can be loaded from json", ->
  sampleJSON ="""
              {
                "type": "my-module.Person",
                "properties":{
                  "firstName": "Nick",
                  "lastName":  "Pudel"
                }
              }
            """
  loadObject = (data) -> new nail.lib[data.type] data.properties

  nick  = loadObject(JSON.parse sampleJSON)
  nick.firstName.should.equal 'Nick'
  nick.lastName.should.equal 'Pudel'
  nick.fullName.should.equal "Pudel, Nick"

##Setup Install with npm:

npm install nail

Clone with GIT:

git clone https://github.com/noptic/nail.git

##Documentation Head here → docs

##Dependencies

##DevDependencies