initial commit
This commit is contained in:
19
node_modules/defined/.eslintrc
generated
vendored
Normal file
19
node_modules/defined/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"consistent-return": 1,
|
||||
"sort-keys": 0,
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "example/**",
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
12
node_modules/defined/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/defined/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/defined
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
46
node_modules/defined/CHANGELOG.md
generated
vendored
Normal file
46
node_modules/defined/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.0.1](https://github.com/ljharb/defined/compare/v1.0.0...v1.0.1) - 2022-10-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [eslint] fix indentation [`84801c0`](https://github.com/ljharb/defined/commit/84801c054280c86c433022be64feddf38ac426aa)
|
||||
- [readme] rename, add badges [`7ccb011`](https://github.com/ljharb/defined/commit/7ccb011e69adda93a923408819730848ed9328cc)
|
||||
- [actions] add reusable workflows [`03917f0`](https://github.com/ljharb/defined/commit/03917f0a2a1123f71bd6a1e2d48802051614bda4)
|
||||
- [Dev Deps] update `tape` [`ac57011`](https://github.com/ljharb/defined/commit/ac57011cb753bf1f3937569b16f76a22ea6e9230)
|
||||
- [eslint] add eslint [`9bf7583`](https://github.com/ljharb/defined/commit/9bf7583959cb02ed2feac6d3781965921d2220f8)
|
||||
- [meta] add `auto-changelog` [`ec13b5f`](https://github.com/ljharb/defined/commit/ec13b5f04eb2273e6708bb8ac00e29b109880b07)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`549e1ff`](https://github.com/ljharb/defined/commit/549e1ff99822f86ec6394dcb4540a4ee596e7433)
|
||||
- Only apps should have lockfiles [`11dfedc`](https://github.com/ljharb/defined/commit/11dfedcd1cf1471fac56763064471f0093aa841f)
|
||||
- [meta] add `safe-publish-latest` [`efadc76`](https://github.com/ljharb/defined/commit/efadc76397fcfb4435934dab7c8a744bc831c38f)
|
||||
- [meta] update URLs [`aa9c486`](https://github.com/ljharb/defined/commit/aa9c48684a74611afaa50ae4429832cd39616812)
|
||||
- [Tests] add `aud` in `posttest` [`a0cf2fb`](https://github.com/ljharb/defined/commit/a0cf2fb66a61870e0657c4f41ba0893abfef77a1)
|
||||
- [meta] create FUNDING.yml; add `funding` in package.json [`b05fc5e`](https://github.com/ljharb/defined/commit/b05fc5e478baeb12822978e38232c8b8daf60c29)
|
||||
|
||||
## [v1.0.0](https://github.com/ljharb/defined/compare/v0.0.0...v1.0.0) - 2015-03-30
|
||||
|
||||
### Commits
|
||||
|
||||
- using testling-ci [`9f11918`](https://github.com/ljharb/defined/commit/9f11918b7dffb639fc960da7c8a5914d7df67e80)
|
||||
- Bump to 1.0.0 + newer tape [`3a46c81`](https://github.com/ljharb/defined/commit/3a46c81d39b5f94c0c17c47638939af2528520f3)
|
||||
- another test [`5c825a7`](https://github.com/ljharb/defined/commit/5c825a710662cab0b8abb37132cae19d0dcf00cb)
|
||||
- using travis [`4dabaf5`](https://github.com/ljharb/defined/commit/4dabaf53092665b36961a0b82a00d818051d69db)
|
||||
- use tape 0.2.2 [`1337250`](https://github.com/ljharb/defined/commit/1337250d7f0f7f63ebc864ad509ce1247978b451)
|
||||
- bump [`07dbbbf`](https://github.com/ljharb/defined/commit/07dbbbfa155c91e9ab09da07af797738340c7338)
|
||||
- bump [`1a6fde3`](https://github.com/ljharb/defined/commit/1a6fde32136c51b4b8d8664d2b6072d241e5b4ae)
|
||||
|
||||
## v0.0.0 - 2012-11-25
|
||||
|
||||
### Commits
|
||||
|
||||
- docs, example, and code ripped from the tape module [`6bec2cc`](https://github.com/ljharb/defined/commit/6bec2cc9c82f19c2960f344b5141154d6eaa7380)
|
||||
- package.json whatevs [`ac951cd`](https://github.com/ljharb/defined/commit/ac951cd1dd31b7944fe3b539f091766bfb178e00)
|
||||
- passing test [`d6e0c87`](https://github.com/ljharb/defined/commit/d6e0c87982c76f4889541d8ed57a463c259fec2c)
|
||||
- oh right tape [`e3f9596`](https://github.com/ljharb/defined/commit/e3f9596dcc4c5e2a2657fda5f5cad2b9957d705f)
|
||||
- note about perl 5.10 [`6eba8e6`](https://github.com/ljharb/defined/commit/6eba8e6a2927a5d8b748d422ad7e64b977ab4f94)
|
||||
- -bin [`fbf0d20`](https://github.com/ljharb/defined/commit/fbf0d20d9cec86266ed06e8fe4f5b9927917a3c5)
|
||||
18
node_modules/defined/LICENSE
generated
vendored
Normal file
18
node_modules/defined/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
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
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
72
node_modules/defined/README.md
generated
vendored
Normal file
72
node_modules/defined/README.md
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# defined <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
return the first argument that is `!== undefined`
|
||||
|
||||
Most of the time when I chain together `||`s, I actually just want the first
|
||||
item that is not `undefined`, not the first non-falsy item.
|
||||
|
||||
This module is like the defined-or (`//`) operator in perl 5.10+.
|
||||
|
||||
# example
|
||||
|
||||
``` js
|
||||
var defined = require('defined');
|
||||
var opts = { y : false, w : 4 };
|
||||
var x = defined(opts.x, opts.y, opts.w, 100);
|
||||
console.log(x);
|
||||
```
|
||||
|
||||
```
|
||||
$ node example/defined.js
|
||||
false
|
||||
```
|
||||
|
||||
The return value is `false` because `false` is the first item that is
|
||||
`!== undefined`.
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var defined = require('defined')
|
||||
```
|
||||
|
||||
## var x = defined(a, b, c...)
|
||||
|
||||
Return the first item in the argument list `a, b, c...` that is `!== undefined`.
|
||||
|
||||
If all the items are `=== undefined`, return undefined.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install defined
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
|
||||
[package-url]: https://npmjs.org/package/defined
|
||||
[npm-version-svg]: https://versionbadg.es/inspect-js/defined.svg
|
||||
[deps-svg]: https://david-dm.org/inspect-js/defined.svg
|
||||
[deps-url]: https://david-dm.org/inspect-js/defined
|
||||
[dev-deps-svg]: https://david-dm.org/inspect-js/defined/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/inspect-js/defined#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/defined.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/defined.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/defined.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=defined
|
||||
[codecov-image]: https://codecov.io/gh/inspect-js/defined/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/inspect-js/defined/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/defined
|
||||
[actions-url]: https://github.com/inspect-js/defined/actions
|
||||
6
node_modules/defined/example/defined.js
generated
vendored
Normal file
6
node_modules/defined/example/defined.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var defined = require('../');
|
||||
var opts = { y: false, w: 4 };
|
||||
var x = defined(opts.x, opts.y, opts.w, 8);
|
||||
console.log(x);
|
||||
9
node_modules/defined/index.js
generated
vendored
Normal file
9
node_modules/defined/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defined() {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (typeof arguments[i] !== 'undefined') {
|
||||
return arguments[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
93
node_modules/defined/package.json
generated
vendored
Normal file
93
node_modules/defined/package.json
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"name": "defined",
|
||||
"version": "1.0.1",
|
||||
"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",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"eslint": "=8.8.0",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.0",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.6.1"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "tape 'test/**/*.js'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"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/inspect-js/defined.git"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/defined",
|
||||
"keywords": [
|
||||
"undefined",
|
||||
"short-circuit",
|
||||
"||",
|
||||
"or",
|
||||
"//",
|
||||
"defined-or"
|
||||
],
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
||||
24
node_modules/defined/test/def.js
generated
vendored
Normal file
24
node_modules/defined/test/def.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var defined = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('defined-or', function (t) {
|
||||
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(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.end();
|
||||
});
|
||||
11
node_modules/defined/test/falsy.js
generated
vendored
Normal file
11
node_modules/defined/test/falsy.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user