Comparing version 0.0.0 to 0.0.1
@@ -37,2 +37,6 @@ module.exports = newStruct; | ||
if (struct.construct) { | ||
struct.construct(copy); | ||
} | ||
return copy; | ||
@@ -39,0 +43,0 @@ }; |
{ | ||
"name": "new-struct", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Structs inspired from Golang", | ||
@@ -17,7 +17,7 @@ "main": "index.js", | ||
"repository": { | ||
"url": "git@github.com:azer\/new-struct.git", | ||
"url": "git@github.com:azer/new-struct.git", | ||
"type": "git" | ||
}, | ||
"author": "Azer Ko\u00e7ulu <azer@kodfabrik.com>", | ||
"author": "Azer Koçulu <azer@kodfabrik.com>", | ||
"license": "BSD" | ||
} |
## new-struct | ||
Structs inspred from Golang | ||
Structs inspired from Golang | ||
@@ -66,2 +66,22 @@ ```js | ||
To define a constructor method: | ||
```js | ||
Animal = newStruct({ | ||
construct: construct, | ||
name: '', | ||
type: '', | ||
age: 0, | ||
run: run | ||
}) | ||
function construct (animal) { | ||
animal.log = console.log | ||
animal.log('%s just born!', animal.name) | ||
} | ||
dondong = Animal('dongdong', 'cat') | ||
// => dongdong just born | ||
``` | ||
![](http://i.cloudup.com/CZR70W5Sct.png) |
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
3260
5
63
87