@quintype/seo 1.40.6-embed-url.3 → 1.40.6-embed-url.4

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.
@@ -4,6 +4,7 @@
4
4
  },
5
5
  "editor.tabSize": 2,
6
6
  "editor.detectIndentation": false,
7
+ "editor.formatOnSave": true,
7
8
  "files.insertFinalNewline": true,
8
9
  "files.trimTrailingWhitespace": true,
9
10
  "editor.codeActionsOnSave": {
package/dist/index.cjs.js CHANGED
@@ -821,25 +821,23 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
821
821
  }
822
822
 
823
823
  function getEmbedUrl(cards) {
824
- // get the first story element which has the embed url
824
+ let embedUrl = "";
825
825
 
826
- let storyElemIndex;
827
-
828
- const card = cards.find(card => {
826
+ // not using the return value of top level find
827
+ // coz we only need the embed url
828
+ // find is used for early exit
829
+ cards.find(card => {
829
830
  const storyElements = card["story-elements"];
830
831
  return storyElements.find((elem, index) => {
831
832
  if (elem["embed-url"]) {
832
- storyElemIndex = index;
833
- return elem["embed-url"];
833
+ embedUrl = elem["embed-url"];
834
+ return true;
834
835
  }
835
836
  return false;
836
837
  });
837
838
  });
838
- if (card) {
839
- const storyElement = card['story-elements'][storyElemIndex];
840
- return storyElement["embed-url"];
841
- }
842
- return "";
839
+
840
+ return embedUrl;
843
841
  }
844
842
 
845
843
  function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.40.6-embed-url.3",
3
+ "version": "1.40.6-embed-url.4",
4
4
  "description": "SEO Modules for Quintype",
5
5
  "main": "dist/index.cjs.js",
6
6
  "repository": "https://github.com/quintype/quintype-node-seo",
@@ -255,25 +255,23 @@ function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherC
255
255
  }
256
256
 
257
257
  function getEmbedUrl(cards) {
258
- // get the first story element which has the embed url
258
+ let embedUrl = "";
259
259
 
260
- let storyElemIndex;
261
-
262
- const card = cards.find((card) => {
260
+ // not using the return value of top level find
261
+ // coz we only need the embed url
262
+ // find is used for early exit
263
+ cards.find((card) => {
263
264
  const storyElements = card["story-elements"];
264
265
  return storyElements.find((elem, index) => {
265
266
  if (elem["embed-url"]) {
266
- storyElemIndex = index;
267
- return elem["embed-url"];
267
+ embedUrl = elem["embed-url"];
268
+ return true;
268
269
  }
269
270
  return false;
270
271
  });
271
272
  });
272
- if (card) {
273
- const storyElement = card['story-elements'][storyElemIndex]
274
- return storyElement["embed-url"];
275
- }
276
- return "";
273
+
274
+ return embedUrl;
277
275
  }
278
276
 
279
277