项目原始demo,不改动
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

27 lines
719 B

  1. import { root } from './root';
  2. export function minimalSetImpl() {
  3. // THIS IS NOT a full impl of Set, this is just the minimum
  4. // bits of functionality we need for this library.
  5. return class MinimalSet {
  6. constructor() {
  7. this._values = [];
  8. }
  9. add(value) {
  10. if (!this.has(value)) {
  11. this._values.push(value);
  12. }
  13. }
  14. has(value) {
  15. return this._values.indexOf(value) !== -1;
  16. }
  17. get size() {
  18. return this._values.length;
  19. }
  20. clear() {
  21. this._values.length = 0;
  22. }
  23. }
  24. ;
  25. }
  26. export const Set = root.Set || minimalSetImpl();
  27. //# sourceMappingURL=Set.js.map