Skip to content

Commit

Permalink
fix: move comment to separate PR
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Oct 9, 2022
1 parent d2f71cc commit 213f934
Showing 1 changed file with 0 additions and 100 deletions.
100 changes: 0 additions & 100 deletions packages/store/src/patterns/patternMatchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1514,106 +1514,6 @@ const makePatternKit = () => {
check(false, X`CopyMap not yet supported as keys`),
});

// const splitRecordParts = (
// specimen,
// requiredPatt,
// optionalPatt = undefined,
// ) => {
// // Not frozen! Mutated in place
// const requiredEntries = [];
// const optionalEntries = [];
// const restEntries = [];
// for (const [name, value] of entries(specimen)) {
// if (hasOwnPropertyOf(requiredPatt, name)) {
// requiredEntries.push([name, value]);
// } else if (
// optionalPatt !== undefined &&
// hasOwnPropertyOf(optionalPatt, name)
// ) {
// if (value !== undefined) {
// // For the optional parts, an undefined specimen value
// // matches unconditionally.
// optionalEntries.push([name, value]);
// }
// } else {
// restEntries.push([name, value]);
// }
// }
// return harden({
// requiredSpecimen: fromEntries(requiredEntries),
// optionalSpecimen: fromEntries(optionalEntries),
// restSpecimen: fromEntries(restEntries),
// });
// };

// /** @type {MatchHelper} */
// const matchSplitRecordHelper = Far('match:splitRecord helper', {
// checkMatches: (
// specimen,
// [requiredPatt, optionalPatt = undefined, restPatt = undefined],
// check,
// ) => {
// if (!checkKind(specimen, 'copyRecord', check)) {
// return false;
// }
// const { requiredSpecimen, optionalSpecimen, restSpecimen } =
// splitRecordParts(specimen, requiredPatt, optionalPatt);
// return (
// checkMatches(requiredSpecimen, requiredPatt, check, 'required-parts') &&
// (optionalPatt === undefined ||
// checkMatches(
// optionalSpecimen,
// optionalPatt,
// check,
// 'optional-parts',
// )) &&
// (restPatt === undefined ||
// checkMatches(restSpecimen, restPatt, check, 'rest-parts'))
// );
// },

// checkIsWellFormed: (splitArgs, check) => {
// if (
// passStyleOf(splitArgs) === 'copyArray' &&
// (splitArgs.length >= 1 || splitArgs.length <= 3)
// ) {
// const [requiredPatt, optionalPatt = undefined, restPatt = undefined] =
// splitArgs;
// if (
// isPattern(requiredPatt) &&
// passStyleOf(requiredPatt) === 'copyRecord' &&
// (optionalPatt === undefined ||
// (isPattern(optionalPatt) &&
// passStyleOf(optionalPatt) === 'copyRecord')) &&
// (restPatt === undefined || isPattern(restPatt))
// ) {
// return true;
// }
// }
// return check(
// false,
// X`Must be an array of a requiredPatt record, an optional optionalPatt record, and an optional restPatt: ${q(
// splitArgs,
// )}`,
// );
// },

// getRankCover: ([
// requiredPatt,
// _optionalPatt = undefined,
// _restPatt = undefined,
// ]) => getPassStyleCover(passStyleOf(requiredPatt)),

// checkKeyPattern: (
// [requiredPatt, _optionalPatt = undefined, _restPatt = undefined],
// check,
// ) =>
// check(
// false,
// X`${q(passStyleOf(requiredPatt))} not yet supported as keys`,
// ),
// });

/** @type {MatchHelper} */
const matchSplitHelper = Far('match:split helper', {
checkMatches: (specimen, [base, rest = undefined], check) => {
Expand Down

0 comments on commit 213f934

Please sign in to comment.