Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 301e7aa

Browse files
realitykingpkozlowski-opensource
authored andcommittedJan 21, 2015
refactor(Angular): inline the only call to sortedKeys()
Closes #10757
1 parent f2e2b31 commit 301e7aa

File tree

5 files changed

+3
-27
lines changed

5 files changed

+3
-27
lines changed
 

‎src/.jshintrc

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"manualUppercase": false,
2929
"isArrayLike": false,
3030
"forEach": false,
31-
"sortedKeys": false,
3231
"forEachSorted": false,
3332
"reverseParams": false,
3433
"nextUid": false,

‎src/Angular.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
nodeName_: true,
2323
isArrayLike: true,
2424
forEach: true,
25-
sortedKeys: true,
2625
forEachSorted: true,
2726
reverseParams: true,
2827
nextUid: true,
@@ -272,12 +271,8 @@ function forEach(obj, iterator, context) {
272271
return obj;
273272
}
274273

275-
function sortedKeys(obj) {
276-
return Object.keys(obj).sort();
277-
}
278-
279274
function forEachSorted(obj, iterator, context) {
280-
var keys = sortedKeys(obj);
275+
var keys = Object.keys(obj).sort();
281276
for (var i = 0; i < keys.length; i++) {
282277
iterator.call(context, obj[keys[i]], keys[i]);
283278
}

‎test/.jshintrc

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"manualUppercase": false,
2727
"isArrayLike": false,
2828
"forEach": false,
29-
"sortedKeys": false,
3029
"reverseParams": false,
3130
"nextUid": false,
3231
"setHashKey": false,

‎test/AngularSpec.js

-7
Original file line numberDiff line numberDiff line change
@@ -699,13 +699,6 @@ describe('angular', function() {
699699
});
700700

701701

702-
describe('sortedKeys', function() {
703-
it('should collect keys from object', function() {
704-
expect(sortedKeys({c:0, b:0, a:0})).toEqual(['a', 'b', 'c']);
705-
});
706-
});
707-
708-
709702
describe('encodeUriSegment', function() {
710703
it('should correctly encode uri segment and not encode chars defined as pchar set in rfc3986',
711704
function() {

‎test/helpers/testabilityPatch.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,9 @@ afterEach(function() {
7474

7575

7676
// copied from Angular.js
77-
// we need these two methods here so that we can run module tests with wrapped angular.js
78-
function sortedKeys(obj) {
79-
var keys = [];
80-
for (var key in obj) {
81-
if (obj.hasOwnProperty(key)) {
82-
keys.push(key);
83-
}
84-
}
85-
return keys.sort();
86-
}
87-
77+
// we need this method here so that we can run module tests with wrapped angular.js
8878
function forEachSorted(obj, iterator, context) {
89-
var keys = sortedKeys(obj);
79+
var keys = Object.keys(obj).sort();
9080
for (var i = 0; i < keys.length; i++) {
9181
iterator.call(context, obj[keys[i]], keys[i]);
9282
}

0 commit comments

Comments
 (0)
This repository has been archived.