Use == false instead of === false for all options that default to true.

These expression are true:
- false == false
- false == 0
While these are false:
- false == null
- false == undefined
This commit is contained in:
Jürg Lehni 2017-03-22 14:42:11 +01:00
parent dd56f86679
commit ffa7e16f48
8 changed files with 9 additions and 8 deletions

View file

@ -7,6 +7,7 @@
"supernew": true,
"laxbreak": true,
"eqeqeq": false,
"-W041": false,
"eqnull": true,
"loopfunc": true,
"boss": true,

View file

@ -528,7 +528,7 @@ Base.inject(/** @lends Base# */{
exportJSON: function(obj, options) {
var json = Base.serialize(obj, options);
return options && options.asString === false
return options && options.asString == false
? json
: JSON.stringify(json);
},

View file

@ -90,7 +90,7 @@ var Emitter = {
if (setTarget)
event.currentTarget = this;
for (var i = 0, l = handlers.length; i < l; i++) {
if (handlers[i].apply(this, args) === false) {
if (handlers[i].apply(this, args) == false) {
// If the handler returns false, prevent the default behavior
// and stop propagation of the event by calling stop()
if (event && event.stop)

View file

@ -154,7 +154,7 @@ new function() { // Injection scope for various item event handlers
this._style = new Style(project._currentStyle, this, project);
// Do not add to the project if it's an internal path, or if
// props.insert or settings.isnertItems is false.
if (internal || hasProps && props.insert === false
if (internal || hasProps && props.insert == false
|| !settings.insertItems && !(hasProps && props.insert === true)) {
this._setProject(project);
} else {

View file

@ -22,7 +22,7 @@ Path.inject({ statics: new function() {
function createPath(segments, closed, args) {
var props = Base.getNamed(args),
path = new Path(props && props.insert === false && Item.NO_INSERT);
path = new Path(props && props.insert == false && Item.NO_INSERT);
path._add(segments);
// No need to use setter for _closed since _add() called _changed().
path._closed = closed;
@ -335,7 +335,7 @@ Path.inject({ statics: new function() {
to = Point.readNamed(arguments, 'to'),
props = Base.getNamed(arguments),
// See createPath() for an explanation of the following sequence
path = new Path(props && props.insert === false
path = new Path(props && props.insert == false
&& Item.NO_INSERT);
path.moveTo(from);
path.arcTo(through, to);

View file

@ -67,7 +67,7 @@ PathItem.inject(new function() {
// See if the item can be reduced to just a simple Path.
if (reduce)
result = result.reduce({ simplify: true });
if (!(options && options.insert === false)) {
if (!(options && options.insert == false)) {
// Insert the resulting path above whichever of the two paths appear
// further up in the stack.
result.insertAbove(path2 && path1.isSibling(path2)

View file

@ -95,7 +95,7 @@ new function() {
attrs.y -= size.height / 2;
attrs.width = size.width;
attrs.height = size.height;
attrs.href = options.embedImages === false && image && image.src
attrs.href = options.embedImages == false && image && image.src
|| item.toDataURL();
return SvgElement.create('image', attrs, formatter);
}

View file

@ -97,7 +97,7 @@ test('SymbolDefinition item selection', function() {
path.selected = true;
var definition = new SymbolDefinition(path);
equals(function() {
return definition.item.selected === false;
return definition.item.selected == false;
}, true);
equals(function() {
return paper.project.selectedItems.length === 0;