Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cleanPositionalOperators.js 327B

123456789101112
  1. 'use strict';
  2. /**
  3. * For consistency's sake, we replace positional operator `$` and array filters
  4. * `$[]` and `$[foo]` with `0` when looking up schema paths.
  5. */
  6. module.exports = function cleanPositionalOperators(path) {
  7. return path.
  8. replace(/\.\$(\[[^\]]*\])?\./g, '.0.').
  9. replace(/\.(\[[^\]]*\])?\$$/g, '.0');
  10. };