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

Commit 06835a4

Browse files
committed
style($function): replace $function with 'function'
1 parent 142cffc commit 06835a4

File tree

9 files changed

+18
-19
lines changed

9 files changed

+18
-19
lines changed

src/Angular.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ var _undefined = undefined,
6464
$console = 'console',
6565
$date = 'date',
6666
$display = 'display',
67-
$function = 'function',
6867
$length = 'length',
6968
$name = 'name',
7069
$noop = 'noop',
@@ -420,7 +419,7 @@ function isArray(value) { return value instanceof Array; }
420419
* @param {*} value Reference to check.
421420
* @returns {boolean} True if `value` is a `Function`.
422421
*/
423-
function isFunction(value){ return typeof value == $function;}
422+
function isFunction(value){ return typeof value == 'function';}
424423

425424

426425
/**
@@ -819,7 +818,7 @@ function sliceArgs(args, startIndex) {
819818
*/
820819
function bind(self, fn) {
821820
var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
822-
if (typeof fn == $function && !(fn instanceof RegExp)) {
821+
if (isFunction(fn) && !(fn instanceof RegExp)) {
823822
return curryArgs.length
824823
? function() {
825824
return arguments.length

src/JSON.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function toJsonArray(buf, obj, pretty, stack) {
136136
for ( var keyIndex = 0; keyIndex < keys.length; keyIndex++) {
137137
var key = keys[keyIndex];
138138
var value = obj[key];
139-
if (typeof value != $function) {
139+
if (!isFunction(value)) {
140140
if (comma) {
141141
buf.push(",");
142142
if (pretty) buf.push(pretty);

src/apis.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ var angularArray = {
394394
}
395395
}
396396
break;
397-
case $function:
397+
case 'function':
398398
predicates.push(expression);
399399
break;
400400
default:

src/parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ function parser(text, json){
515515
if (instance)
516516
instance = instance[key];
517517
}
518-
if (typeof instance != $function) {
518+
if (!isFunction(instance)) {
519519
throwError("should be a function", token);
520520
}
521521
return instance;
@@ -765,7 +765,7 @@ function compileExpr(expr) {
765765
// TODO(misko): Deprecate? Remove!
766766
// I think that compilation should be a service.
767767
function expressionCompile(exp) {
768-
if (typeof exp === $function) return exp;
768+
if (isFunction(exp)) return exp;
769769
var fn = compileCache[exp];
770770
if (!fn) {
771771
fn = compileCache[exp] = parser(exp).statements();

test/ApiSpecs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('api', function(){
2828
assertEquals("string", angular.Object.typeOf(""));
2929
assertEquals("date", angular.Object.typeOf(new Date()));
3030
assertEquals("element", angular.Object.typeOf(document.body));
31-
assertEquals($function, angular.Object.typeOf(function(){}));
31+
assertEquals('function', angular.Object.typeOf(function(){}));
3232
});
3333

3434
it('should extend object', function(){

test/BrowserSpecs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe('browser', function(){
111111
var script = scripts[0];
112112
var url = script.src.split('?cb=');
113113
expect(url[0]).toEqual('http://example.org/path');
114-
expect(typeof fakeWindow[url[1]]).toEqual($function);
114+
expect(typeof fakeWindow[url[1]]).toEqual('function');
115115
fakeWindow[url[1]]('data');
116116
script.onload();
117117

@@ -125,8 +125,8 @@ describe('browser', function(){
125125
it('should call callback when script fails to load', function() {
126126
browser.xhr('JSON', 'http://example.org/path?cb=JSON_CALLBACK', null, callback);
127127
var script = scripts[0];
128-
expect(typeof script.onload).toBe($function);
129-
expect(typeof script.onerror).toBe($function);
128+
expect(typeof script.onload).toBe('function');
129+
expect(typeof script.onerror).toBe('function');
130130
script.onerror();
131131

132132
expect(log).toEqual('undefined:undefined;');

test/ResourceSpec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ describe("resource", function() {
1717
});
1818

1919
it("should build resource", function(){
20-
expect(typeof CreditCard).toBe($function);
21-
expect(typeof CreditCard.get).toBe($function);
22-
expect(typeof CreditCard.save).toBe($function);
23-
expect(typeof CreditCard.remove).toBe($function);
24-
expect(typeof CreditCard['delete']).toBe($function);
25-
expect(typeof CreditCard.query).toBe($function);
20+
expect(typeof CreditCard).toBe('function');
21+
expect(typeof CreditCard.get).toBe('function');
22+
expect(typeof CreditCard.save).toBe('function');
23+
expect(typeof CreditCard.remove).toBe('function');
24+
expect(typeof CreditCard['delete']).toBe('function');
25+
expect(typeof CreditCard.query).toBe('function');
2626
});
2727

2828
it('should default to empty parameters', function(){

test/service/xhr.bulkSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('$xhr.bulk', function() {
6262

6363
expect($xhrError).toHaveBeenCalled();
6464
var cb = $xhrError.mostRecentCall.args[0].success;
65-
expect(typeof cb).toEqual($function);
65+
expect(typeof cb).toEqual('function');
6666
expect($xhrError).toHaveBeenCalledWith(
6767
{url: '/req1', method: 'GET', data: null, success: cb},
6868
{status: 404, response: 'NotFound'});

test/service/xhr.errorSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('$xhr.error', function() {
3030
$xhr('POST', '/req', 'MyData', callback);
3131
$browserXhr.flush();
3232
var cb = $xhrError.mostRecentCall.args[0].success;
33-
expect(typeof cb).toEqual($function);
33+
expect(typeof cb).toEqual('function');
3434
expect($xhrError).toHaveBeenCalledWith(
3535
{url: '/req', method: 'POST', data: 'MyData', success: cb},
3636
{status: 500, body: 'MyError'});

0 commit comments

Comments
 (0)