Skip to content

Commit

Permalink
[eslint] fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Oct 12, 2022
1 parent 9bf7583 commit 84801c0
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 89 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Expand Up @@ -5,7 +5,6 @@

"rules": {
"consistent-return": 1,
"indent": [2, 4],
"sort-keys": 0,
},

Expand Down
10 changes: 5 additions & 5 deletions index.js
@@ -1,9 +1,9 @@
'use strict';

module.exports = function defined() {
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] !== 'undefined') {
return arguments[i];
}
}
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] !== 'undefined') {
return arguments[i];
}
}
};
132 changes: 66 additions & 66 deletions package.json
@@ -1,68 +1,68 @@
{
"name": "defined",
"version": "1.0.0",
"description": "return the first argument that is `!== undefined`",
"main": "index.js",
"directories": {
"example": "example",
"test": "test"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.0.0",
"aud": "^2.0.1",
"eslint": "=8.8.0",
"tape": "^5.6.1"
},
"scripts": {
"lint": "eslint --ext=js,mjs .",
"pretest": "npm run lint",
"tests-only": "tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "aud --production"
},
"testling": {
"files": "test/*.js",
"browsers": {
"ie": [
6,
7,
8,
9
],
"ff": [
3.5,
10,
15
],
"chrome": [
10,
22
],
"safari": [
5.1
],
"opera": [
12
]
}
},
"repository": {
"type": "git",
"url": "git://github.com/substack/defined.git"
},
"homepage": "https://github.com/substack/defined",
"keywords": [
"undefined",
"short-circuit",
"||",
"or",
"//",
"defined-or"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT"
"name": "defined",
"version": "1.0.0",
"description": "return the first argument that is `!== undefined`",
"main": "index.js",
"directories": {
"example": "example",
"test": "test"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.0.0",
"aud": "^2.0.1",
"eslint": "=8.8.0",
"tape": "^5.6.1"
},
"scripts": {
"lint": "eslint --ext=js,mjs .",
"pretest": "npm run lint",
"tests-only": "tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "aud --production"
},
"testling": {
"files": "test/*.js",
"browsers": {
"ie": [
6,
7,
8,
9
],
"ff": [
3.5,
10,
15
],
"chrome": [
10,
22
],
"safari": [
5.1
],
"opera": [
12
]
}
},
"repository": {
"type": "git",
"url": "git://github.com/substack/defined.git"
},
"homepage": "https://github.com/substack/defined",
"keywords": [
"undefined",
"short-circuit",
"||",
"or",
"//",
"defined-or"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT"
}
26 changes: 13 additions & 13 deletions test/def.js
Expand Up @@ -4,21 +4,21 @@ var defined = require('../');
var test = require('tape');

test('defined-or', function (t) {
var u = void undefined;
var u = void undefined;

t.equal(defined(), u, 'empty arguments');
t.equal(defined(u), u, '1 undefined');
t.equal(defined(u, u), u, '2 undefined');
t.equal(defined(u, u, u, u), u, '4 undefineds');
t.equal(defined(), u, 'empty arguments');
t.equal(defined(u), u, '1 undefined');
t.equal(defined(u, u), u, '2 undefined');
t.equal(defined(u, u, u, u), u, '4 undefineds');

t.equal(defined(undefined, false, true), false, 'false[0]');
t.equal(defined(false, true), false, 'false[1]');
t.equal(defined(undefined, 0, true), 0, 'zero[0]');
t.equal(defined(0, true), 0, 'zero[1]');
t.equal(defined(undefined, false, true), false, 'false[0]');
t.equal(defined(false, true), false, 'false[1]');
t.equal(defined(undefined, 0, true), 0, 'zero[0]');
t.equal(defined(0, true), 0, 'zero[1]');

t.equal(defined(3, undefined, 4), 3, 'first arg');
t.equal(defined(undefined, 3, 4), 3, 'second arg');
t.equal(defined(undefined, undefined, 3), 3, 'third arg');
t.equal(defined(3, undefined, 4), 3, 'first arg');
t.equal(defined(undefined, 3, 4), 3, 'second arg');
t.equal(defined(undefined, undefined, 3), 3, 'third arg');

t.end();
t.end();
});
8 changes: 4 additions & 4 deletions test/falsy.js
Expand Up @@ -4,8 +4,8 @@ var test = require('tape');
var defined = require('../');

test('falsy', function (t) {
t.plan(1);
var opts = { y: false, w: 4 };
var x = defined(opts.x, opts.y, opts.w, 8);
t.equal(x, false);
t.plan(1);
var opts = { y: false, w: 4 };
var x = defined(opts.x, opts.y, opts.w, 8);
t.equal(x, false);
});

0 comments on commit 84801c0

Please sign in to comment.