diff options
| -rw-r--r-- | src/Angular.js | 5 | ||||
| -rw-r--r-- | src/JSON.js | 2 | ||||
| -rw-r--r-- | src/apis.js | 2 | ||||
| -rw-r--r-- | src/parser.js | 4 | ||||
| -rw-r--r-- | test/ApiSpecs.js | 2 | ||||
| -rw-r--r-- | test/BrowserSpecs.js | 6 | ||||
| -rw-r--r-- | test/ResourceSpec.js | 12 | ||||
| -rw-r--r-- | test/service/xhr.bulkSpec.js | 2 | ||||
| -rw-r--r-- | test/service/xhr.errorSpec.js | 2 | 
9 files changed, 18 insertions, 19 deletions
| diff --git a/src/Angular.js b/src/Angular.js index f876dde0..d698aa11 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -64,7 +64,6 @@ var _undefined        = undefined,      $console          = 'console',      $date             = 'date',      $display          = 'display', -    $function         = 'function',      $length           = 'length',      $name             = 'name',      $noop             = 'noop', @@ -420,7 +419,7 @@ function isArray(value) { return value instanceof Array; }   * @param {*} value Reference to check.   * @returns {boolean} True if `value` is a `Function`.   */ -function isFunction(value){ return typeof value == $function;} +function isFunction(value){ return typeof value == 'function';}  /** @@ -819,7 +818,7 @@ function sliceArgs(args, startIndex) {   */  function bind(self, fn) {    var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; -  if (typeof fn == $function && !(fn instanceof RegExp)) { +  if (isFunction(fn) && !(fn instanceof RegExp)) {      return curryArgs.length        ? function() {            return arguments.length diff --git a/src/JSON.js b/src/JSON.js index b0f72a1b..02c1a613 100644 --- a/src/JSON.js +++ b/src/JSON.js @@ -136,7 +136,7 @@ function toJsonArray(buf, obj, pretty, stack) {        for ( var keyIndex = 0; keyIndex < keys.length; keyIndex++) {          var key = keys[keyIndex];          var value = obj[key]; -        if (typeof value != $function) { +        if (!isFunction(value)) {            if (comma) {              buf.push(",");              if (pretty) buf.push(pretty); diff --git a/src/apis.js b/src/apis.js index 8a566a46..3a9671a8 100644 --- a/src/apis.js +++ b/src/apis.js @@ -394,7 +394,7 @@ var angularArray = {            }          }          break; -      case $function: +      case 'function':          predicates.push(expression);          break;        default: diff --git a/src/parser.js b/src/parser.js index 9f2442de..dadab1fb 100644 --- a/src/parser.js +++ b/src/parser.js @@ -515,7 +515,7 @@ function parser(text, json){        if (instance)          instance = instance[key];      } -    if (typeof instance != $function) { +    if (!isFunction(instance)) {        throwError("should be a function", token);      }      return instance; @@ -765,7 +765,7 @@ function compileExpr(expr) {  // TODO(misko): Deprecate? Remove!  // I think that compilation should be a service.  function expressionCompile(exp) { -  if (typeof exp === $function) return exp; +  if (isFunction(exp)) return exp;    var fn = compileCache[exp];    if (!fn) {      fn = compileCache[exp] =  parser(exp).statements(); diff --git a/test/ApiSpecs.js b/test/ApiSpecs.js index 137d7afd..46c42e53 100644 --- a/test/ApiSpecs.js +++ b/test/ApiSpecs.js @@ -28,7 +28,7 @@ describe('api', function(){        assertEquals("string", angular.Object.typeOf(""));        assertEquals("date", angular.Object.typeOf(new Date()));        assertEquals("element", angular.Object.typeOf(document.body)); -      assertEquals($function, angular.Object.typeOf(function(){})); +      assertEquals('function', angular.Object.typeOf(function(){}));      });      it('should extend object', function(){ diff --git a/test/BrowserSpecs.js b/test/BrowserSpecs.js index 92e4e501..a88df3f4 100644 --- a/test/BrowserSpecs.js +++ b/test/BrowserSpecs.js @@ -111,7 +111,7 @@ describe('browser', function(){            var script = scripts[0];            var url = script.src.split('?cb=');            expect(url[0]).toEqual('http://example.org/path'); -          expect(typeof fakeWindow[url[1]]).toEqual($function); +          expect(typeof fakeWindow[url[1]]).toEqual('function');            fakeWindow[url[1]]('data');            script.onload(); @@ -125,8 +125,8 @@ describe('browser', function(){          it('should call callback when script fails to load', function() {            browser.xhr('JSON', 'http://example.org/path?cb=JSON_CALLBACK', null, callback);            var script = scripts[0]; -          expect(typeof script.onload).toBe($function); -          expect(typeof script.onerror).toBe($function); +          expect(typeof script.onload).toBe('function'); +          expect(typeof script.onerror).toBe('function');            script.onerror();            expect(log).toEqual('undefined:undefined;'); diff --git a/test/ResourceSpec.js b/test/ResourceSpec.js index b4a7d37e..e2f14682 100644 --- a/test/ResourceSpec.js +++ b/test/ResourceSpec.js @@ -17,12 +17,12 @@ describe("resource", function() {    });    it("should build resource", function(){ -    expect(typeof CreditCard).toBe($function); -    expect(typeof CreditCard.get).toBe($function); -    expect(typeof CreditCard.save).toBe($function); -    expect(typeof CreditCard.remove).toBe($function); -    expect(typeof CreditCard['delete']).toBe($function); -    expect(typeof CreditCard.query).toBe($function); +    expect(typeof CreditCard).toBe('function'); +    expect(typeof CreditCard.get).toBe('function'); +    expect(typeof CreditCard.save).toBe('function'); +    expect(typeof CreditCard.remove).toBe('function'); +    expect(typeof CreditCard['delete']).toBe('function'); +    expect(typeof CreditCard.query).toBe('function');    });    it('should default to empty parameters', function(){ diff --git a/test/service/xhr.bulkSpec.js b/test/service/xhr.bulkSpec.js index 01e0a365..e35673c7 100644 --- a/test/service/xhr.bulkSpec.js +++ b/test/service/xhr.bulkSpec.js @@ -62,7 +62,7 @@ describe('$xhr.bulk', function() {      expect($xhrError).toHaveBeenCalled();      var cb = $xhrError.mostRecentCall.args[0].success; -    expect(typeof cb).toEqual($function); +    expect(typeof cb).toEqual('function');      expect($xhrError).toHaveBeenCalledWith(          {url: '/req1', method: 'GET', data: null, success: cb},          {status: 404, response: 'NotFound'}); diff --git a/test/service/xhr.errorSpec.js b/test/service/xhr.errorSpec.js index 82fafe80..6cc7fce0 100644 --- a/test/service/xhr.errorSpec.js +++ b/test/service/xhr.errorSpec.js @@ -30,7 +30,7 @@ describe('$xhr.error', function() {      $xhr('POST', '/req', 'MyData', callback);      $browserXhr.flush();      var cb = $xhrError.mostRecentCall.args[0].success; -    expect(typeof cb).toEqual($function); +    expect(typeof cb).toEqual('function');      expect($xhrError).toHaveBeenCalledWith(          {url: '/req', method: 'POST', data: 'MyData', success: cb},          {status: 500, body: 'MyError'}); | 
