aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMisko Hevery2010-08-11 11:44:12 -0700
committerMisko Hevery2010-08-11 11:44:12 -0700
commit3d5719cd44868f89352ebbedd0e1b1f2575520cb (patch)
tree3947d275110c464b8b40d8cd9d0446983e419256 /src
parentab2213e80e09c763782bebc5e0ff7509056e828a (diff)
downloadangular.js-3d5719cd44868f89352ebbedd0e1b1f2575520cb.tar.bz2
removed undocumented/unneeded methods from Array API
Diffstat (limited to 'src')
-rw-r--r--src/Angular.js20
-rw-r--r--src/apis.js71
2 files changed, 9 insertions, 82 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 902ae013..3970f762 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -291,19 +291,17 @@ function escapeAttr(html) {
'"');
}
-function bind(_this, _function) {
- var curryArgs = slice.call(arguments, 2, arguments.length);
- if (typeof _function == 'function') {
- return curryArgs.length == 0 ?
- function() {
- return _function.apply(_this, arguments);
- } :
- function() {
- return _function.apply(_this, curryArgs.concat(slice.call(arguments, 0, arguments.length)));
- };
+function bind(self, fn) {
+ var curryArgs = arguments.length > 2 ? slice.call(arguments, 2, arguments.length) : [];
+ if (typeof fn == 'function') {
+ return curryArgs.length ? function() {
+ return arguments.length ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0, arguments.length))) : fn.apply(self, curryArgs);
+ }: function() {
+ return arguments.length ? fn.apply(self, arguments) : fn.call(self);
+ };
} else {
// in IE, native methods ore not functions and so they can not be bound (but they don't need to be)
- return _function;
+ return fn;
}
}
diff --git a/src/apis.js b/src/apis.js
index 136473b6..0cf24016 100644
--- a/src/apis.js
+++ b/src/apis.js
@@ -21,17 +21,6 @@ var angularObject = {
};
var angularArray = {
'indexOf': indexOf,
- 'include': includes,
- 'includeIf':function(array, value, condition) {
- var index = indexOf(array, value);
- if (condition) {
- if (index == -1)
- array.push(value);
- } else {
- array.splice(index, 1);
- }
- return array;
- },
'sum':function(array, expression) {
var fn = angular['Function']['compile'](expression);
var sum = 0;
@@ -49,20 +38,6 @@ var angularArray = {
array.splice(index, 1);
return value;
},
- 'find':function(array, condition, defaultValue) {
- if (!condition) return undefined;
- var fn = angular['Function']['compile'](condition);
- foreach(array, function($){
- if (fn($)){
- defaultValue = $;
- return true;
- }
- });
- return defaultValue;
- },
- 'findById':function(array, id) {
- return angular.Array.find(array, function($){return $.$id == id;}, null);
- },
'filter':function(array, expression) {
var predicates = [];
predicates.check = function(value) {
@@ -195,52 +170,6 @@ var angularArray = {
var arrayCopy = [];
for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }
return arrayCopy.sort(reverse(comparator, descend));
- },
- 'orderByToggle':function(predicate, attribute) {
- var STRIP = /^([+|-])?(.*)/;
- var ascending = false;
- var index = -1;
- foreach(predicate, function($, i){
- if (index == -1) {
- if ($ == attribute) {
- ascending = true;
- index = i;
- return true;
- }
- if (($.charAt(0)=='+'||$.charAt(0)=='-') && $.substring(1) == attribute) {
- ascending = $.charAt(0) == '+';
- index = i;
- return true;
- }
- }
- });
- if (index >= 0) {
- predicate.splice(index, 1);
- }
- predicate.unshift((ascending ? "-" : "+") + attribute);
- return predicate;
- },
- 'orderByDirection':function(predicate, attribute, ascend, descend) {
- ascend = ascend || 'ng-ascend';
- descend = descend || 'ng-descend';
- var att = predicate[0] || '';
- var direction = true;
- if (att.charAt(0) == '-') {
- att = att.substring(1);
- direction = false;
- } else if(att.charAt(0) == '+') {
- att = att.substring(1);
- }
- return att == attribute ? (direction ? ascend : descend) : "";
- },
- 'merge':function(array, index, mergeValue) {
- var value = array[index];
- if (!value) {
- value = {};
- array[index] = value;
- }
- merge(mergeValue, value);
- return array;
}
};