This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var countryJson = [ | |
{"name":"Israel","dial_code":"+972","code":"IL"}, | |
{"name":"Afghanistan","dial_code":"+93","code":"AF"}, | |
{"name":"Albania","dial_code":"+355","code":"AL"}, | |
{"name":"Algeria","dial_code":"+213","code":"DZ"}, | |
{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"}, | |
{"name":"Andorra","dial_code":"+376","code":"AD"}, | |
{"name":"Angola","dial_code":"+244","code":"AO"}, | |
{"name":"Anguilla","dial_code":"+1 264","code":"AI"}, | |
{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(n,r){"function"==typeof define&&define.amd?define([""],function(e){return n.RjLib=r(e)}):"object"==typeof module&&module.exports?module.exports=n.RjLib=r(require("")):n.RjLib=r(n.postal)}(this,function(){function n(n){return"object"==typeof n}function r(n){return"number"==typeof n}function e(n){return"string"==typeof n}function t(n){return Array.isArray(n)}function u(n){return 0>n}function o(r,e){var t=r;Object.keys(t).forEach(function(r,u){""!==t[r]&&void 0!==t[r]?e(null,r,n(t[r])):e(r+" has no values",null,null)})}function i(r,e){Object.keys(r).forEach(function(t){n(r[t])?(i(r[t],e),e(null,t,!0)):e(null,t,!1)})}function c(r,e){Object.keys(r).forEach(function(t){n(r[t])?c(r[t],e):e(null,t,r[t])})}function f(){var n=Array.prototype.slice.call(arguments);return 0===n[0].length?n[1]("Array is empty"):n[1](l(n[0]))}function l(n){var r=[];for(var e in n)r.push(Array.isArray(n[e]));return r.indexOf(!0)>-1?r.indexOf(!1)>-1?"Please check your array":"2D":"1D"}function a(n){return r(n)&&u(n)?!0:!1}function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function traverse (obj, callback) { | |
Object.keys(obj).forEach(function(value){ | |
if (typeof obj[value] == 'object') { | |
traverse(obj[value],callback); | |
callback(value,true); | |
} | |
else { | |
callback(value,false) | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isObject(obj){ | |
return (typeof obj === 'object') ? true : false; | |
} | |
function traverse (json, callback) { | |
JSON.parse(json, function (key, value) { | |
if (key !== '') { | |
callback.call(this, key, isObject(value)) | |
} | |
return value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function traversObj(){ | |
var args = Array.prototype.slice.call(arguments); | |
(args.length > 0) ? (typeof args[0] == 'object' && typeof args[1] == 'function') ? traverseObjFn(args[0],args[1]) : 'Arguments are incorrect' : 'Incorrect function arguments'; | |
} | |
function isObject(obj){ | |
return (typeof obj === 'object') ? true : false; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (root, factory) { | |
if(typeof define === "function" && define.amd) { | |
// Now we're wrapping the factory and assigning the return | |
// value to the root (window) and returning it as well to | |
// the AMD loader. | |
define([""], function(postal){ | |
return (root.RjLib = factory(postal)); | |
}); | |
} else if(typeof module === "object" && module.exports) { | |
// I've not encountered a need for this yet, since I haven't |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RjLib = (function RjLib() { | |
var _helloText = 'Hello world'; | |
/* | |
** This constructor can be annoynomus | |
** or it can have function name | |
*/ | |
// Return the constructor | |
return function(){ | |
var _this = this; // Cache the `this` keyword | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arrayDimentionObject = { | |
arrayDimention : arrayDimentionFn, | |
f1 : f1 | |
}; | |
/* | |
** This function is deciding whether array is either | |
** 2D or 1D or array is fully proper array or not. | |
** @params args taking arguments | |
** @params arg[0] : Array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function RjLib(){ | |
/* | |
** returning public function for the api | |
** this public function is accessable to user | |
*/ | |
return { | |
arrayDimention : RjLib.prototype.arrayDimention | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fn = (function(){ | |
/* | |
** This function is deciding whether array is either | |
** 2D or 1D or array is fully proper array or not. | |
** @params args taking arguments | |
** @params arg[0] : Array | |
** @params arg[1] : callback function | |
*/ | |
function arrayDimention(){ |
NewerOlder