{"size": 296, "ext": "js", "max_stars_repo_path": "JavaScript/3-complex.js", "max_stars_repo_name": "HowProgrammingWorks/Singleton", "max_stars_repo_stars_event_min_datetime": "2017-11-26T08:51:53.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-13T18:15:38.000Z", "max_issues_repo_path": "JavaScript/3) GOF Design Patterns/Creational/Singleton/JavaScript/3-complex.js", "max_issues_repo_name": "21Michael/JS-arch-learning", "max_issues_repo_issues_event_min_datetime": "2018-06-04T09:42:51.000Z", "max_issues_repo_issues_event_max_datetime": "2018-06-14T20:51:30.000Z", "max_forks_repo_path": "JavaScript/3) GOF Design Patterns/Creational/Singleton/JavaScript/3-complex.js", "max_forks_repo_name": "21Michael/JS-arch-learning", "max_forks_repo_forks_event_min_datetime": "2017-10-25T14:48:22.000Z", "max_forks_repo_forks_event_max_datetime": "2021-03-13T12:41:36.000Z"}
{"max_stars_count": 5, "max_issues_count": 1, "max_forks_count": 9, "avg_line_length": 14.8, "max_line_length": 52, "alphanum_fraction": 0.6047297297}
'use strict';

const Singleton = (() => {
  let instance;

  class Singleton {
    constructor() {
      if (instance) return instance;
      instance = this;
    }
  }

  return Singleton;
})();

// Usage

console.assert(new Singleton() === new Singleton());
console.log('instances are equal');
