Skip to content

Commit

Permalink
feat: stash
Browse files Browse the repository at this point in the history
  • Loading branch information
npmstudy committed Oct 31, 2023
1 parent 5f69537 commit 55f2a69
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions packages/core2/aa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,33 @@ interface Strategy {
doAlgorithm(data: string[]): string[];
}

/**
* Concrete Strategies implement the algorithm while following the base Strategy
* interface. The interface makes them interchangeable in the Context.
*/
class ConcreteStrategyA implements Strategy {
public doAlgorithm(data: string[]): string[] {
return data.sort();
}
}
// /**
// * Concrete Strategies implement the algorithm while following the base Strategy
// * interface. The interface makes them interchangeable in the Context.
// */
// class ConcreteStrategyA implements Strategy {
// public doAlgorithm(data: string[]): string[] {
// return data.sort();
// }
// }

class ConcreteStrategyB implements Strategy {
public doAlgorithm(data: string[]): string[] {
return data.reverse();
}
}
// class ConcreteStrategyB implements Strategy {
// public doAlgorithm(data: string[]): string[] {
// return data.reverse();
// }
// }

/**
* The client code picks a concrete strategy and passes it to the context. The
* client should be aware of the differences between strategies in order to make
* the right choice.
*/
// const context = new Context(new ConcreteStrategyA());
// console.log('Client: Strategy is set to normal sorting.');
// context.start();
// /**
// * The client code picks a concrete strategy and passes it to the context. The
// * client should be aware of the differences between strategies in order to make
// * the right choice.
// */
// // const context = new Context(new ConcreteStrategyA());
// // console.log('Client: Strategy is set to normal sorting.');
// // context.start();

// console.log('');
// // console.log('');

// console.log('Client: Strategy is set to reverse sorting.');
// context.plugin(new ConcreteStrategyB());
// context.start();
// // console.log('Client: Strategy is set to reverse sorting.');
// // context.plugin(new ConcreteStrategyB());
// // context.start();

0 comments on commit 55f2a69

Please sign in to comment.