Skip to content

Commit

Permalink
Handle undefined results in the match array (OctoLinker#444)
Browse files Browse the repository at this point in the history
Fixes OctoLinker#443. This was caused by combination, where the [composer plugin] returns `undefined` if the json key is `php` and a not solid `forEach` loop in the octolinker core.

[composer plugin]: https://github.com/OctoLinker/OctoLinker/blob/b175d59f1bd6f630ffb655dac6449a674852aa7f/packages/plugin-composer-manifest/index.js#L8
  • Loading branch information
stefanbuck authored and josephfrazier committed Feb 7, 2018
1 parent b175d59 commit fd0b159
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/core/octo-linker.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ function initialize(self) {
}

function insertDataAttr(matches) {
matches.forEach(({ data, link }) => {
matches.forEach(item => {
if (!item) {
return;
}

const { data, link } = item;
for (const key in data) {
if (data.hasOwnProperty(key)) {
link.dataset[key] = data[key];
Expand Down

0 comments on commit fd0b159

Please sign in to comment.