Skip to content

Commit 141e85d

Browse files
authored
Merge pull request #77 from JessicaSachs/master
IE11 Compatibility: Replacing String.includes usages with String.indexOf
2 parents 55b0720 + 3f2bce7 commit 141e85d

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/services/paths.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { isObject } from '../utils/object'
1919
*/
2020
export function makePaths (path, props, fnResolver) {
2121
// handle wildcards
22-
if (typeof path === 'string' && path.includes('*')) {
22+
if (typeof path === 'string' && path.indexOf('*') > -1) {
2323
return makePathsHash(fnResolver(path))
2424
}
2525

@@ -68,7 +68,7 @@ export function makePaths (path, props, fnResolver) {
6868
*/
6969
export function makePath (path, target = '') {
7070
path = path.replace(/\/+$/, '')
71-
const value = path.includes('@')
71+
const value = path.indexOf('@') > -1
7272
? path + '.' + target
7373
: path + '/' + target
7474
return value

src/services/resolver.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function resolve (store, path) {
108108

109109
// parent
110110
let modPath, trgName
111-
if (statePath.includes('/')) {
111+
if (statePath.indexOf('/') > -1) {
112112
const keys = statePath.split('/')
113113
trgName = keys.pop()
114114
modPath = keys.join('/')
@@ -128,7 +128,7 @@ export function resolve (store, path) {
128128
module: modPath,
129129
target: statePath,
130130
name: trgName.replace('!', ''),
131-
isDynamic: path.includes(':'),
131+
isDynamic: path.indexOf(':') > -1,
132132

133133
/**
134134
* Returns properties about the targeted member
@@ -167,7 +167,7 @@ export function resolve (store, path) {
167167
*/
168168
export function getError(path, resolver, aName, a, bName, b) {
169169
let error = `[Vuex Pathify] Unable to map path '${path}':`
170-
if (path.includes('!')) {
170+
if (path.indexOf('!') > -1) {
171171
error += `
172172
- Did not find ${aName} or ${bName} named '${resolver.name}' on ${resolver.module ? `module '${resolver.module}'`: 'root store'}`
173173
}

src/services/store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function makeGetter (store, path, stateOnly) {
104104
* @returns {*}
105105
*/
106106
function getValueIfEnabled(expr, source, path) {
107-
if (!options.deep && expr.includes('@')) {
107+
if (!options.deep && expr.indexOf('@') > -1) {
108108
console.error(`[Vuex Pathify] Unable to access sub-property for path '${expr}':
109109
- Set option 'deep' to 1 to allow it`)
110110
return

src/services/wildcards.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function resolveHandlers (path, hash) {
116116
*/
117117
export function init (path, state) {
118118
// only wildcards in final path segment are supported
119-
if (path.includes('*') && /\*.*[/@.]/.test(path)) {
119+
if (path.indexOf('*') > -1 && /\*.*[/@.]/.test(path)) {
120120
console.error(`[Vuex Pathify] Invalid wildcard placement for path '${path}':
121121
- Wildcards may only be used in the last segment of a path`)
122122
return false

0 commit comments

Comments
 (0)