power-assert-renderer-comparison
Advanced tools
Comparing version 0.1.0 to 1.0.0
41
index.js
@@ -6,6 +6,8 @@ 'use strict'; | ||
var typeName = require('type-name'); | ||
var keys = Object.keys || require('object-keys'); | ||
var forEach = require('array-foreach'); | ||
var keys = require('core-js/library/fn/object/keys'); | ||
var forEach = require('core-js/library/fn/array/for-each'); | ||
var udiff = require('./lib/udiff'); | ||
var stringifier = require('stringifier'); | ||
var assign = require('core-js/library/fn/object/assign'); | ||
var defaultOptions = require('./lib/default-options'); | ||
var literalPattern = /^(?:String|Numeric|Null|Boolean|RegExp)?Literal$/; | ||
@@ -17,4 +19,15 @@ | ||
/** | ||
* options.stringify [function] | ||
* options.maxDepth [number] | ||
* options.lineSeparator [string] | ||
* options.anonymous [string] | ||
* options.circular [string] | ||
* | ||
* options.diff [function] | ||
* options.lineDiffThreshold [number] | ||
*/ | ||
function ComparisonRenderer (config) { | ||
BaseRenderer.call(this, config); | ||
BaseRenderer.call(this); | ||
this.config = assign({}, defaultOptions(), config); | ||
if (typeof this.config.stringify !== 'function') { | ||
@@ -32,15 +45,15 @@ this.stringify = stringifier(this.config); | ||
var pair; | ||
if (!esNode.isCaptured()) { | ||
if (isTargetBinaryExpression(esNode.getParent()) && isLiteral(esNode.currentNode)) { | ||
this.espathToPair[esNode.parentEspath][esNode.currentProp] = {code: esNode.code(), value: esNode.value()}; | ||
if (!esNode.isCaptured) { | ||
if (isTargetBinaryExpression(esNode.parent) && isLiteral(esNode.node)) { | ||
this.espathToPair[esNode.parent.espath][esNode.key] = {code: esNode.code, value: esNode.value}; | ||
} | ||
return; | ||
} | ||
if (isTargetBinaryExpression(esNode.getParent())) { | ||
this.espathToPair[esNode.parentEspath][esNode.currentProp] = {code: esNode.code(), value: esNode.value()}; | ||
if (isTargetBinaryExpression(esNode.parent)) { | ||
this.espathToPair[esNode.parent.espath][esNode.key] = {code: esNode.code, value: esNode.value}; | ||
} | ||
if (isTargetBinaryExpression(esNode)) { | ||
pair = { | ||
operator: esNode.currentNode.operator, | ||
value: esNode.value() | ||
operator: esNode.node.operator, | ||
value: esNode.value | ||
}; | ||
@@ -90,6 +103,6 @@ this.espathToPair[esNode.espath] = pair; | ||
return esNode && | ||
esNode.currentNode.type === 'BinaryExpression' && | ||
(esNode.currentNode.operator === '===' || esNode.currentNode.operator === '==') && | ||
esNode.isCaptured() && | ||
!(esNode.value()); | ||
esNode.node.type === 'BinaryExpression' && | ||
(esNode.node.operator === '===' || esNode.node.operator === '==') && | ||
esNode.isCaptured && | ||
!(esNode.value); | ||
} | ||
@@ -96,0 +109,0 @@ |
{ | ||
"name": "power-assert-renderer-comparison", | ||
"description": "comparison renderer for power-assert context", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"author": { | ||
@@ -14,7 +14,6 @@ "name": "Takuto Wada", | ||
"dependencies": { | ||
"array-foreach": "^1.0.1", | ||
"core-js": "^2.0.0", | ||
"googlediff": "^0.1.0", | ||
"object-keys": "^1.0.4", | ||
"power-assert-renderer-base": "^0.1.0", | ||
"stringifier": "^1.2.1", | ||
"stringifier": "^1.3.0", | ||
"type-name": "^2.0.1" | ||
@@ -21,0 +20,0 @@ }, |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8601
5
5
143
0
0
110
+ Addedcore-js@^2.0.0
- Removedarray-foreach@^1.0.1
- Removedobject-keys@^1.0.4
- Removedarray-foreach@1.0.2(transitive)
Updatedstringifier@^1.3.0