Skip to content

Commit 45b71db

Browse files
author
Arian Stolwijk
committed
Merge pull request #1336 from SergioCrisostomo/rename-Array.from-Array.convert
rename Array.from to Array.convert
2 parents 3fe8d73 + 3d7457f commit 45b71db

17 files changed

+35
-35
lines changed

Source/Class/Chain.Wait.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ if (this.Element && Element.implement && this.Fx){
4242
Element.implement({
4343

4444
chains: function(effects){
45-
Array.from(effects || ['tween', 'morph', 'reveal']).each(function(effect){
45+
Array.convert(effects || ['tween', 'morph', 'reveal']).each(function(effect){
4646
effect = this.get(effect);
4747
if (!effect) return;
4848
effect.setOptions({

Source/Class/Class.Binds.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ provides: [Class.Binds]
2323

2424
Class.Mutators.Binds = function(binds){
2525
if (!this.prototype.initialize) this.implement('initialize', function(){});
26-
return Array.from(binds).concat(this.prototype.Binds || []);
26+
return Array.convert(binds).concat(this.prototype.Binds || []);
2727
};
2828

2929
Class.Mutators.initialize = function(initialize){
3030
return function(){
31-
Array.from(this.Binds).each(function(name){
31+
Array.convert(this.Binds).each(function(name){
3232
var original = this[name];
3333
if (original) this[name] = original.bind(this);
3434
}, this);

Source/Drag/Drag.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var Drag = this.Drag = new Class({
7878
this.compensateScroll = {start: {}, diff: {}, last: {}};
7979

8080
if ('ondragstart' in document && !('FileReader' in window) && !Drag.ondragstartFixed){
81-
document.ondragstart = Function.from(false);
81+
document.ondragstart = Function.convert(false);
8282
Drag.ondragstartFixed = true;
8383
}
8484

@@ -88,7 +88,7 @@ var Drag = this.Drag = new Class({
8888
drag: this.drag.bind(this),
8989
stop: this.stop.bind(this),
9090
cancel: this.cancel.bind(this),
91-
eventStop: Function.from(false),
91+
eventStop: Function.convert(false),
9292
scrollListener: this.scrollListener.bind(this)
9393
};
9494
this.attach();

Source/Forms/Form.Validator.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var InputValidator = this.InputValidator = new Class({
3939

4040
options: {
4141
errorMsg: 'Validation failed.',
42-
test: Function.from(true)
42+
test: Function.convert(true)
4343
},
4444

4545
initialize: function(className, options){
@@ -144,8 +144,8 @@ Form.Validator = new Class({
144144
initialize: function(form, options){
145145
this.setOptions(options);
146146
this.element = document.id(form);
147-
this.warningPrefix = Function.from(this.options.warningPrefix)();
148-
this.errorPrefix = Function.from(this.options.errorPrefix)();
147+
this.warningPrefix = Function.convert(this.options.warningPrefix)();
148+
this.errorPrefix = Function.convert(this.options.errorPrefix)();
149149
this._bound = {
150150
onSubmit: this.onSubmit.bind(this),
151151
blurOrChange: function(event, field){
@@ -331,7 +331,7 @@ Form.Validator.adders = {
331331
},
332332

333333
addAllThese : function(validators){
334-
Array.from(validators).each(function(validator){
334+
Array.convert(validators).each(function(validator){
335335
this.add(validator[0], validator[1]);
336336
}, this);
337337
},

Source/Fx/Fx.Reveal.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Fx.Reveal = new Class({
7979
});
8080

8181
this.element.setStyles({
82-
display: Function.from(this.options.display).call(this),
82+
display: Function.convert(this.options.display).call(this),
8383
overflow: 'hidden'
8484
});
8585

@@ -136,7 +136,7 @@ Fx.Reveal = new Class({
136136

137137
var zero = {
138138
height: 0,
139-
display: Function.from(this.options.display).call(this)
139+
display: Function.convert(this.options.display).call(this)
140140
};
141141
Object.each(startStyles, function(style, name){
142142
zero[name] = 0;
@@ -150,7 +150,7 @@ Fx.Reveal = new Class({
150150

151151
this.$chain.unshift(function(){
152152
this.element.style.cssText = this.cssText;
153-
this.element.setStyle('display', Function.from(this.options.display).call(this));
153+
this.element.setStyle('display', Function.convert(this.options.display).call(this));
154154
if (!this.hidden) this.showing = false;
155155
if (hideThese) hideThese.setStyle('visibility', 'visible');
156156
this.callChain();

Source/Fx/Fx.Scroll.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Fx.Scroll = new Class({
104104
},
105105

106106
toElement: function(el, axes){
107-
axes = axes ? Array.from(axes) : ['x', 'y'];
107+
axes = axes ? Array.convert(axes) : ['x', 'y'];
108108
var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll();
109109
var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){
110110
return axes.contains(axis) ? value + scroll[axis] : false;
@@ -113,7 +113,7 @@ Fx.Scroll = new Class({
113113
},
114114

115115
toElementEdge: function(el, axes, offset){
116-
axes = axes ? Array.from(axes) : ['x', 'y'];
116+
axes = axes ? Array.convert(axes) : ['x', 'y'];
117117
el = document.id(el);
118118
var to = {},
119119
position = el.getPosition(this.element),
@@ -139,7 +139,7 @@ Fx.Scroll = new Class({
139139
},
140140

141141
toElementCenter: function(el, axes, offset){
142-
axes = axes ? Array.from(axes) : ['x', 'y'];
142+
axes = axes ? Array.convert(axes) : ['x', 'y'];
143143
el = document.id(el);
144144
var to = {},
145145
position = el.getPosition(this.element),

Source/Interface/HtmlTable.Select.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ HtmlTable = Class.refactor(HtmlTable, {
135135
deselectRow: function(row, _nocheck){
136136
if (!this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
137137

138-
this.selectedRows = new Elements(Array.from(this.selectedRows).erase(row));
138+
this.selectedRows = new Elements(Array.convert(this.selectedRows).erase(row));
139139
row.removeClass(this.options.classRowSelected);
140140
this.fireEvent('rowUnfocus', [row, this.selectedRows]);
141141
this.fireEvent('stateChanged');

Source/Interface/Keyboard.Extras.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Keyboard.implement({
3636
this._shortcuts = this._shortcuts || [];
3737
this._shortcutIndex = this._shortcutIndex || {};
3838

39-
shortcut.getKeyboard = Function.from(this);
39+
shortcut.getKeyboard = Function.convert(this);
4040
shortcut.name = name;
4141
this._shortcutIndex[name] = shortcut;
4242
this._shortcuts.push(shortcut);
@@ -75,7 +75,7 @@ Keyboard.implement({
7575
});
7676

7777
Keyboard.rebind = function(newKeys, shortcuts){
78-
Array.from(shortcuts).each(function(shortcut){
78+
Array.convert(shortcuts).each(function(shortcut){
7979
shortcut.getKeyboard().removeEvent(shortcut.keys, shortcut.handler);
8080
shortcut.getKeyboard().addEvent(newKeys, shortcut.handler);
8181
shortcut.keys = newKeys;

Source/Locale/Locale.Set.From.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Locale.Set.from = function(set, type){
4242
locale.sets = set.sets || {};
4343

4444
if (set.inherits){
45-
locale.inherits.locales = Array.from(set.inherits.locales);
45+
locale.inherits.locales = Array.convert(set.inherits.locales);
4646
locale.inherits.sets = set.inherits.sets || {};
4747
}
4848

Source/Locale/Locale.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Locale.Set = new Class({
127127
var value = Object.getFromPath(this.sets, key);
128128
if (value != null){
129129
var type = typeOf(value);
130-
if (type == 'function') value = value.apply(null, Array.from(args));
130+
if (type == 'function') value = value.apply(null, Array.convert(args));
131131
else if (type == 'object') value = Object.clone(value);
132132
return value;
133133
}
@@ -153,7 +153,7 @@ Locale.Set = new Class({
153153
},
154154

155155
inherit: function(names, set){
156-
names = Array.from(names);
156+
names = Array.convert(names);
157157

158158
if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
159159

Source/Types/Date.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,12 @@ Date.extend({
330330
},
331331

332332
units: {
333-
ms: Function.from(1),
334-
second: Function.from(1000),
335-
minute: Function.from(60000),
336-
hour: Function.from(3600000),
337-
day: Function.from(86400000),
338-
week: Function.from(608400000),
333+
ms: Function.convert(1),
334+
second: Function.convert(1000),
335+
minute: Function.convert(60000),
336+
hour: Function.convert(3600000),
337+
day: Function.convert(86400000),
338+
week: Function.convert(608400000),
339339
month: function(month, year){
340340
var d = new Date;
341341
return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000;

Source/Types/URI.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ URI.regs = {
156156
directoryDot: /\.\/|\.$/
157157
};
158158

159-
URI.base = new URI(Array.from(document.getElements('base[href]', true)).getLast(), {base: document.location});
159+
URI.base = new URI(Array.convert(document.getElements('base[href]', true)).getLast(), {base: document.location});
160160

161161
String.implement({
162162

Source/Utilities/Assets.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ var Asset = this.Asset = {
119119
},
120120

121121
images: function(sources, options){
122-
sources = Array.from(sources);
122+
sources = Array.convert(sources);
123123

124124
var fn = function(){},
125125
counter = 0;

Source/Utilities/IframeShim.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ var IframeShim = this.IframeShim = new Class({
8888
if (!IframeShim.ready) window.addEvent('load', inject);
8989
else inject();
9090
} else {
91-
this.position = this.hide = this.show = this.dispose = Function.from(this);
91+
this.position = this.hide = this.show = this.dispose = Function.convert(this);
9292
}
9393
},
9494

Specs/Class/Events.Pseudos.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ describe('Events.Pseudos', function(){
153153
original: 'e:test(foo)'
154154
});
155155
expect(fn).toEqual(eventFn);
156-
expect(Array.from(args)).toEqual(eventArgs);
156+
expect(Array.convert(args)).toEqual(eventArgs);
157157
expect(this).toEqual(e);
158158
});
159159

Specs/Element/Element.Event.Pseudos.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Element.Event.Pseudos', function(){
2525
original: 'e:test(foo)'
2626
});
2727
expect(fn).toEqual(eventFn);
28-
expect(Array.from(args)).toEqual(eventArgs);
28+
expect(Array.convert(args)).toEqual(eventArgs);
2929
});
3030

3131
var element = new Element('div');

Specs/Utilities/Color.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ describe('Color mutation', function(){
6161
describe('Color $methods', function(){
6262

6363
it('Tests $RGB', function(){
64-
expect(Array.from($RGB(127, 0, 0))).toEqual([127,0,0]);
64+
expect(Array.convert($RGB(127, 0, 0))).toEqual([127,0,0]);
6565
});
6666

6767
it('Tests $HSB', function(){
68-
expect(Array.from($HSB(50, 50, 100))).toEqual([255,234,128]);
68+
expect(Array.convert($HSB(50, 50, 100))).toEqual([255,234,128]);
6969
});
7070

7171
it('Tests $HEX', function(){
72-
expect(Array.from($HEX('#700'))).toEqual([281,0,0]);
72+
expect(Array.convert($HEX('#700'))).toEqual([281,0,0]);
7373
});
7474

7575
});

0 commit comments

Comments
 (0)