Comparing version 0.0.1 to 0.0.2
18
index.js
module.exports = newStruct; | ||
function newStruct(content){ | ||
function newStruct (content){ | ||
var struct = Object.create(content), | ||
@@ -37,2 +37,8 @@ props = create.props = [], | ||
if (create.supers) { | ||
for (key in create.supers) { | ||
create.supers[key] = wrapMethod(copy, create.supers[key]); | ||
} | ||
} | ||
if (struct.construct) { | ||
@@ -47,2 +53,3 @@ struct.construct(copy); | ||
var config = Object.create(content), | ||
supers = {}, | ||
create; | ||
@@ -52,2 +59,6 @@ | ||
for (key in ext) { | ||
if (typeof config[key] == 'function') { | ||
supers[key] = config[key]; | ||
} | ||
config[key] = ext[key]; | ||
@@ -57,2 +68,3 @@ } | ||
create = newStruct(config); | ||
create.supers = supers; | ||
@@ -67,3 +79,3 @@ var ind; | ||
create.method = function(name, fn){ | ||
create.method = function (name, fn){ | ||
methods.push(name); | ||
@@ -77,3 +89,3 @@ struct[name] = fn; | ||
function wrapMethod(copy, method){ | ||
function wrapMethod (copy, method){ | ||
return function(){ | ||
@@ -80,0 +92,0 @@ var args = Array.prototype.slice.call(arguments); |
{ | ||
"name": "new-struct", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Structs inspired from Golang", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3544
73