Last active
February 25, 2017 08:29
-
-
Save rjoydip-zz/cf2fd862a42be2946288f9e50b756268 to your computer and use it in GitHub Desktop.
This is the minified version of my library
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 s(n){return e(n)&&u(n)?!0:!1}function y(n){return n.map(function(n){return r(n)}).indexOf(!1)>0?!0:!1}function p(n){return n.filter(function(n){return e(n)?!1:u(n)?!1:!0})}function v(u){var o={};return Object.keys(u).forEach(function(i){return r(u[i])?a(u[i])?!1:o[i]=u[i]:e(u[i])?s(u[i])?!1:o[i]=u[i]:t(u[i])?y(u[i])?o[i]=p(u[i]):o[i]=p(u[i]):void((n(u[i])?o[i]=v(u[i]):!1)||(o[i]=u[i]))}),o}function d(n,r){var e=v(n);0!==Object.keys(e).length?r(null,e):!1}function b(n,r,e,t){return n.filter(function(n){return t?e>=n&&n>=r?n:!1:e>n&&n>r?n:!1})}function h(n,r,e,t){r.map(function(r){var u=r.split("-"),o=parseInt(u[0]),i=parseInt(u[1]);i>o?t(null,b(n,o,i,e)):t("Please check rules collection",null)})}var m={traverseOne:o,traverseAll:i,arrayDimention:f,removeNegative:d,collectLeafNodes:c,arrayFilterByrules:h};return m}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment