@vbarbarosh/node-helpers 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/array_index.js +1 -1
- package/src/array_index.test.js +14 -0
package/package.json
CHANGED
package/src/array_index.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import array_index from './array_index';
|
|
2
|
+
import assert from 'assert';
|
|
3
|
+
|
|
4
|
+
describe('array_index', function () {
|
|
5
|
+
it('should accept empty array', function () {
|
|
6
|
+
assert.deepStrictEqual(array_index([]), {});
|
|
7
|
+
});
|
|
8
|
+
it('should handle basic input', function () {
|
|
9
|
+
const a = {uid: 'a'};
|
|
10
|
+
const b = {uid: 'b'};
|
|
11
|
+
const c = {uid: 'c'};
|
|
12
|
+
assert.deepStrictEqual(array_index([a, b, c], v => v.uid), {a, b, c});
|
|
13
|
+
});
|
|
14
|
+
});
|