Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLEANUP beta] Remove unused path caches #16163

Merged
merged 1 commit into from
Jan 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/ember-metal/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ export {
hasUnprocessedMixins,
clearUnprocessedMixins,
} from './mixin';
export {
isGlobalPath
} from './path_cache';
export { default as InjectedProperty } from './injected_property';
export {
setHasViews,
Expand Down
30 changes: 1 addition & 29 deletions packages/ember-metal/lib/path_cache.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,11 @@
import Cache from './cache';

const IS_GLOBAL_PATH = /^[A-Z$].*[\.]/;

const isGlobalPathCache = new Cache(1000, key => IS_GLOBAL_PATH.test(key));
const firstDotIndexCache = new Cache(1000, key => key.indexOf('.'));

const firstKeyCache = new Cache(1000, (path) => {
let index = firstDotIndexCache.get(path);
return index === -1 ? path : path.slice(0, index);
});

const tailPathCache = new Cache(1000, (path) => {
let index = firstDotIndexCache.get(path);
return index === -1 ? undefined : path.slice(index + 1);
});

export const caches = {
isGlobalPathCache,
firstDotIndexCache,
firstKeyCache,
tailPathCache
firstDotIndexCache
};

export function isGlobalPath(path) {
return isGlobalPathCache.get(path);
}

export function isPath(path) {
return firstDotIndexCache.get(path) !== -1;
}

export function getFirstKey(path) {
return firstKeyCache.get(path);
}

export function getTailPath(path) {
return tailPathCache.get(path);
}
20 changes: 0 additions & 20 deletions packages/ember-metal/tests/accessors/is_global_path_test.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/ember/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ Ember.mixin = metal.mixin;
Ember.Mixin = metal.Mixin;
Ember.bind = metal.bind;
Ember.Binding = metal.Binding;
Ember.isGlobalPath = metal.isGlobalPath;


Object.defineProperty(Ember, 'ENV', {
Expand Down
1 change: 0 additions & 1 deletion packages/ember/tests/reexports_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ let allExports =[
['observer', 'ember-metal'],
['mixin', 'ember-metal'],
['Mixin', 'ember-metal'],
['isGlobalPath', 'ember-metal'],

// ember-views
['$', 'ember-views', 'jQuery'],
Expand Down