mongo works

This commit is contained in:
counterweight 2025-06-01 23:23:55 +02:00
parent ae6ccd559f
commit 125107da50
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
937 changed files with 205033 additions and 2 deletions

View file

@ -0,0 +1,4 @@
env:
mocha: true
rules:
no-unused-vars: off

1879
parts/3/followAlong/node_modules/mpath/test/index.js generated vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
'use strict';
const assert = require('assert');
const stringToParts = require('../lib/stringToParts');
describe('stringToParts', function() {
it('handles brackets for numbers', function() {
assert.deepEqual(stringToParts('list[0].name'), ['list', '0', 'name']);
assert.deepEqual(stringToParts('list[0][1].name'), ['list', '0', '1', 'name']);
});
it('handles dot notation', function() {
assert.deepEqual(stringToParts('a.b.c'), ['a', 'b', 'c']);
assert.deepEqual(stringToParts('a..b.d'), ['a', '', 'b', 'd']);
});
it('ignores invalid numbers in square brackets', function() {
assert.deepEqual(stringToParts('foo[1mystring]'), ['foo[1mystring]']);
assert.deepEqual(stringToParts('foo[1mystring].bar[1]'), ['foo[1mystring]', 'bar', '1']);
assert.deepEqual(stringToParts('foo[1mystring][2]'), ['foo[1mystring]', '2']);
});
it('handles empty string', function() {
assert.deepEqual(stringToParts(''), ['']);
});
it('handles trailing dot', function() {
assert.deepEqual(stringToParts('a.b.'), ['a', 'b', '']);
});
});