Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metarhia-common

Package Overview
Dependencies
Maintainers
4
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metarhia-common - npm Package Compare versions

Comparing version 0.0.36 to 0.0.37

dist/lib/btree.js

1

common.js

@@ -6,2 +6,3 @@ 'use strict';

'auth', // Validation of data for authentication/authorization
'btree', // B-Tree for indexes in DB
'cache', // Cache (enhanced Map)

@@ -8,0 +9,0 @@ 'callbacks', // Callback utilities

@@ -13,2 +13,3 @@ 'use strict';

'auth', // Validation of data for authentication/authorization
'btree', // B-Tree for indexes in DB
'cache', // Cache (enhanced Map)

@@ -15,0 +16,0 @@ 'callbacks', // Callback utilities

@@ -90,2 +90,16 @@ 'use strict';

return emptiness;
}; // Check function
// fn - <Function>
// Returns: <Function> | <null>, function or null if fn is not a function
var unsafeFunction = function unsafeFunction(fn) {
return typeof fn === 'function' ? fn : null;
}; // Check function and make it safe
// fn - <Function>
// Returns: <Function>, function or `common.emptiness` if fn is not a function
var safeFunction = function safeFunction(fn) {
return typeof fn === 'function' ? fn : emptiness;
};

@@ -107,3 +121,5 @@

requiredCallback: requiredCallback,
onceCallback: onceCallback
onceCallback: onceCallback,
safeFunction: safeFunction,
unsafeFunction: unsafeFunction
};

2

dist/lib/data.js

@@ -116,3 +116,3 @@ 'use strict';

object = Object.create(null);
} else if (obj.constructor !== Object) {
} else if (obj.constructor.name !== 'Object') {
object = new obj.constructor(obj.toString());

@@ -119,0 +119,0 @@ } else {

@@ -369,2 +369,7 @@ /* eslint-disable no-use-before-define */

}
}, {
key: "enumerate",
value: function enumerate() {
return new EnumerateIterator(this);
}
}]);

@@ -749,2 +754,36 @@

var EnumerateIterator =
/*#__PURE__*/
function (_Iterator9) {
_inherits(EnumerateIterator, _Iterator9);
function EnumerateIterator(base) {
var _this9;
_classCallCheck(this, EnumerateIterator);
_this9 = _possibleConstructorReturn(this, _getPrototypeOf(EnumerateIterator).call(this, base));
_this9.index = 0;
return _this9;
}
_createClass(EnumerateIterator, [{
key: "next",
value: function next() {
var next = this.base.next();
if (next.done) {
return next;
}
return {
done: false,
value: [this.index++, next.value]
};
}
}]);
return EnumerateIterator;
}(Iterator);
var iter = function iter(base) {

@@ -751,0 +790,0 @@ return new Iterator(base);

@@ -83,2 +83,12 @@ 'use strict';

// Check function
// fn - <Function>
// Returns: <Function> | <null>, function or null if fn is not a function
const unsafeFunction = fn => (typeof fn === 'function' ? fn : null);
// Check function and make it safe
// fn - <Function>
// Returns: <Function>, function or `common.emptiness` if fn is not a function
const safeFunction = fn => (typeof fn === 'function' ? fn : emptiness);
module.exports = {

@@ -103,2 +113,5 @@ falseness,

onceCallback,
safeFunction,
unsafeFunction,
};

@@ -95,3 +95,3 @@ 'use strict';

object = Object.create(null);
} else if (obj.constructor !== Object) {
} else if (obj.constructor.name !== 'Object') {
object = new obj.constructor(obj.toString());

@@ -98,0 +98,0 @@ } else {

@@ -158,2 +158,6 @@ /* eslint-disable no-use-before-define */

}
enumerate() {
return new EnumerateIterator(this);
}
}

@@ -342,2 +346,17 @@

class EnumerateIterator extends Iterator {
constructor(base) {
super(base);
this.index = 0;
}
next() {
const next = this.base.next();
if (next.done) {
return next;
}
return { done: false, value: [this.index++, next.value] };
}
}
const iter = base => new Iterator(base);

@@ -344,0 +363,0 @@

{
"name": "metarhia-common",
"version": "0.0.36",
"version": "0.0.37",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -44,4 +44,4 @@ "description": "Metarhia Common Library",

"metasync": "^0.3.29",
"metatests": "^0.2.1"
"metatests": "^0.2.3"
}
}

@@ -392,1 +392,19 @@ 'use strict';

);
metatests.testSync('Iterator.enumerate must return tuples', test => {
let i = 0;
iter(array).enumerate().forEach(t => {
test.strictSame(t, [i, array[i]]);
i++;
});
});
metatests.testSync('Iterator.enumerate must start from 0', test => {
const it = iter(array);
it.next();
let i = 0;
it.enumerate().forEach(t => {
test.strictSame(t, [i, array[i + 1]]);
i++;
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc