Skip to content

Commit

Permalink
v1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioricali committed Jul 22, 2017
1 parent 8573771 commit 3d2fbb5
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 35 deletions.
155 changes: 123 additions & 32 deletions dist/be.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// [AIV] beJS Build version: 1.6.3
// [AIV] beJS Build version: 1.7.0
var be =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
Expand Down Expand Up @@ -1431,18 +1431,109 @@ var Interface = __webpack_require__(0);
var Mixed = {};

var regExp = {
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
hex: /^(?:0x)?[a-f0-9]+$/,
ipv4: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
ipv6: /^(([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-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0-9]$/
};

Mixed = Helpers.createRegExpMethods(Mixed, regExp);

/**
* Check if is ISWC
* **Interfaces**: `all`, `any`, `not`
*
* @function
* @name iswc
* @param value {string} ISWC code
* @returns {boolean}
* @example
* be.iswc('T-000000001-0') // true
*/

/**
* Check if is ISRC
* **Interfaces**: `all`, `any`, `not`
*
* @function
* @name isrc
* @param value {string} ISRC code
* @returns {boolean}
* @example
* be.isrc('JMK401400212') // true
*/

/**
* Check if is UUID
* **Interfaces**: `all`, `any`, `not`
*
* @function
* @name uuid
* @param value {string} UUID code
* @returns {boolean}
* @example
* be.uuid('9e3a0460-d72d-11e4-a631-c8e0eb141dab') // true
*/

/**
* Check if is UUID ver 1
* **Interfaces**: `all`, `any`, `not`
*
* @function
* @name uuid1
* @param value {string} UUID code
* @returns {boolean}
* @example
* be.uuid1('9e3a0460-d72d-11e4-a631-c8e0eb141dab') // true
*/

/**
* Check if is UUID ver 3
* **Interfaces**: `all`, `any`, `not`
*
* @function
* @name uuid3
* @param value {string} UUID code
* @returns {boolean}
* @example
* be.uuid3('2c1d43b8-e6d7-376e-af7f-d4bde997cc3f') // true
*/

/**
* Check if is UUID ver 4
* **Interfaces**: `all`, `any`, `not`
*
* @function
* @name uuid4
* @param value {string} UUID code
* @returns {boolean}
* @example
* be.uuid4('366a77ba-d506-4a03-a730-318b8e6be8c5') // true
*/

/**
* Check if is UUID ver 5
* **Interfaces**: `all`, `any`, `not`
*
* @function
* @name uuid5
* @param value {string} UUID code
* @returns {boolean}
* @example
* be.uuid5('39888f87-fb62-5988-a425-b2ea63f5b81e') // true
*/

/**
* Check if is valid email
* https://emailregex.com/
Expand Down Expand Up @@ -1561,7 +1652,7 @@ Mixed = Helpers.createRegExpMethods(Mixed, regExp);
* be.ipv('127.0.0.1') // true
*/
Mixed.ip = function (value) {
return Mixed.ipv4(value) || Mixed.ipv6(value);
return Mixed.ipv4(value) || Mixed.ipv6(value);
};

/**
Expand All @@ -1582,15 +1673,15 @@ Mixed.ip = function (value) {
* be.equal({a:1}, {a:1}) // true
*/
Mixed.equal = function (value, other) {
if (Types.all.number(value, other)) return value === other && 1 / value === 1 / other;else if (Types.all.string(value, other) || Types.all.regexp(value, other)) return value.toString() === other.toString();else if (Types.all.boolean(value, other)) return value === other;else if (Types.all.object(value, other) || Types.all.array(value, other)) {
if (Object.keys(value).length !== Object.keys(other).length) return false;
for (var prop in value) {
if (value.hasOwnProperty(prop) && other.hasOwnProperty(prop)) {
if (!Mixed.equal(value[prop], other[prop])) return false;
} else return false;
}
return true;
} else return false;
if (Types.all.number(value, other)) return value === other && 1 / value === 1 / other;else if (Types.all.string(value, other) || Types.all.regexp(value, other)) return value.toString() === other.toString();else if (Types.all.boolean(value, other)) return value === other;else if (Types.all.object(value, other) || Types.all.array(value, other)) {
if (Object.keys(value).length !== Object.keys(other).length) return false;
for (var prop in value) {
if (value.hasOwnProperty(prop) && other.hasOwnProperty(prop)) {
if (!Mixed.equal(value[prop], other[prop])) return false;
} else return false;
}
return true;
} else return false;
};

Mixed.equal.multiple = false;
Expand All @@ -1608,12 +1699,12 @@ Mixed.equal.multiple = false;
* be.hexColor('#ff0000') // true
*/
Mixed.hexColor = function (value) {
try {
value = value.replace('#', '');
return Mixed.hex(value) && (value.length === 3 || value.length === 6);
} catch (e) {
return false;
}
try {
value = value.replace('#', '');
return Mixed.hex(value) && (value.length === 3 || value.length === 6);
} catch (e) {
return false;
}
};

/**
Expand All @@ -1633,11 +1724,11 @@ Mixed.hexColor = function (value) {
* be.compareVersion('1.0.2', '==', '1.0.3', true) // true
*/
Mixed.compareVersion = function (a, operator, b, major) {
if (major) {
a = a.split('.')[0];
b = b.split('.')[0];
}
return Helpers.comparators[operator](a, b);
if (major) {
a = a.split('.')[0];
b = b.split('.')[0];
}
return Helpers.comparators[operator](a, b);
};

Mixed = Interface.create(Mixed);
Expand Down Expand Up @@ -1696,7 +1787,7 @@ module.exports = __webpack_require__(6);

var Helpers = __webpack_require__(2);
var Interface = __webpack_require__(0);
var version = '1.6.3';
var version = '1.7.0';

/**
* be class
Expand Down Expand Up @@ -5927,7 +6018,7 @@ module.exports = DOM;

module.exports = {
"name": "bejs",
"version": "1.6.3",
"version": "1.7.0",
"description": "Simple, light-weight assertions framework for javascript",
"homepage": "https://be.js.org",
"main": "index.js",
Expand Down
4 changes: 2 additions & 2 deletions dist/be.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bejs",
"version": "1.6.3",
"version": "1.7.0",
"description": "Simple, light-weight assertions framework for javascript",
"homepage": "https://be.js.org",
"main": "index.js",
Expand Down

0 comments on commit 3d2fbb5

Please sign in to comment.