@ndla/video-search 4.1.43 → 4.1.46

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.
package/lib/index.js CHANGED
@@ -6,5 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _VideoSearch = _interopRequireDefault(require("./VideoSearch"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- var _default = _VideoSearch.default;
10
- exports.default = _default;
9
+ /**
10
+ * Copyright (c) 2017-present, NDLA.
11
+ *
12
+ * This source code is licensed under the GPLv3 license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ *
15
+ */
16
+ var _default = exports.default = _VideoSearch.default;
package/lib/shapes.js CHANGED
@@ -14,15 +14,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
14
14
  *
15
15
  */
16
16
 
17
- var LicenseShape = _propTypes.default.shape({
17
+ const LicenseShape = exports.LicenseShape = _propTypes.default.shape({
18
18
  short: _propTypes.default.string.isRequired,
19
19
  title: _propTypes.default.string.isRequired,
20
20
  userFriendlyTitle: _propTypes.default.string.isRequired,
21
21
  description: _propTypes.default.string.isRequired,
22
22
  rights: _propTypes.default.arrayOf(_propTypes.default.string).isRequired
23
23
  });
24
- exports.LicenseShape = LicenseShape;
25
- var BrightcoveShape = _propTypes.default.shape({
24
+ const BrightcoveShape = exports.BrightcoveShape = _propTypes.default.shape({
26
25
  id: _propTypes.default.string.isRequired,
27
26
  name: _propTypes.default.string.isRequired,
28
27
  custom_fields: _propTypes.default.shape({
@@ -35,8 +34,7 @@ var BrightcoveShape = _propTypes.default.shape({
35
34
  })
36
35
  })
37
36
  });
38
- exports.BrightcoveShape = BrightcoveShape;
39
- var YouTubeShape = _propTypes.default.shape({
37
+ const YouTubeShape = exports.YouTubeShape = _propTypes.default.shape({
40
38
  pagemap: _propTypes.default.shape({
41
39
  videoobject: _propTypes.default.arrayOf(_propTypes.default.shape({
42
40
  name: _propTypes.default.string.isRequired,
@@ -49,5 +47,4 @@ var YouTubeShape = _propTypes.default.shape({
49
47
  datepublished: _propTypes.default.string.isRequired
50
48
  }))
51
49
  })
52
- });
53
- exports.YouTubeShape = YouTubeShape;
50
+ });
@@ -12,11 +12,10 @@ exports.youTubeDurationToSeconds = exports.setYouTubeDuration = exports.setLocal
12
12
  *
13
13
  */
14
14
 
15
- var getLastPage = function getLastPage(search, type) {
15
+ const getLastPage = (search, type) => {
16
16
  if (type === 'youtube') {
17
- var _search$queries, _search$queries$reque;
18
- if ((search === null || search === void 0 ? void 0 : (_search$queries = search.queries) === null || _search$queries === void 0 ? void 0 : (_search$queries$reque = _search$queries.request) === null || _search$queries$reque === void 0 ? void 0 : _search$queries$reque.length) > 0) {
19
- var request = search.queries.request[0];
17
+ if (search?.queries?.request?.length > 0) {
18
+ const request = search.queries.request[0];
20
19
  if (request.totalResults && request.count) {
21
20
  return Math.ceil(request.totalResults / request.count);
22
21
  }
@@ -26,17 +25,17 @@ var getLastPage = function getLastPage(search, type) {
26
25
  return 0;
27
26
  };
28
27
  exports.getLastPage = getLastPage;
29
- var youTubeDurationToSeconds = function youTubeDurationToSeconds(duration) {
30
- var match = duration.match(/PT(\d+H)?(\d+M)?(\d+S)?/);
31
- var hours = parseInt(match[1], 10) || 0;
32
- var minutes = parseInt(match[2], 10) || 0;
33
- var seconds = parseInt(match[3], 10) || 0;
28
+ const youTubeDurationToSeconds = duration => {
29
+ const match = duration.match(/PT(\d+H)?(\d+M)?(\d+S)?/);
30
+ const hours = parseInt(match[1], 10) || 0;
31
+ const minutes = parseInt(match[2], 10) || 0;
32
+ const seconds = parseInt(match[3], 10) || 0;
34
33
  return hours * 3600 + minutes * 60 + seconds;
35
34
  };
36
35
  exports.youTubeDurationToSeconds = youTubeDurationToSeconds;
37
- var setLocaleDate = function setLocaleDate(date, locale) {
38
- var newDate = new Date(Date.parse(date));
39
- var options = {
36
+ const setLocaleDate = (date, locale) => {
37
+ const newDate = new Date(Date.parse(date));
38
+ const options = {
40
39
  year: 'numeric',
41
40
  month: '2-digit',
42
41
  day: '2-digit'
@@ -44,10 +43,10 @@ var setLocaleDate = function setLocaleDate(date, locale) {
44
43
  return newDate.toLocaleDateString(locale, options);
45
44
  };
46
45
  exports.setLocaleDate = setLocaleDate;
47
- var setYouTubeDuration = function setYouTubeDuration(duration) {
48
- var seconds = youTubeDurationToSeconds(duration);
46
+ const setYouTubeDuration = duration => {
47
+ const seconds = youTubeDurationToSeconds(duration);
49
48
  if (seconds > 86400) {
50
- return "24h+ ".concat(new Date(seconds * 1000).toISOString().substr(11, 8));
49
+ return `24h+ ${new Date(seconds * 1000).toISOString().substr(11, 8)}`;
51
50
  }
52
51
  return new Date(seconds * 1000).toISOString().substr(11, 8);
53
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/video-search",
3
- "version": "4.1.43",
3
+ "version": "4.1.46",
4
4
  "description": "A simple library for searching NDLA videos",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,16 +31,16 @@
31
31
  "prop-types": "^15.8.1"
32
32
  },
33
33
  "dependencies": {
34
- "@ndla/button": "^12.0.14",
35
- "@ndla/icons": "^4.2.2",
36
- "@ndla/licenses": "^7.2.2",
37
- "@ndla/notion": "^6.0.16",
38
- "@ndla/pager": "^2.2.39",
39
- "@ndla/tabs": "^3.2.2",
34
+ "@ndla/button": "^12.0.17",
35
+ "@ndla/icons": "^4.2.4",
36
+ "@ndla/licenses": "^7.2.4",
37
+ "@ndla/notion": "^6.0.18",
38
+ "@ndla/pager": "^2.2.42",
39
+ "@ndla/tabs": "^3.2.5",
40
40
  "react-bem-helper": "^1.4.1"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "252018f46b2084d45d08bf86072787257cdb0348"
45
+ "gitHead": "5c65dfc8de95fb464182f86a40b74868ca30a29e"
46
46
  }