| | |
| | | Object.defineProperty(exports, '__esModule', { |
| | | value: true |
| | | }); |
| | | exports.arrayBufferEquality = void 0; |
| | | exports.emptyObject = emptyObject; |
| | | exports.isOneline = |
| | | exports.isError = |
| | | exports.partition = |
| | | exports.sparseArrayEquality = |
| | | exports.arrayBufferEquality = |
| | | exports.typeEquality = |
| | | exports.typeEquality = |
| | | exports.subsetEquality = |
| | | exports.sparseArrayEquality = |
| | | exports.pathAsArray = |
| | | exports.partition = |
| | | exports.iterableEquality = |
| | | exports.getObjectSubset = |
| | | exports.isOneline = |
| | | exports.isError = |
| | | exports.getPath = |
| | | exports.getObjectSubset = |
| | | void 0; |
| | | |
| | | var _jestGetType = require('jest-get-type'); |
| | |
| | | |
| | | const getPath = (object, propertyPath) => { |
| | | if (!Array.isArray(propertyPath)) { |
| | | propertyPath = propertyPath.split('.'); |
| | | propertyPath = pathAsArray(propertyPath); |
| | | } |
| | | |
| | | if (propertyPath.length) { |
| | |
| | | const result = [[], []]; |
| | | items.forEach(item => result[predicate(item) ? 0 : 1].push(item)); |
| | | return result; |
| | | }; // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693 |
| | | }; |
| | | |
| | | exports.partition = partition; |
| | | |
| | | const pathAsArray = propertyPath => { |
| | | const properties = []; |
| | | |
| | | if (propertyPath === '') { |
| | | properties.push(''); |
| | | return properties; |
| | | } // will match everything that's not a dot or a bracket, and "" for consecutive dots. |
| | | |
| | | const pattern = RegExp('[^.[\\]]+|(?=(?:\\.)(?:\\.|$))', 'g'); // Because the regex won't match a dot in the beginning of the path, if present. |
| | | |
| | | if (propertyPath[0] === '.') { |
| | | properties.push(''); |
| | | } |
| | | |
| | | propertyPath.replace(pattern, match => { |
| | | properties.push(match); |
| | | return match; |
| | | }); |
| | | return properties; |
| | | }; // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693 |
| | | |
| | | exports.pathAsArray = pathAsArray; |
| | | |
| | | const isError = value => { |
| | | switch (Object.prototype.toString.call(value)) { |
| | | case '[object Error]': |