Skip to content

Commit

Permalink
deepmerge => lodash.merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed Dec 1, 2021
1 parent 4be7314 commit e90177f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
30 changes: 14 additions & 16 deletions lib/index.js
Expand Up @@ -11,7 +11,7 @@ const path = require('path')
const punycode = require('punycode/')
const got = require('got')
const escapeRe = require('escape-string-regexp')
const merge = require('deepmerge')
const merge = require('lodash.merge')
const UnshortError = require('./error')
const pkg = require('../package.json')

Expand Down Expand Up @@ -40,20 +40,18 @@ function Unshort (options) {

options = options || {}

this._options = merge.all(
[
{
timeout: 30 * 1000,
retries: 1,
followRedirect: false, // redirects are handled manually
maxBuffer: 1000 * 1024, // too big reply -> not redirect
headers: {
'User-Agent': defaultAgent
}
},
options.request || {}
],
{ clone: true }
this._options = merge(
{},
{
timeout: 30 * 1000,
retries: 1,
followRedirect: false, // redirects are handled manually
maxBuffer: 1000 * 1024, // too big reply -> not redirect
headers: {
'User-Agent': defaultAgent
}
},
options.request || {}
)

// config data with compiled regexps and fetch functions attached
Expand Down Expand Up @@ -153,7 +151,7 @@ Unshort.prototype.add = function (domain, options) {
// replace this with a stub).
//
Unshort.prototype.request = function (url, options) {
const opts = merge.all([{}, this._options, options || {}], { clone: true })
const opts = merge({}, this._options, options || {})

return got(url, opts)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -21,11 +21,11 @@
],
"dependencies": {
"cheerio": "^0.22.0",
"deepmerge": "^1.3.1",
"escape-string-regexp": "^4.0.0",
"got": "^11.8.3",
"is-google-domain": "^1.0.0",
"js-yaml": "^4.1.0",
"lodash.merge": "^4.6.2",
"mdurl": "^1.0.0",
"punycode": "^2.0.1"
},
Expand Down

0 comments on commit e90177f

Please sign in to comment.