Skip to content

Commit

Permalink
allow for pipe function to pipe multiple arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
nickforddev committed Mar 15, 2020
1 parent daea988 commit 4620361
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/freezeframe/src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export const pipe = (...fns) => (
fns.reduceRight((f, g) => (...args) => f(g(...args)))
(...initArgs) => {
return fns.reduceRight(((f, g) => (...args) => f(g(...args, ...initArgs))))();
}
);

export const formatMessage = (string) => `✨Freezeframe: ${string}✨`;
Expand Down Expand Up @@ -37,7 +39,7 @@ export const normalizeElements = (selectorOrNodes) => {
: sel;
};

export const validateElements = (elements) => {
export const validateElements = (elements, _, options) => {
const list = elements instanceof HTMLElement ? [elements] : elements;
return Array.from(list).reduce((acc, image) => {
if (!(image instanceof HTMLImageElement)) {
Expand All @@ -51,7 +53,7 @@ export const validateElements = (elements) => {
} else {
acc.push(image);
if (!(validateFilename(image.src))) {
warn('Image is not a gif', image);
if (options.warnings) warn('Image does not appear to be a gif', image);
}
}
return acc;
Expand Down

0 comments on commit 4620361

Please sign in to comment.