Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clazzy

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clazzy - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

140

Gruntfile.js
module.exports = function (grunt)
{
// Dependencies
// ----------------------------------------------------
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Dependencies
// ----------------------------------------------------
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Configuration
// ----------------------------------------------------
grunt.initConfig(
{
// Cleaning
// ------------------------------------------------
// Configuration
// ----------------------------------------------------
grunt.initConfig(
{
// Cleaning
// ------------------------------------------------
clean :
{
src : ['dist']
},
clean :
{
src : ['dist']
},
// Tests
// ------------------------------------------------
// Tests
// ------------------------------------------------
nodeunit :
{
options :
{
reporter : 'verbose'
},
nodeunit :
{
options :
{
reporter : 'verbose'
},
all : ['test/Clazzy.js']
},
all : ['test/Clazzy.js']
},
// Compression
// ------------------------------------------------
// Compression
// ------------------------------------------------
uglify :
{
build :
{
src : 'src/Clazzy.js',
dest : 'dist/Clazzy.js'
},
uglify :
{
build :
{
src : 'src/Clazzy.js',
dest : 'dist/Clazzy.js'
},
options : { report : 'gzip' }
},
options : { report : 'gzip' }
},
// Code Quality
// ------------------------------------------------
jshint :
{
options :
{
jshintrc : '.jshintrc'
},
src : ['src/Clazzy.js', 'test/Clazzy.js']
}
});
// Task: `default`
// ----------------------------------------------------
grunt.registerTask('default', ['jshint', 'nodeunit', 'clean', 'uglify']);
// Task: `build`
// ----------------------------------------------------
grunt.registerTask('build', ['jshint', 'nodeunit', 'clean', 'uglify']);
// Task: `test`
// ----------------------------------------------------
grunt.registerTask('test', ['jshint', 'nodeunit']);
// Code Quality
// ------------------------------------------------
jshint :
{
options :
{
jshintrc : '.jshintrc'
},
src : ['src/Clazzy.js', 'test/Clazzy.js']
}
});
// Task: `default`
// ----------------------------------------------------
grunt.registerTask('default', ['jshint', 'nodeunit', 'clean', 'uglify']);
// Task: `build`
// ----------------------------------------------------
grunt.registerTask('build', ['jshint', 'nodeunit', 'clean', 'uglify']);
// Task: `test`
// ----------------------------------------------------
grunt.registerTask('test', ['jshint', 'nodeunit']);
};
{
"name" : "clazzy",
"name" : "clazzy",
"version" : "0.1.0",
"version" : "0.1.1",
"description" : "A cross platform JavaScript library that provides a classical interface to prototype inheritance using a simple DSL inspired by Ruby.",
"description" : "A cross platform JavaScript library that provides a classical interface to prototypal inheritance.",
"author" :
{
"name" : "Luke Phillips",
"author" :
{
"name" : "Luke Phillips",
"email" : "lukephil92@gmail.com",
"email" : "lukephil92@gmail.com",
"url" : "https://github.com/lsphillips"
},
"url" : "https://github.com/lsphillips"
},
"keywords" :
[
"class",
"prototype",
"extend",
"base",
"include",
"trait",
"mixin"
],
"keywords" :
[
"class",
"prototype",
"extend",
"base",
"include",
"trait",
"mixin"
],
"homepage" : "https://github.com/lsphillips/Clazzy",
"homepage" : "https://github.com/lsphillips/Clazzy",
"bugs" :
{
"url" : "https://github.com/lsphillips/Clazzy/issues"
},
"bugs" :
{
"url" : "https://github.com/lsphillips/Clazzy/issues"
},
"directories" :
{
"src" : "src",
"test" : "test"
},
"directories" :
{
"src" : "src",
"test" : "test"
},
"devDependencies" :
{
"grunt" : "^0.4.2",
"grunt-contrib-clean" : "^0.5.0",
"grunt-contrib-jshint" : "^0.10.0",
"grunt-contrib-uglify" : "^0.4.0",
"grunt-contrib-nodeunit" : "^0.3.3"
},
"devDependencies" :
{
"grunt" : "^0.4.5",
"grunt-contrib-clean" : "^0.6.0",
"grunt-contrib-jshint" : "^0.10.0",
"grunt-contrib-uglify" : "^0.5.1",
"grunt-contrib-nodeunit" : "^0.4.1"
},
"scripts" :
{
"test" : "grunt test"
},
"scripts" :
{
"test" : "grunt test"
},
"main" : "src/Clazzy.js",
"main" : "src/Clazzy.js",
"repository" :
{
"type" : "git",
"url" : "https://github.com/lsphillips/Clazzy.git"
},
"repository" :
{
"type" : "git",
"url" : "https://github.com/lsphillips/Clazzy.git"
},
"license" : "MIT"
"license" : "MIT"
}
## Clazzy
A cross platform JavaScript library that provides a classical interface to prototype inheritance using a simple DSL inspired by Ruby.
A cross platform JavaScript library that provides a classical interface to prototypal inheritance.

@@ -5,0 +5,0 @@ ## Usage

@@ -31,5 +31,5 @@ // _____ _

// We need to pass array-like objects, such as the arguments
// object, to Function.apply, however not all implementations yet
// object, to `Function#apply`, however not all implementations yet
// allow array-like objects to be passed to it. So we need to
// convert them to an array, this can be done using Array.slice.
// convert them to an array, this can be done using `Array#slice`.
//

@@ -47,3 +47,3 @@ // A further problem, is you can't slice array-like objects

// The Object.hasOwnProperty method is not protected, which
// The `Object.hasOwnProperty` method is not protected, which
// allows an object to override it, making using the method

@@ -86,4 +86,4 @@ // like this:

Surrogate.prototype = clazz.prototype;
Surrogate.prototype.constructor = clazz;
Surrogate.prototype = clazz.prototype;
Surrogate.prototype[CONSTRUCTOR] = clazz;

@@ -105,6 +105,6 @@

{
// IE8 implements Object.defineProperty, however it only
// IE8 implements `Object.defineProperty`, however it only
// works on DOM elements. So IE8 must also use a fall-back
// method, requiring us to check for the implementation of
// Object.defineProperties instead.
// `Object.defineProperties` instead.
if (Object.defineProperties === undefined)

@@ -128,6 +128,6 @@ {

//
// target[signature] = methods[signature];
// target[property] = methods[property];
//
// However for ECMA5 getters, this wouldn't work, as it
// would be invoked, hence assigning the value being
// would be invoked, assigning the value being
// returned by the getter, rather than it's definition.

@@ -184,34 +184,39 @@ Object.defineProperty(target, property, descriptor);

var error = function ()
var wrap = (function ()
{
throw new Error('Error calling super, this method does not override a parent method');
};
var wrap = function (method, signature, base)
{
return function ()
function noSuper ()
{
var tmp = this[SUPER];
this[SUPER] = base.prototype[signature] || error;
var result;
try // to execute the method.
throw new Error('[Clazzy] Cannot call super, this method does not override a parent method');
}
return function (method, signature, base)
{
return function ()
{
result = method.apply(
this, slice.call(arguments)
);
}
finally
{
this[SUPER] = tmp;
}
return result;
var tmp = this[SUPER];
this[SUPER] = base.prototype[signature] || noSuper;
var result;
try // to execute the method.
{
result = method.apply(
this, slice.call(arguments)
);
}
finally
{
this[SUPER] = tmp;
}
return result;
};
};
};
}) ();
// --------------------------------------------------------------

@@ -228,2 +233,4 @@

var initialize, base, includes;

@@ -233,4 +240,2 @@ // Constructor

var initialize;
function Class ()

@@ -259,3 +264,3 @@ {

var base = definition[EXTEND];
base = definition[EXTEND];

@@ -279,3 +284,3 @@ if (base === undefined)

var includes = definition[INCLUDE];
includes = definition[INCLUDE];

@@ -330,3 +335,3 @@ if (includes !== undefined)

throw new Error('Cannot create class, "super" is a reserved method name');
throw new Error('[Clazzy] Cannot create class, `super` is a reserved method name');

@@ -337,3 +342,3 @@ default :

{
// Always wrap the method. Even if a
// Always wrap the method, even if a
// parent method doesn't exist at the

@@ -352,3 +357,3 @@ // moment, as a method could later be

Class.prototype.constructor = Class;
Class.prototype[CONSTRUCTOR] = Class;

@@ -358,4 +363,2 @@

},
// ----------------------------------------------------------

@@ -362,0 +365,0 @@ noConflict : (function (context)

@@ -29,3 +29,3 @@ module.exports = (function ()

test.ok(foo instanceof Foo, 'the "instanceof" operator asserts an instance of the class is an instance of said class');
test.ok(foo instanceof Foo, 'the `instanceof` operator asserts an instance of the class is an instance of said class');

@@ -36,3 +36,3 @@ // Done

'test creating a class with a constructor using the "initialize" definition' : function (test)
'test creating a class with a constructor using the `initialize` definition' : function (test)
{

@@ -52,3 +52,3 @@ // Act

// Assert
test.equal(foo.bar, 'foo', 'the constructor is executed when the class is instantiated using the "new" operator');
test.equal(foo.bar, 'foo', 'the constructor is executed when the class is instantiated using the `new` operator');

@@ -74,3 +74,3 @@ test.equal(foo.baz, 'foo', 'arguments passed to the class at instantiation are passed on to the constructor');

// Assert
test.equal(typeof Foo.prototype.bar, 'function', 'any definition properties which are not: "extend", "include", "static", "initialize" or "super" are treated as instance members');
test.equal(typeof Foo.prototype.bar, 'function', 'any definition properties which are not: `extend`, `include`, `static`, `initialize` or `super` are treated as instance members');

@@ -81,3 +81,3 @@ // Done

'test creating a class with class members using the "static" definition' : function (test)
'test creating a class with class members using the `static` definition' : function (test)
{

@@ -106,3 +106,3 @@ // Act

'test creating a class that extends a class using the "extend" definition' : function (test)
'test creating a class that extends a class using the `extend` definition' : function (test)
{

@@ -155,5 +155,5 @@ // Act

// Assert
test.ok(bar instanceof Bar, 'the "instanceof" operator still asserts an instance of the class is an instance of said class');
test.ok(bar instanceof Bar, 'the `instanceof` operator still asserts an instance of the class is an instance of said class');
test.ok(bar instanceof Foo, 'the "instanceof" operator will also assert an instance of the class is an instance of the base of said class');
test.ok(bar instanceof Foo, 'the `instanceof` operator will also assert an instance of the class is an instance of the base of said class');

@@ -166,3 +166,3 @@ test.equal(typeof Bar.prototype.bar, 'function', 'instance members from the base class are inherited by the extending class');

test.equal(bar.foo, 'foo', 'if the extending class has not defined a constructor, the base constructor is executed called instead when instantiated using the "new" operator');
test.equal(bar.foo, 'foo', 'if the extending class has not defined a constructor, the base constructor is executed called instead when instantiated using the `new` operator');

@@ -173,3 +173,3 @@ // Done

'test creating a class that includes a class using the "include" definition' : function (test)
'test creating a class that includes a class using the `include` definition' : function (test)
{

@@ -230,3 +230,3 @@ // Act

test.equal(bar.foo, 'foo', 'the constructor of the included class is executed when the including class is instantiated using the "new" operator');
test.equal(bar.foo, 'foo', 'the constructor of the included class is executed when the including class is instantiated using the `new` operator');

@@ -233,0 +233,0 @@ test.equal(qux.bar(), 'baz', 'class includes are included in a FIFO (first in, first out) fashion');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc