update
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Troy Goode <troygoode@gmail.com>
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "nodemon",
|
||||
"homepage": "https://nodemon.io",
|
||||
"author": {
|
||||
"name": "Remy Sharp",
|
||||
"url": "https://github.com/remy"
|
||||
},
|
||||
"bin": {
|
||||
"nodemon": "./bin/nodemon.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/remy/nodemon.git"
|
||||
},
|
||||
"description": "Simple monitor script for use during development of a Node.js app.",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"monitor",
|
||||
"monitor",
|
||||
"development",
|
||||
"restart",
|
||||
"autoload",
|
||||
"reload",
|
||||
"terminal"
|
||||
],
|
||||
"license": "MIT",
|
||||
"types": "./index.d.ts",
|
||||
"main": "./lib/nodemon",
|
||||
"scripts": {
|
||||
"commitmsg": "commitlint -e",
|
||||
"coverage": "istanbul cover _mocha -- --timeout 30000 --ui bdd --reporter list test/**/*.test.js",
|
||||
"lint": "eslint lib/**/*.js",
|
||||
"test": "npm run lint && npm run spec",
|
||||
"spec": "for FILE in test/**/*.test.js; do echo $FILE; TEST=1 mocha --exit --timeout 30000 $FILE; if [ $? -ne 0 ]; then exit 1; fi; sleep 1; done",
|
||||
"postspec": "npm run clean",
|
||||
"clean": "rm -rf test/fixtures/test*.js test/fixtures/test*.md",
|
||||
"web": "node web",
|
||||
"semantic-release": "semantic-release",
|
||||
"prepush": "npm run lint",
|
||||
"killall": "ps auxww | grep node | grep -v grep | awk '{ print $2 }' | xargs kill -9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^11.0.0",
|
||||
"@commitlint/config-conventional": "^11.0.0",
|
||||
"async": "1.4.2",
|
||||
"coffee-script": "~1.7.1",
|
||||
"eslint": "^7.32.0",
|
||||
"husky": "^7.0.4",
|
||||
"mocha": "^2.5.3",
|
||||
"nyc": "^15.1.0",
|
||||
"proxyquire": "^1.8.0",
|
||||
"semantic-release": "^18.0.0",
|
||||
"should": "~4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"chokidar": "^3.5.2",
|
||||
"debug": "^4",
|
||||
"ignore-by-default": "^1.0.1",
|
||||
"minimatch": "^3.1.2",
|
||||
"pstree.remy": "^1.1.8",
|
||||
"semver": "^7.5.3",
|
||||
"simple-update-notifier": "^2.0.0",
|
||||
"supports-color": "^5.5.0",
|
||||
"touch": "^3.1.0",
|
||||
"undefsafe": "^2.0.5"
|
||||
},
|
||||
"version": "3.1.10",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/nodemon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-present, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,63 @@
|
||||
# undefsafe
|
||||
|
||||
Simple *function* for retrieving deep object properties without getting "Cannot read property 'X' of undefined"
|
||||
|
||||
Can also be used to safely set deep values.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var object = {
|
||||
a: {
|
||||
b: {
|
||||
c: 1,
|
||||
d: [1,2,3],
|
||||
e: 'remy'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
console.log(undefsafe(object, 'a.b.e')); // "remy"
|
||||
console.log(undefsafe(object, 'a.b.not.found')); // undefined
|
||||
```
|
||||
|
||||
Demo: [https://jsbin.com/eroqame/3/edit?js,console](https://jsbin.com/eroqame/3/edit?js,console)
|
||||
|
||||
## Setting
|
||||
|
||||
```js
|
||||
var object = {
|
||||
a: {
|
||||
b: [1,2,3]
|
||||
}
|
||||
};
|
||||
|
||||
// modified object
|
||||
var res = undefsafe(object, 'a.b.0', 10);
|
||||
|
||||
console.log(object); // { a: { b: [10, 2, 3] } }
|
||||
console.log(res); // 1 - previous value
|
||||
```
|
||||
|
||||
## Star rules in paths
|
||||
|
||||
As of 1.2.0, `undefsafe` supports a `*` in the path if you want to search all of the properties (or array elements) for a particular element.
|
||||
|
||||
The function will only return a single result, either the 3rd argument validation value, or the first positive match. For example, the following github data:
|
||||
|
||||
```js
|
||||
const githubData = {
|
||||
commits: [{
|
||||
modified: [
|
||||
"one",
|
||||
"two"
|
||||
]
|
||||
}, /* ... */ ]
|
||||
};
|
||||
|
||||
// first modified file found in the first commit
|
||||
console.log(undefsafe(githubData, 'commits.*.modified.0'));
|
||||
|
||||
// returns `two` or undefined if not found
|
||||
console.log(undefsafe(githubData, 'commits.*.modified.*', 'two'));
|
||||
```
|
||||
Reference in New Issue
Block a user