Hello community,
here is the log from the commit of package nodejs-assert-plus for
openSUSE:Factory checked in at 2015-06-30 10:16:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nodejs-assert-plus (Old)
and /work/SRC/openSUSE:Factory/.nodejs-assert-plus.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nodejs-assert-plus"
Changes:
--------
--- /work/SRC/openSUSE:Factory/nodejs-assert-plus/nodejs-assert-plus.changes
2015-04-27 13:00:00.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.nodejs-assert-plus.new/nodejs-assert-plus.changes
2015-06-30 10:16:52.000000000 +0200
@@ -1,0 +2,5 @@
+Fri Jun 26 17:06:49 UTC 2015 - [email protected]
+
+- update version 0.1.5
+
+-------------------------------------------------------------------
Old:
----
assert-plus-0.1.2.tgz
New:
----
assert-plus-0.1.5.tgz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ nodejs-assert-plus.spec ++++++
--- /var/tmp/diff_new_pack.j98Bzw/_old 2015-06-30 10:16:52.000000000 +0200
+++ /var/tmp/diff_new_pack.j98Bzw/_new 2015-06-30 10:16:52.000000000 +0200
@@ -19,7 +19,7 @@
%define base_name assert-plus
Name: nodejs-assert-plus
-Version: 0.1.2
+Version: 0.1.5
Release: 0
Summary: Extra assertions on top of node's assert module
License: MIT
++++++ assert-plus-0.1.2.tgz -> assert-plus-0.1.5.tgz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/assert.js new/package/assert.js
--- old/package/assert.js 2012-09-18 23:44:03.000000000 +0200
+++ new/package/assert.js 2013-11-25 18:14:41.000000000 +0100
@@ -9,6 +9,7 @@
///--- Globals
var NDEBUG = process.env.NODE_NDEBUG || false;
+var UUID_REGEXP =
/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
@@ -53,6 +54,28 @@
}
+function _instanceof(arg, type, name, stackFunc) {
+ if (!NDEBUG) {
+ name = name || type;
+ stackFunc = stackFunc || _instanceof.caller;
+
+ if (!(arg instanceof type)) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, type.name),
+ actual: _getClass(arg),
+ expected: type.name,
+ operator: 'instanceof',
+ stackStartFunction: stackFunc
+ });
+ }
+ }
+}
+
+function _getClass(object) {
+ return (Object.prototype.toString.call(object).slice(8, -1));
+};
+
+
///--- API
@@ -85,7 +108,7 @@
function buffer(arg, name) {
if (!Buffer.isBuffer(arg)) {
throw new assert.AssertionError({
- message: _(TYPE_REQUIRED, name, type),
+ message: _(TYPE_REQUIRED, name || '', 'Buffer'),
actual: typeof (arg),
expected: 'buffer',
operator: 'Buffer.isBuffer',
@@ -102,6 +125,15 @@
function number(arg, name) {
_assert(arg, 'number', name);
+ if (!NDEBUG && (isNaN(arg) || !isFinite(arg))) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, 'number'),
+ actual: arg,
+ expected: 'number',
+ operator: 'isNaN',
+ stackStartFunction: number
+ });
+ }
}
@@ -111,15 +143,16 @@
function stream(arg, name) {
- if (!(arg instanceof Stream)) {
- throw new assert.AssertionError({
- message: _(TYPE_REQUIRED, name, type),
- actual: typeof (arg),
- expected: 'Stream',
- operator: 'instanceof',
- stackStartFunction: buffer
- });
- }
+ _instanceof(arg, Stream, name);
+}
+
+
+function date(arg, name) {
+ _instanceof(arg, Date, name);
+}
+
+function regexp(arg, name) {
+ _instanceof(arg, RegExp, name);
}
@@ -128,17 +161,33 @@
}
+function uuid(arg, name) {
+ string(arg, name);
+ if (!NDEBUG && !UUID_REGEXP.test(arg)) {
+ throw new assert.AssertionError({
+ message: _(TYPE_REQUIRED, name, 'uuid'),
+ actual: 'string',
+ expected: 'uuid',
+ operator: 'test',
+ stackStartFunction: uuid
+ });
+ }
+}
+
///--- Exports
module.exports = {
bool: bool,
buffer: buffer,
+ date: date,
func: func,
number: number,
object: object,
+ regexp: regexp,
stream: stream,
- string: string
+ string: string,
+ uuid: uuid
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/package.json new/package/package.json
--- old/package/package.json 2012-09-18 23:44:18.000000000 +0200
+++ new/package/package.json 2013-11-25 18:23:20.000000000 +0100
@@ -1,13 +1,16 @@
{
- "author": "Mark Cavage <[email protected]>",
- "name": "assert-plus",
- "description": "Extra assertions on top of node's assert module",
- "version": "0.1.2",
- "main": "./assert.js",
- "dependencies": {},
- "devDependencies": {},
- "optionalDependencies": {},
- "engines": {
- "node": ">=0.6"
- }
+ "author": "Mark Cavage <[email protected]>",
+ "name": "assert-plus",
+ "description": "Extra assertions on top of node's assert module",
+ "version": "0.1.5",
+ "main": "./assert.js",
+ "devDependencies": {},
+ "optionalDependencies": {},
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mcavage/node-assert-plus.git"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
}