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

crisp-create

v0.2.13

Published

represent a Class design pattern for JavaScript included multible namespaces, options and functions

Downloads

74

Readme

Crisp.CreateJS

represent a Class design pattern for JavaScript included multible namespaces, options and functions

Build Status NPM Downloads NPM Version

// create object
var myObject = Crisp.utilCreate();

// initialice object
myObject.objIni();

// get object option
myObject._('myoption');

// clone object without data
var cloneObject = myObject.objClone();

Index Table

Getting Started

Server-Nodes

Use Node Package Manager (npm) to install crisp-create for Node.js and io.js

$ npm install crisp-create
// use package
require("crisp-create");

or use the OpenCrisp UtilJS wraper

$ npm install crisp-util
// use package
require("crisp-util");

Web-Clients

Use Bower to install crisp-create for Browsers APP's and other front-end workflows.

$ bower install crisp-create
<!-- use package -->
<script type="text/javascript" src="dist/crisp-create.min.js"></script>

or use the OpenCrisp UtilJS wraper

$ bower install crisp-util
<!-- use package -->
<script type="text/javascript" src="dist/crisp-util.min.js"></script>

Development

Use Git to clone Crisp.CreateJS from GitHub to develop the repository with Grunt

# Clone:
$ git clone https://github.com/OpenCrisp/Crisp.CreateJS.git

# Build: test, concat, test, minify, test
$ grunt

# Test: original sourcecode for developer (included in build)
$ grunt t

# Run all test-scripts on Unix
$ sh grunt-tests.sh

Usage

How to use Crisp.CreateJS function in JavaScript.

Crisp.utilCreate()

How to use Crisp.utilCreate( option ) with util.create namespace.

var myObject = Crisp.utilCreate({
    ns: []
    options: {},
    prototypes: {},
    properties: {}
});

option.ns utilCreate()

var myObject = Crisp.utilCreate({
    ns: ['util.event']
}).objIni();

myObject.objNs('util.event');   // true
myObject.xTo();                 // '{}'

option.options utilCreate()

var myObject = Crisp.utilCreate({
    options: {
        a: { proWri: true }
    }
}).objIni({ a: 'A' });

myObject._('a'); // 'A'
myObject.xTo();  // '{}'

option.properties utilCreate()

var myObject = Crisp.utilCreate({
    properties: {
        b: {
            proEnu: true,
            proGet: function() { return 'B'; }
        }
    }
}).objIni();

myObject.b;      // 'B'
myObject.xTo();  // '{"b":"B"}'

option.prototypes utilCreate()

var myObject = Crisp.utilCreate({
    prototypes: {
        c: function() { return 'C'; }
    }
}).objIni();

myObject.c();    // 'C'
myObject.xTo();  // '{}'

CreateJS function

.objIni()

How to use .objIni( option ) function on utilCreate object.

var myObject = Crisp.utilCreate({
  options: {
    test: {}
  }
}).objIni({
    test: 0
});

myObject._('test');     // 0

._()

How to use ._( name OR option ) function on utilCreate object.

// get the value of `test`
myObject._('test');
// or with option
myObject._({ name: 'test' });

// returns preset if option is undefined
myObject._({ name: 'test', preset: 0 });
// or preset of function
myObject._({ name: 'test', preset: function() { return 0; } });

// returns preset if option is undefined and save the value on option
myObject._({ name: 'test', insert: true, preset: 0 });
// or preset of function
myObject._({ name: 'test', insert: true, preset: function() { return 0; } });

.objSet()

How to use .objSet( name, value ) function on utilCreate object.

myObject.objSet('test', 1 );

.objData()

How to use .objData( option ) function on utilCreate object.

myObject.objData({
    a: 'A'
});

myObject.a;  // 'A'

.objClone()

How to use .objClone() function on utilCreate object.

var cloneObject = myObject.objClone();

.objNs()

How to use .objNs( name ) function on utilCreate object.

myObject.objNs('util.create');  // true

'util.create' is an default namespace

Links