v0.0.4Published 9 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Useful Object Extensions for Meteor


  • Date.now() - Fix for ES if Date object has not now() method


  • Math.getRandom(min, max) - Get random number between max and min values, by default max is 1000 and min is 0


  • Object.defineReactiveProperty(target, prop, value, callback, getCallback, setCallback) - define Reactive property with callbacks:
    • set callback before Setter and Getter
    • set callback on Setter
    • set callback on Getter
  • someArray.inArray(needle, searchInKey, searchByKey) - Extend Object prototype within inArray function
  • someArray.diff(comparableArray) - Compare two array, if matches found - return array of matches. If second parameter is true returns true/false if matches found/doesn't found
  • someObj.walk(callback) - Extend Object prototype within walk function callback, callback(object, value, key){}
  • Object.Merge - Merge the enumerable attributes of two objects deeply
  • someArray.random() - Extend Object prototype within random value pick up functionality for arrays


  • RegExp.escape(string) - Function is used to escape all dangerous/reserved symbols in strings before creating RegExp with it


  • String.generate(length, symbols) - Generate random string from 1 to 10 symbols length, or with provided length, and made of provided symbols
  • String.random(Boolean) - Generate random string from 2 to 111 symbols length, if the only parameter is true - generate string without unsafely chars. Additionally you can provide length, and symbols as first and second parameter, so this function will act as alias for String.generate(length, symbols)
  • someString.clone() - Clone (a.k.a. create singleton) of String object. This method allows to resolve issue with variable's referencing. See performance here

clone() example:

1var str = 'abc';
2var str2 = str.clone();
3str = 'cde';
4console.log(str2); //-> 'abc'