Skip to content

Commit

Permalink
prevent string construction
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Feb 15, 2021
1 parent 067791e commit 1f38eb1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/helpers/helpers.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,15 @@ export function _deprecated(scope, value, previous, current) {
}
}

const emptyString = '';
const dot = '.';
function indexOfDotOrLength(key, start) {
const idx = key.indexOf('.', start);
const idx = key.indexOf(dot, start);
return idx === -1 ? key.length : idx;
}

export function resolveObjectKey(obj, key) {
if (key === '') {
if (key === emptyString) {
return obj;
}
let pos = 0;
Expand Down

0 comments on commit 1f38eb1

Please sign in to comment.