Skip to content

Commit

Permalink
feat: add compatibility with PrototypeJS v1.6 and lower
Browse files Browse the repository at this point in the history
  • Loading branch information
fczbkk committed May 13, 2016
1 parent 9c1798f commit 867bc62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"webpack": "^1.13.0"
},
"dependencies": {
"array-reduce-prototypejs-fix": "^1.0.0",
"babel-plugin-transform-es2015-classes": "^6.8.0"
}
}
5 changes: 3 additions & 2 deletions src/params.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import UrlPart from './url-part';
import exists from './utilities/exists';
import arrayReduce from 'array-reduce-prototypejs-fix';


export default class extends UrlPart {
Expand Down Expand Up @@ -67,7 +68,7 @@ export default class extends UrlPart {

if (exists(patterns)) {

result = patterns.reduce((previous_result, pattern) => {
result = arrayReduce(patterns, (previous_result, pattern) => {
const re = new RegExp('(^|\&)' + pattern + '(\&|$)');
return previous_result && re.test(content);
}, result);
Expand All @@ -79,7 +80,7 @@ export default class extends UrlPart {
.join('|');
const re = new RegExp('(^|\&)(' + wrapped_patterns + ')(\&|$)');

result = content.split('&').reduce((previous_result, pair) => {
result = arrayReduce(content.split('&'), (previous_result, pair) => {
return previous_result && re.test(pair);
}, result);
} else {
Expand Down

0 comments on commit 867bc62

Please sign in to comment.