Permalink
Browse files

Initial release.

  • Loading branch information...
0 parents commit 37e59f922de966214c845539d2edd48986c064f2 @kapouer committed Mar 21, 2012
Showing with 46 additions and 0 deletions.
  1. +20 −0 LICENSE
  2. +13 −0 README
  3. +13 −0 inherits.js
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright 2012, Jérémy Lal <kapouer@melix.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
13 README
@@ -0,0 +1,13 @@
+node-inherits
+=============
+
+Helper function to do classic inheritance in JavaScript.
+
+node-inherits is an implementation of trivial, obvious code
+that is nonetheless required by several Node.js modules.
+Those modules use 'inherits', the license of which is not clear
+enough to be called a free software license.
+This original rewrite allows node-inherits to propose an alternative
+with a free software license.
+
+See source code for usage.
@@ -0,0 +1,13 @@
+module.exports = function(child, parent, proto) {
+ var descriptors = {};
+ extd(child.prototype, descriptors);
+ if (proto) extd(proto, descriptors);
+ child.prototype = Object.create(parent.prototype, descriptors);
+ child.super = parent;
+};
+
+function extd(obj, dest) {
+ Object.getOwnPropertyNames(obj).forEach(function(name) {
+ dest[name] = Object.getOwnPropertyDescriptor(obj, name);
+ });
+}

0 comments on commit 37e59f9

Please sign in to comment.