From fe72dc0c191dce5a745876c680bc1ec5f99738f3 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 5 Jan 2019 10:47:28 +0100
Subject: [PATCH] refactor: packagist registryUrls

---
 lib/datasource/packagist/index.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/datasource/packagist/index.js b/lib/datasource/packagist/index.js
index 0dc04609c5..0523ae327d 100644
--- a/lib/datasource/packagist/index.js
+++ b/lib/datasource/packagist/index.js
@@ -245,10 +245,11 @@ async function packageLookup(regUrl, name) {
 
 async function getPkgReleases(purl, config = {}) {
   const { fullname: name } = purl;
+  const { registryUrls } = config;
   logger.trace(`getPkgReleases(${name})`);
   const regUrls = [];
-  if (config.registryUrls) {
-    for (const regUrl of config.registryUrls) {
+  if (registryUrls) {
+    for (const regUrl of registryUrls) {
       if (regUrl.type === 'composer') {
         regUrls.push(regUrl.url);
       } else if (regUrl.type === 'package') {
@@ -262,9 +263,8 @@ async function getPkgReleases(purl, config = {}) {
     logger.debug({ regUrls }, 'Packagist custom registry URLs');
   }
   if (
-    !is.nonEmptyArray(config.registryUrls) ||
-    config.registryUrls[config.registryUrls.length - 1]['packagist.org'] !==
-      false
+    !is.nonEmptyArray(registryUrls) ||
+    registryUrls[registryUrls.length - 1]['packagist.org'] !== false
   ) {
     regUrls.push('https://packagist.org');
   } else {
-- 
GitLab