@bbn/bbn 1.0.279 → 1.0.280

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ export default function analyzeFunction(fn: any): {
14
14
  hasFunction: boolean;
15
15
  name: string;
16
16
  isAsync: boolean;
17
+ isBinary: boolean;
17
18
  hash: string;
18
19
  returnType: string;
19
20
  };
@@ -29,6 +29,7 @@ export default function analyzeFunction(fn) {
29
29
  var isComment = false;
30
30
  var isCommentLine = false;
31
31
  var isDestructuring = false;
32
+ var isBinary = false;
32
33
  var returnType = "";
33
34
  for (var i = 0; i < all.length; i++) {
34
35
  // Handle string literals
@@ -202,6 +203,9 @@ export default function analyzeFunction(fn) {
202
203
  throw Error("Unexpected end of function while parsing function");
203
204
  }
204
205
  }
206
+ if (body === '{ [native code] }') {
207
+ isBinary = true;
208
+ }
205
209
  var argString = args
206
210
  .map(function (arg) { return arg.name + (arg.default ? " = " + arg.default : ""); })
207
211
  .join(", ");
@@ -214,6 +218,7 @@ export default function analyzeFunction(fn) {
214
218
  hasFunction: hasFunction,
215
219
  name: name,
216
220
  isAsync: isAsync,
221
+ isBinary: isBinary,
217
222
  hash: hash,
218
223
  returnType: returnType
219
224
  };
@@ -71,7 +71,12 @@ export default function isSame(obj1, obj2, done) {
71
71
  else if (obj1 && obj2 && typeof obj1 === 'function' && typeof obj2 === 'function') {
72
72
  var tmp1 = analyzeFunction(obj1);
73
73
  var tmp2 = analyzeFunction(obj2);
74
- return tmp1.hash === tmp2.hash;
74
+ var isSame_1 = tmp1.hash === tmp2.hash;
75
+ // If native code better to replace
76
+ if (isSame_1 && tmp1.isBinary) {
77
+ isSame_1 = false;
78
+ }
79
+ return isSame_1;
75
80
  }
76
81
  return false;
77
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.279",
3
+ "version": "1.0.280",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",