@metascraper/helpers 5.24.2 → 5.24.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -2
  2. package/package.json +6 -7
package/index.js CHANGED
@@ -34,7 +34,6 @@ const iso6393 = require('iso-639-3/to-1')
34
34
  const mimeTypes = require('mime-types')
35
35
  const hasValues = require('has-values')
36
36
  const chrono = require('chrono-node')
37
- const truncate = require('truncate')
38
37
  const isIso = require('isostring')
39
38
  const isUri = require('is-uri')
40
39
  const { URL } = require('url')
@@ -211,7 +210,11 @@ const getDescription = (
211
210
  str,
212
211
  { truncateLength = TRUNCATE_MAX_LENGTH, ...opts } = {}
213
212
  ) => {
214
- const description = removeLocation(truncate(str, truncateLength))
213
+ let truncatedStr = str.slice(0, truncateLength)
214
+ if (truncatedStr.length < str.length) {
215
+ truncatedStr = truncatedStr.trim() + '…'
216
+ }
217
+ const description = removeLocation(truncatedStr)
215
218
  return titleize(description, opts)
216
219
  }
217
220
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@metascraper/helpers",
3
3
  "description": "Collection of helper functions used by metascraper",
4
4
  "homepage": "https://nicedoc.io/microlinkhq/metascraper/packages/metascraper-helpers",
5
- "version": "5.24.2",
5
+ "version": "5.24.9",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -23,9 +23,9 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "audio-extensions": "0.0.0",
26
- "chrono-node": "2.3.1",
26
+ "chrono-node": "2.3.2",
27
27
  "condense-whitespace": "~2.0.0",
28
- "entities": "~3.0.0",
28
+ "entities": "~3.0.1",
29
29
  "file-extension": "~4.0.5",
30
30
  "has-values": "~2.0.1",
31
31
  "image-extensions": "~1.1.0",
@@ -33,14 +33,13 @@
33
33
  "is-uri": "~1.2.0",
34
34
  "iso-639-3": "~2.2.0",
35
35
  "isostring": "0.0.1",
36
- "jsdom": "~17.0.0",
36
+ "jsdom": "~18.0.0",
37
37
  "lodash": "~4.17.21",
38
38
  "memoize-one": "~5.2.1",
39
39
  "microsoft-capitalize": "~1.0.5",
40
- "mime-types": "~2.1.31",
40
+ "mime-types": "~2.1.33",
41
41
  "normalize-url": "~6.1.0",
42
42
  "smartquotes": "~2.3.2",
43
- "truncate": "~2.1.0",
44
43
  "url-regex-safe": "~2.0.2",
45
44
  "video-extensions": "~1.2.0"
46
45
  },
@@ -64,5 +63,5 @@
64
63
  "publishConfig": {
65
64
  "access": "public"
66
65
  },
67
- "gitHead": "d48d824d82847c79312475593585169c043969e0"
66
+ "gitHead": "cc6de681c5c24bcd4944975cd6effbcfc6e2bd50"
68
67
  }