Skip to content

Commit

Permalink
Merge pull request #77 from JessicaSachs/master
Browse files Browse the repository at this point in the history
IE11 Compatibility: Replacing String.includes usages with String.indexOf
  • Loading branch information
davestewart authored Dec 16, 2019
2 parents 55b0720 + 3f2bce7 commit 141e85d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/services/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { isObject } from '../utils/object'
*/
export function makePaths (path, props, fnResolver) {
// handle wildcards
if (typeof path === 'string' && path.includes('*')) {
if (typeof path === 'string' && path.indexOf('*') > -1) {
return makePathsHash(fnResolver(path))
}

Expand Down Expand Up @@ -68,7 +68,7 @@ export function makePaths (path, props, fnResolver) {
*/
export function makePath (path, target = '') {
path = path.replace(/\/+$/, '')
const value = path.includes('@')
const value = path.indexOf('@') > -1
? path + '.' + target
: path + '/' + target
return value
Expand Down
6 changes: 3 additions & 3 deletions src/services/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function resolve (store, path) {

// parent
let modPath, trgName
if (statePath.includes('/')) {
if (statePath.indexOf('/') > -1) {
const keys = statePath.split('/')
trgName = keys.pop()
modPath = keys.join('/')
Expand All @@ -128,7 +128,7 @@ export function resolve (store, path) {
module: modPath,
target: statePath,
name: trgName.replace('!', ''),
isDynamic: path.includes(':'),
isDynamic: path.indexOf(':') > -1,

/**
* Returns properties about the targeted member
Expand Down Expand Up @@ -167,7 +167,7 @@ export function resolve (store, path) {
*/
export function getError(path, resolver, aName, a, bName, b) {
let error = `[Vuex Pathify] Unable to map path '${path}':`
if (path.includes('!')) {
if (path.indexOf('!') > -1) {
error += `
- Did not find ${aName} or ${bName} named '${resolver.name}' on ${resolver.module ? `module '${resolver.module}'`: 'root store'}`
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function makeGetter (store, path, stateOnly) {
* @returns {*}
*/
function getValueIfEnabled(expr, source, path) {
if (!options.deep && expr.includes('@')) {
if (!options.deep && expr.indexOf('@') > -1) {
console.error(`[Vuex Pathify] Unable to access sub-property for path '${expr}':
- Set option 'deep' to 1 to allow it`)
return
Expand Down
2 changes: 1 addition & 1 deletion src/services/wildcards.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function resolveHandlers (path, hash) {
*/
export function init (path, state) {
// only wildcards in final path segment are supported
if (path.includes('*') && /\*.*[/@.]/.test(path)) {
if (path.indexOf('*') > -1 && /\*.*[/@.]/.test(path)) {
console.error(`[Vuex Pathify] Invalid wildcard placement for path '${path}':
- Wildcards may only be used in the last segment of a path`)
return false
Expand Down

0 comments on commit 141e85d

Please sign in to comment.