Skip to content

Commit

Permalink
Merge pull request #344 from agsh/remove-lodash
Browse files Browse the repository at this point in the history
Remove lodash.get dependency, minimal node version is 14
  • Loading branch information
agsh authored Oct 28, 2024
2 parents a4a7619 + 068cc6f commit 9c59e9d
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 173 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"node": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
"node/no-deprecated-api": 0,
"no-console": 0,
Expand Down
11 changes: 5 additions & 6 deletions lib/ptz.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
module.exports = function(Cam) {

const linerase = require('./utils').linerase;
const _get = require('lodash.get');

/**
* Receive cam presets
Expand Down Expand Up @@ -176,12 +175,12 @@ module.exports = function(Cam) {
}, function(err, data, xml) {
if (!err) {
// Some cameras have Pan/Tilt but no Zoom
var res = linerase(data).getStatusResponse.PTZStatus;
const res = linerase(data).getStatusResponse.PTZStatus;
var status = {
position: {
x: _get(res, 'position.panTilt.$.x', 0)
, y: _get(res, 'position.panTilt.$.y', 0)
, zoom: _get(res, 'position.zoom.$.x', 0)
x: res.position?.panTilt?.$?.x ?? 0
, y: res.position?.panTilt?.$?.y ?? 0
, zoom: res.position?.zoom?.$?.x ?? 0
}
, moveStatus: res.moveStatus
, error: res.error
Expand Down Expand Up @@ -601,5 +600,5 @@ module.exports = function(Cam) {
}
}.bind(this));
};

};
Loading

0 comments on commit 9c59e9d

Please sign in to comment.