Hello community,

here is the log from the commit of package nodejs-clone for openSUSE:Factory 
checked in at 2015-06-30 10:15:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nodejs-clone (Old)
 and      /work/SRC/openSUSE:Factory/.nodejs-clone.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "nodejs-clone"

Changes:
--------
--- /work/SRC/openSUSE:Factory/nodejs-clone/nodejs-clone.changes        
2015-04-27 13:00:31.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.nodejs-clone.new/nodejs-clone.changes   
2015-06-30 10:15:55.000000000 +0200
@@ -1,0 +2,11 @@
+Wed Jun 24 14:15:00 UTC 2015 - [email protected]
+
+- revert to version 0.1.5
+- nodejs-defaults can't handle version > 0.1.5
+
+-------------------------------------------------------------------
+Fri Jun  5 19:24:39 UTC 2015 - [email protected]
+
+- update version 1.0.2
+
+-------------------------------------------------------------------

Old:
----
  clone-0.1.18.tgz

New:
----
  clone-0.1.5.tgz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ nodejs-clone.spec ++++++
--- /var/tmp/diff_new_pack.3jWPG6/_old  2015-06-30 10:15:55.000000000 +0200
+++ /var/tmp/diff_new_pack.3jWPG6/_new  2015-06-30 10:15:55.000000000 +0200
@@ -19,7 +19,7 @@
 %define base_name clone
 
 Name:           nodejs-clone
-Version:        0.1.18
+Version:        0.1.5
 Release:        0
 Summary:        Deep cloning of objects and arrays
 License:        MIT
@@ -42,7 +42,7 @@
 
 %install
 mkdir -p %{buildroot}%{nodejs_modulesdir}/%{base_name}
-cp -pr package.json clone.js \
+cp -pr package.json *.js \
         %{buildroot}%{nodejs_modulesdir}/%{base_name}/
 
 %files

++++++ clone-0.1.18.tgz -> clone-0.1.5.tgz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/.travis.yml new/package/.travis.yml
--- old/package/.travis.yml     2013-05-12 20:24:20.000000000 +0200
+++ new/package/.travis.yml     2013-02-06 01:09:11.000000000 +0100
@@ -1,5 +1,4 @@
 language: node_js
 node_js:
   - 0.6
-  - 0.8
-  - 0.10
+  - 0.8
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/LICENSE new/package/LICENSE
--- old/package/LICENSE 2014-06-29 12:54:27.000000000 +0200
+++ new/package/LICENSE 2013-02-06 01:09:11.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright © 2011-2014 Paul Vorbach <[email protected]>
+Copyright © 2011-2013 Paul Vorbach <[email protected]>
 
 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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/README.md new/package/README.md
--- old/package/README.md       2014-06-29 12:57:13.000000000 +0200
+++ new/package/README.md       2013-02-06 01:09:11.000000000 +0100
@@ -44,7 +44,7 @@
 
 ## API
 
-`clone(val, circular, depth)`
+`clone(val, circular)`
 
   * `val` -- the value that you want to clone, any type allowed
   * `circular` -- boolean
@@ -52,8 +52,6 @@
     Call `clone` with `circular` set to `false` if you are certain that `obj`
     contains no circular references. This will give better performance if 
needed.
     There is no error if `undefined` or `null` is passed as `obj`.
-  * `depth` -- depth to wich the object is to be cloned (optional,
-    defaults to infinity)
 
 `clone.clonePrototype(obj)`
 
@@ -99,14 +97,14 @@
 
 ## Bugs and Issues
 
-If you encounter any bugs or issues, feel free to [open an issue at
-github](https://github.com/pvorb/node-clone/issues) or send me an email to
-<[email protected]>. I also always like to hear from you, if you’re using my code.
+If you encounter any bugs or issues, feel free to
+[open an issue at github](https://github.com/pvorb/node-clone/issues) or send 
me
+an email to <[email protected]>. I also always like to hear from you, if you’re 
using
+my code.
 
 ## License
 
-Copyright © 2011-2014 [Paul Vorbach](http://paul.vorba.ch/) and
-[contributors](https://github.com/pvorb/node-clone/graphs/contributors).
+Copyright © 2011-2013 Paul Vorbach
 
 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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/clone.js new/package/clone.js
--- old/package/clone.js        2014-06-29 12:44:01.000000000 +0200
+++ new/package/clone.js        2013-02-06 01:09:11.000000000 +0100
@@ -1,33 +1,6 @@
-'use strict';
+var util = require('util');
 
-function objectToString(o) {
-  return Object.prototype.toString.call(o);
-}
-
-// shim for Node's 'util' package
-// DO NOT REMOVE THIS! It is required for compatibility with EnderJS 
(http://enderjs.com/).
-var util = {
-  isArray: function (ar) {
-    return Array.isArray(ar) || (typeof ar === 'object' && objectToString(ar) 
=== '[object Array]');
-  },
-  isDate: function (d) {
-    return typeof d === 'object' && objectToString(d) === '[object Date]';
-  },
-  isRegExp: function (re) {
-    return typeof re === 'object' && objectToString(re) === '[object RegExp]';
-  },
-  getRegExpFlags: function (re) {
-    var flags = '';
-    re.global && (flags += 'g');
-    re.ignoreCase && (flags += 'i');
-    re.multiline && (flags += 'm');
-    return flags;
-  }
-};
-
-
-if (typeof module === 'object')
-  module.exports = clone;
+module.exports = clone;
 
 /**
  * Clones (copies) an Object using deep copying.
@@ -42,88 +15,103 @@
  * @param `parent` - the object to be cloned
  * @param `circular` - set to true if the object to be cloned may contain
  *    circular references. (optional - true by default)
- * @param `depth` - set to a number if the object is only to be cloned to
- *    a particular depth. (optional - defaults to Infinity)
- * @param `prototype` - sets the prototype to be used when cloning an object.
- *    (optional - defaults to parent prototype).
 */
-
-function clone(parent, circular, depth, prototype) {
-  // maintain two arrays for circular references, where corresponding parents
-  // and children have the same index
-  var allParents = [];
-  var allChildren = [];
-
-  var useBuffer = typeof Buffer != 'undefined';
-
+function clone(parent, circular) {
   if (typeof circular == 'undefined')
     circular = true;
+  var i;
+  if (circular) {
+    var circularParent = {};
+    var circularResolved = {};
+    var circularReplace = [];
+    function _clone(parent, context, child, cIndex) {
+      var i; // Use local context within this function
+      // Deep clone all properties of parent into child
+      if (typeof parent == 'object') {
+        if (parent == null)
+          return parent;
+        // Check for circular references
+        for(i in circularParent)
+          if (circularParent[i] === parent) {
+            // We found a circular reference
+            circularReplace.push({'resolveTo': i, 'child': child, 'i': 
cIndex});
+            return null; //Just return null for now...
+            // we will resolve circular references later
+          }
+
+        // Add to list of all parent objects
+        circularParent[context] = parent;
+        // Now continue cloning...
+        if (util.isArray(parent)) {
+          child = [];
+          for(i in parent)
+            child[i] = _clone(parent[i], context + '[' + i + ']', child, i);
+        }
+        else if (util.isDate(parent))
+          child = new Date(parent.getTime());
+        else if (util.isRegExp(parent))
+          child = new RegExp(parent.source);
+        else if (Buffer.isBuffer(parent))
+        {
+          child = new Buffer(parent.length);
+          parent.copy(child);
+        }
+        else {
+          child = {};
+
+          // Also copy prototype over to new cloned object
+          child.__proto__ = parent.__proto__;
+          for(i in parent)
+            child[i] = _clone(parent[i], context + '[' + i + ']', child, i);
+        }
 
-  if (typeof depth == 'undefined')
-    depth = Infinity;
-
-  // recurse this function so we don't reset allParents and allChildren
-  function _clone(parent, depth) {
-    // cloning null always returns null
-    if (parent === null)
-      return null;
-
-    if (depth == 0)
-      return parent;
-
-    var child;
-    if (typeof parent != 'object') {
-      return parent;
-    }
-
-    if (util.isArray(parent)) {
-      child = [];
-    } else if (util.isRegExp(parent)) {
-      child = new RegExp(parent.source, util.getRegExpFlags(parent));
-      if (parent.lastIndex) child.lastIndex = parent.lastIndex;
-    } else if (util.isDate(parent)) {
-      child = new Date(parent.getTime());
-    } else if (useBuffer && Buffer.isBuffer(parent)) {
-      child = new Buffer(parent.length);
-      parent.copy(child);
+        // Add to list of all cloned objects
+        circularResolved[context] = child;
+      }
+      else
+        child = parent; //Just a simple shallow copy will do
       return child;
-    } else {
-      if (typeof prototype == 'undefined') child = 
Object.create(Object.getPrototypeOf(parent));
-      else child = Object.create(prototype);
     }
 
-    if (circular) {
-      var index = allParents.indexOf(parent);
+    var cloned = _clone(parent, '*');
 
-      if (index != -1) {
-        return allChildren[index];
+    // Now this object has been cloned. Let's check to see if there are any
+    // circular references for it
+    for(i in circularReplace) {
+      var c = circularReplace[i];
+      if (c && c.child && c.i in c.child) {
+        c.child[c.i] = circularResolved[c.resolveTo];
       }
-      allParents.push(parent);
-      allChildren.push(child);
     }
-
-    for (var i in parent) {
-      child[i] = _clone(parent[i], depth - 1);
+    return cloned;
+  }
+  else {
+    // Deep clone all properties of parent into child
+    var child;
+    if (typeof parent == 'object') {
+      if (parent == null)
+        return parent;
+      if (parent.constructor.name === 'Array') {
+        child = [];
+        for(i in parent)
+          child[i] = clone(parent[i], circular);
+      }
+      else if (util.isDate(parent))
+        child = new Date(parent.getTime() );
+      else if (util.isRegExp(parent))
+        child = new RegExp(parent.source);
+      else {
+        child = {};
+        child.__proto__ = parent.__proto__;
+        for(i in parent)
+          child[i] = clone(parent[i], circular);
+      }
     }
-
+    else
+      child = parent; // Just a simple shallow clone will do
     return child;
   }
-
-  return _clone(parent, depth);
 }
 
-/**
- * Simple flat clone using prototype, accepts only objects, usefull for 
property
- * override on FLAT configuration object (no nested props).
- *
- * USE WITH CAUTION! This may not behave as you wish if you do not know how 
this
- * works.
- */
-clone.clonePrototype = function(parent) {
-  if (parent === null)
-    return null;
-
-  var c = function () {};
-  c.prototype = parent;
-  return new c();
-};
+// see: clonePrototype.js
+clone.clonePrototype = require('./clonePrototype.js');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/clonePrototype.js 
new/package/clonePrototype.js
--- old/package/clonePrototype.js       1970-01-01 01:00:00.000000000 +0100
+++ new/package/clonePrototype.js       2013-02-06 01:09:11.000000000 +0100
@@ -0,0 +1,17 @@
+/**
+ * Simple flat clone using prototype, accepts only objects, usefull for 
property
+ * override on FLAT configuration object (no nested props).
+ *
+ * USE WITH CAUTION! This may not behave as you wish if you do not know how 
this
+ * works.
+ */
+function clonePrototype(parent) {
+  if (parent === null)
+    return null;
+
+  var ctor = function () {};
+  ctor.prototype = parent;
+  return new ctor();
+}
+
+module.exports = clonePrototype;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/package.json new/package/package.json
--- old/package/package.json    2014-08-17 23:03:14.000000000 +0200
+++ new/package/package.json    2013-02-06 01:09:11.000000000 +0100
@@ -8,7 +8,7 @@
     "function",
     "date"
   ],
-  "version": "0.1.18",
+  "version": "0.1.5",
   "repository": {
     "type": "git",
     "url": "git://github.com/pvorb/node-clone.git"
@@ -17,7 +17,7 @@
     "url": "https://github.com/pvorb/node-clone/issues";
   },
   "main": "clone.js",
-  "author": "Paul Vorbach <[email protected]> (http://paul.vorba.ch/)",
+  "author": "Paul Vorbach <[email protected]> (http://vorb.de)",
   "contributors": [
     "Blake Miner <[email protected]> (http://www.blakeminer.com/)",
     "Tian You <[email protected]> (http://blog.axqd.net/)",
@@ -25,15 +25,8 @@
     "Tobiasz Cudnik <[email protected]> 
(https://github.com/TobiaszCudnik)",
     "Pavel Lang <[email protected]> (https://github.com/langpavel)",
     "Dan MacTough (http://yabfog.com/)",
-    "w1nk (https://github.com/w1nk)",
-    "Hugh Kennedy (http://twitter.com/hughskennedy)",
-    "Dustin Diaz (http://dustindiaz.com)",
-    "Ilya Shaisultanov (https://github.com/diversario)",
-    "Nathan MacInnes <[email protected]> (http://macinn.es/)",
-    "Benjamin E. Coe <[email protected]> (https://twitter.com/benjamincoe)",
-    "Nathan Zadoks (https://github.com/nathan7)"
+    "w1nk (https://github.com/w1nk)"
   ],
-  "license": "MIT",
   "engines": {
     "node": "*"
   },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/test.js new/package/test.js
--- old/package/test.js 2014-06-02 15:20:02.000000000 +0200
+++ new/package/test.js 2013-02-06 01:09:11.000000000 +0100
@@ -96,30 +96,6 @@
   test.done();
 };
 
-
-
-exports["clone regexp"] = function(test) {
-  test.expect(5);
-
-  var a = /abc123/gi;
-  var b = clone(a);
-
-  test.deepEqual(b, a);
-
-  var c = /a/g;
-  test.ok(c.lastIndex === 0);
-
-  c.exec('123a456a');
-  test.ok(c.lastIndex === 4);
-
-  var d = clone(c);
-  test.ok(d.global);
-  test.ok(d.lastIndex === 4);
-
-  test.done();
-};
-
-
 exports["clone object containing array"] = function(test) {
   test.expect(2); // how many tests?
 
@@ -215,57 +191,3 @@
   test.ok(a.foo, b.foo);
   test.done();
 }
-
-exports['clone object with depth argument'] = function (test) {
-  test.expect(6);
-  var a = {
-    foo: {
-      bar : {
-        baz : 'qux'
-      }
-    }
-  };
-  var b = clone(a, false, 1);
-  test.deepEqual(b, a);
-  test.notEqual(b, a);
-  test.strictEqual(b.foo, a.foo);
-
-  b = clone(a, true, 2);
-  test.deepEqual(b, a);
-  test.notEqual(b.foo, a.foo);
-  test.strictEqual(b.foo.bar, a.foo.bar);
-  test.done();
-}
-
-exports['maintain prototype chain in clones'] = function (test) {
-  test.expect(1);
-  function Constructor() {}
-  var a = new Constructor();
-  var b = clone(a);
-  test.strictEqual(Object.getPrototypeOf(a), Object.getPrototypeOf(b));
-  test.done();
-}
-
-exports['parent prototype is overriden with prototype provided'] = function 
(test) {
-  test.expect(1);
-  function Constructor() {}
-  var a = new Constructor();
-  var b = clone(a, true, Infinity, null);
-  test.strictEqual(b.__defineSetter__, undefined);
-  test.done();
-}
-
-exports['clone object with null children'] = function(test) {
-  test.expect(1);
-  var a = {
-    foo: {
-      bar: null,
-      baz: {
-        qux: false
-      }
-    }
-  };
-  var b = clone(a);
-  test.deepEqual(b, a);
-  test.done();
-}


Reply via email to