Skip to content

Instantly share code, notes, and snippets.

View XXimiCC's full-sized avatar

Andrew Hetmanenko XXimiCC

View GitHub Profile
@XXimiCC
XXimiCC / fieldArray
Created February 13, 2016 17:50
Заполняет массив значениями
/**
* Заполняет массив значениями value, любой размерности
* @example [].field(null, 2,2) в результате получим [[null,null], [null,null]]
* @param value значение которым нужно заполнить массив
* @returns {Array}
*/
Array.prototype.field = function field(value) {
var array = [],
nextDimensions = [].slice.call(arguments,2);
function observable(obj) {
obj._events = [];
obj.on = function (eventName, fn) {
this._events[eventName] = (this._events[eventName]) ? this._events[eventName] : [];
this._events[eventName].push({
fn: fn,
once: false