{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
AJAX Source Viewer
Slideshow of method source in a particular class. Choose a class from the Namespaces, Classes, or Methods menu item above.
Slideshow for Class 'Enum'
Previous Method:

None


Current Method:

parse(value, ignoreCase)
Next Method:

toString(value)
Method 'parse(value, ignoreCase)'
Method: parse(value, ignoreCase)
Method Full Name:     Sys$Enum$parse(value, ignoreCase)
Class: Enum
Namespace: Sys
Source File: MicrosoftAjax.debug.js
1   function Sys$Enum$parse(value, ignoreCase) {
2     /// <summary locid="M:J#Sys.Enum.parse" />
3     /// <param name="value" type="String"></param>
4     /// <param name="ignoreCase" type="Boolean" optional="true"></param>
5     /// <returns></returns>
6     var e = Function._validateParams(arguments, [
7     {name: "value", type: String},
8     {name: "ignoreCase", type: Boolean, optional: true}
9     ]);
10    if (e) throw e;
11    var values, parsed, val;
12    if (ignoreCase) {
13      values = this.__lowerCaseValues;
14      if (!values) {
15        this.__lowerCaseValues = values = {};
16        var prototype = this.prototype;
17        for (var name in prototype) {
18          values[name.toLowerCase()] = prototype[name];
19        }
20      }
21    }
22    else {
23      values = this.prototype;
24    }
25    if (!this.__flags) {
26      val = (ignoreCase ? value.toLowerCase() : value);
27      parsed = values[val.trim()];
28      if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
29      return parsed;
30    }
31    else {
32      var parts = (ignoreCase ? value.toLowerCase() : value).split(',');
33      var v = 0;
34      for (var i = parts.length - 1; i >= 0; i--) {
35        var part = parts[i].trim();
36        parsed = values[part];
37        if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value.split(',')[i].trim(), this.__typeName));
38        v |= parsed;
39      }
40      return v;
41    }
42  }
This is the JavaScript source for method parse(value, ignoreCase) from ASP.NET AJAX Library. Full name for this method is Sys$Enum$parse(value, ignoreCase). It belongs to the class Enum, which is in Sys namespace. This source is in MicrosoftAjax.debug.js file.
Bookmark and Share This
About  Contact  Privacy Policy  Site Map