master 2c27009813f6 cached
18 files
11.3 KB
3.6k tokens
111 symbols
1 requests
Download .txt
Repository: vladilenm/js-patterns-youtube
Branch: master
Commit: 2c27009813f6
Files: 18
Total size: 11.3 KB

Directory structure:
gitextract_ziuw_gsl/

├── .gitignore
├── 1 creational/
│   ├── 1_constructor.js
│   ├── 2_factory.js
│   ├── 3_prototype.js
│   └── 4_singleton.js
├── 2 structural/
│   ├── 5_adapter.js
│   ├── 6_decorator.js
│   ├── 7_facade.js
│   ├── 8_flyweight.js
│   └── 9_proxy.js
└── 3 behaviour/
    ├── 10_chain_of_responsibility.js
    ├── 11_comand.js
    ├── 12_iterator.js
    ├── 13_mediator.js
    ├── 14_observer.js
    ├── 15_state.js
    ├── 16_strategy.js
    └── 17_template.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.idea


================================================
FILE: 1 creational/1_constructor.js
================================================
// function Server(name, ip) {
//   this.name = name
//   this.ip = ip
// }
//
// Server.prototype.getUrl = function() {
//   return `https://${this.ip}:80`
// }

class Server {
  constructor(name, ip) {
    this.name = name
    this.ip = ip
  }

  getUrl() {
    return `https://${this.ip}:80`
  }
}

const aws = new Server('AWS German', '82.21.21.32')
console.log(aws.getUrl())


================================================
FILE: 1 creational/2_factory.js
================================================
class SimpleMembership {
  constructor(name) {
    this.name = name
    this.cost = 50
  }
}

class StandardMembership {
  constructor(name) {
    this.name = name
    this.cost = 150
  }
}

class PremiumMembership {
  constructor(name) {
    this.name = name
    this.cost = 500
  }
}

class MemberFactory {
  static list = {
    simple: SimpleMembership,
    standard: StandardMembership,
    premium: PremiumMembership
  }

  create(name, type = 'simple') {
    const Membership = MemberFactory.list[type] || MemberFactory.list.simple
    const member = new Membership(name)
    member.type = type
    member.define = function() {
      console.log(`${this.name} (${this.type}): ${this.cost}`)
    }
    return member
  }
}

const factory = new MemberFactory()

const members = [
  factory.create('Vladilen', 'simple'),
  factory.create('Elena', 'premium'),
  factory.create('Vasilisa', 'standard'),
  factory.create('Ivan', 'premium'),
  factory.create('Petr')
]

members.forEach(m => {
  m.define()
})


================================================
FILE: 1 creational/3_prototype.js
================================================
const car = {
  wheels: 4,

  init() {
    console.log(`У меня есть ${this.wheels} колеса, мой владелец ${this.owner}`)
  }
}

const carWithOwner = Object.create(car, {
  owner: {
    value: 'Дмитрий'
  }
})

console.log(carWithOwner.__proto__ === car)

carWithOwner.init()


================================================
FILE: 1 creational/4_singleton.js
================================================
class Database {
  constructor(data) {
    if (Database.exists) {
      return Database.instance
    }
    Database.instance = this
    Database.exists = true
    this.data = data
  }

  getData() {
    return this.data
  }
}

const mongo = new Database('MongoDB')
console.log(mongo.getData())

const mysql = new Database('MySQL')
console.log(mysql.getData())




================================================
FILE: 2 structural/5_adapter.js
================================================
class OldCalc {
  operations(t1, t2, operation) {
    switch (operation) {
      case 'add': return t1 + t2
      case 'sub': return t1 - t2
      default: return NaN
    }
  }
}

class NewCalc {
  add(t1, t2) {
    return t1 + t2
  }

  sub(t1, t2) {
    return t1 - t2
  }
}

class CalcAdapter {
  constructor() {
    this.calc = new NewCalc()
  }

  operations(t1, t2, operation) {
    switch (operation) {
      case 'add': return this.calc.add(t1, t2)
      case 'sub': return this.calc.sub(t1, t2)
      default: return NaN
    }
  }
}

const oldCalc = new OldCalc()
console.log(oldCalc.operations(10, 5, 'add'))

const newCalc = new NewCalc()
console.log(newCalc.add(10, 5))

const adapter = new CalcAdapter()
console.log(adapter.operations(25, 10, 'sub'))




================================================
FILE: 2 structural/6_decorator.js
================================================
class Server {
  constructor(ip, port) {
    this.ip = ip
    this.port = port
  }

  get url() {
    return `https://${this.ip}:${this.port}`
  }
}

function aws(server) {
  server.isAWS = true
  server.awsInfo = function() {
    return server.url
  }
  return server
}

function azure(server) {
  server.isAzure = true
  server.port += 500
  return server
}

const s1 = aws(new Server('12.34.56.78', 8080))
console.log(s1.isAWS)
console.log(s1.awsInfo())

const s2 = azure(new Server('98.87.76.12', 1000))
console.log(s2.isAzure)
console.log(s2.url)


================================================
FILE: 2 structural/7_facade.js
================================================
class Complaints {
  constructor() {
    this.complaints = []
  }

  reply(complaint) {}

  add(complaint) {
    this.complaints.push(complaint)
    return this.reply(complaint)
  }
}

class ProductComplaints extends Complaints {
  reply({id, customer, details}) {
    return `Product: ${id}: ${customer} (${details})`
  }
}

class ServiceComplaints extends Complaints {
  reply({id, customer, details}) {
    return `Service: ${id}: ${customer} (${details})`
  }
}

class ComplaintRegistry {
  register(customer, type, details) {
    const id = Date.now()
    let complaint

    if (type === 'service') {
      complaint = new ServiceComplaints()
    } else {
      complaint = new ProductComplaints()
    }

    return complaint.add({id, customer, details})
  }
}

const registry = new ComplaintRegistry()

console.log(registry.register('Vladilen', 'service', 'недоступен'))
console.log(registry.register('Elena', 'product', 'вылазит ошибка'))



================================================
FILE: 2 structural/8_flyweight.js
================================================
class Car {
  constructor(model, price) {
    this.model = model
    this.price = price
  }
}

class CarFactory {
  constructor() {
    this.cars = []
  }

  create(model, price) {
    const candidate = this.getCar(model)
    if (candidate) {
      return candidate
    }

    const newCar = new Car(model, price)
    this.cars.push(newCar)
    return newCar
  }

  getCar(model) {
    return this.cars.find(car => car.model === model)
  }
}

const factory = new CarFactory()

const bmwX6 = factory.create('bmw', 10000)
const audi = factory.create('audi', 12000)
const bmwX3 = factory.create('bmw', 8000)

console.log(bmwX3 === bmwX6)



================================================
FILE: 2 structural/9_proxy.js
================================================
function networkFetch(url) {
  return `${url} - Ответ с сервера`
}

const cache = new Set()
const proxiedFetch = new Proxy(networkFetch, {
  apply(target, thisArg, args) {
    const url = args[0]
    if (cache.has(url)) {
      return `${url} - Ответ из кэша`
    } else {
      cache.add(url)
      return Reflect.apply(target, thisArg, args)
    }
  }
})

console.log(proxiedFetch('angular.io'))
console.log(proxiedFetch('react.io'))
console.log(proxiedFetch('angular.io'))


================================================
FILE: 3 behaviour/10_chain_of_responsibility.js
================================================
class MySum {
  constructor(initialValue = 42) {
    this.sum = initialValue
  }

  add(value) {
    this.sum += value
    return this
  }
}

const sum1 = new MySum()
console.log(sum1.add(8).add(10).add(1).add(9).sum)

const sum2 = new MySum(0)
console.log(sum2.add(1).add(2).add(3).sum)


================================================
FILE: 3 behaviour/11_comand.js
================================================
class MyMath {
  constructor(initialValue = 0) {
    this.num = initialValue
  }

  square() {
    return this.num ** 2
  }

  cube() {
    return this.num ** 3
  }
}

class Command {
  constructor(subject) {
    this.subject = subject
    this.commandsExecuted = []
  }

  execute(command) {
    this.commandsExecuted.push(command)
    return this.subject[command]()
  }
}

const x = new Command(new MyMath(2))

console.log(x.execute('square'))
console.log(x.execute('cube'))

console.log(x.commandsExecuted)



================================================
FILE: 3 behaviour/12_iterator.js
================================================
class MyIterator {
  constructor(data) {
    this.index = 0
    this.data = data
  }

  [Symbol.iterator]() {
    return {
      next: () => {
        if (this.index < this.data.length) {
          return {
            value: this.data[this.index++],
            done: false
          }
        } else {
          this.index = 0
          return {
            done: true,
            value: void 0
          }
        }
      }
    }
  }
}

function* generator(collection) {
  let index = 0

  while (index < collection.length) {
    yield collection[index++]
  }
}


const iterator = new MyIterator(['This', 'is', 'iterator'])
const gen = generator(['This', 'is', 'iterator'])

// for (const val of gen) {
//   console.log('Value: ', val)
// }

console.log(gen.next().value)
console.log(gen.next().value)
console.log(gen.next().value)




================================================
FILE: 3 behaviour/13_mediator.js
================================================
class User {
  constructor(name) {
    this.name = name
    this.room = null
  }

  send(message, to) {
    this.room.send(message, this, to)
  }

  receive(message, from) {
    console.log(`${from.name} => ${this.name}: ${message}`)
  }
}

class ChatRoom {
  constructor() {
    this.users = {}
  }

  register(user) {
    this.users[user.name] = user
    user.room = this
  }

  send(message, from, to) {
    if (to) {
      to.receive(message, from)
    } else {
      Object.keys(this.users).forEach(key => {
        if (this.users[key] !== from) {
          this.users[key].receive(message, from)
        }
      })
    }
  }
}

const vlad = new User('Vladilen')
const lena = new User('Elena')
const igor = new User('Igor')

const room = new ChatRoom()

room.register(vlad)
room.register(lena)
room.register(igor)

vlad.send('Hello!', lena)
lena.send('Hello hello!', vlad)
igor.send('Vsem privet')


================================================
FILE: 3 behaviour/14_observer.js
================================================
class Subject {
  constructor() {
    this.observers = []
  }

  subscribe(observer) {
    this.observers.push(observer)
  }

  unsubscribe(observer) {
    this.observers = this.observers.filter(obs => obs !== observer)
  }

  fire(action) {
    this.observers.forEach(observer => {
      observer.update(action)
    })
  }
}

class Observer {
  constructor(state = 1) {
    this.state = state
    this.initialState = state
  }

  update(action) {
    switch (action.type) {
      case 'INCREMENT':
        this.state = ++this.state
        break
      case 'DECREMENT':
        this.state = --this.state
        break
      case 'ADD':
        this.state += action.payload
        break
      default:
        this.state = this.initialState
    }
  }
}

const stream$ = new Subject()

const obs1 = new Observer()
const obs2 = new Observer(42)

stream$.subscribe(obs1)
stream$.subscribe(obs2)

stream$.fire({type: 'INCREMENT'})
stream$.fire({type: 'INCREMENT'})
stream$.fire({type: 'DECREMENT'})
stream$.fire({type: 'ADD', payload: 10})

console.log(obs1.state)
console.log(obs2.state)


================================================
FILE: 3 behaviour/15_state.js
================================================
class Light {
  constructor(light) {
    this.light = light
  }
}

class RedLight extends Light {
  constructor() {
    super('red')
  }

  sign() {
    return 'СТОП'
  }
}

class YellowLight extends Light {
  constructor() {
    super('yellow')
  }

  sign() {
    return 'ГОТОВЬСЯ'
  }
}

class GreenLight extends Light {
  constructor() {
    super('green')
  }

  sign() {
    return 'ЕДЬ!'
  }
}

class TrafficLight {
  constructor() {
    this.states = [
      new RedLight(),
      new YellowLight(),
      new GreenLight()
    ]
    this.current = this.states[0]
  }

  change() {
    const total = this.states.length
    let index = this.states.findIndex(light => light === this.current)

    if (index + 1 < total) {
      this.current = this.states[index + 1]
    } else {
      this.current = this.states[0]
    }
  }

  sign() {
    return this.current.sign()
  }
}

const traffic = new TrafficLight()
console.log(traffic.sign())
traffic.change()

console.log(traffic.sign())
traffic.change()

console.log(traffic.sign())
traffic.change()

console.log(traffic.sign())
traffic.change()

console.log(traffic.sign())
traffic.change()

console.log(traffic.sign())
traffic.change()


================================================
FILE: 3 behaviour/16_strategy.js
================================================
class Vehicle {
  travelTime() {
    return this.timeTaken
  }
}

class Bus extends Vehicle {
  constructor() {
    super()
    this.timeTaken = 10
  }
}

class Taxi extends Vehicle {
  constructor() {
    super()
    this.timeTaken = 5
  }
}

class Car extends Vehicle {
  constructor() {
    super()
    this.timeTaken = 3
  }
}

class Commute {
  travel(transport) {
    return transport.travelTime()
  }
}

const commute = new Commute()

console.log(commute.travel(new Taxi()))
console.log(commute.travel(new Bus()))
console.log(commute.travel(new Car()))


================================================
FILE: 3 behaviour/17_template.js
================================================
class Employee {
  constructor(name, salary) {
    this.name = name
    this.salary = salary
  }

  responsibilities() {}

  work() {
    return `${this.name} выполняет ${this.responsibilities()}`
  }

  getPaid() {
    return `${this.name} имеет ЗП ${this.salary}`
  }
}

class Developer extends Employee {
  constructor(name, salary) {
    super(name, salary)
  }

  responsibilities() {
    return 'процесс создания программ'
  }
}

class Tester extends Employee {
  constructor(name, salary) {
    super(name, salary)
  }

  responsibilities() {
    return 'процесс тестирования'
  }
}

const dev = new Developer('Владилен', 100000)
console.log(dev.getPaid())
console.log(dev.work())

const tester = new Tester('Виктория', 90000)
console.log(tester.getPaid())
console.log(tester.work())
Download .txt
gitextract_ziuw_gsl/

├── .gitignore
├── 1 creational/
│   ├── 1_constructor.js
│   ├── 2_factory.js
│   ├── 3_prototype.js
│   └── 4_singleton.js
├── 2 structural/
│   ├── 5_adapter.js
│   ├── 6_decorator.js
│   ├── 7_facade.js
│   ├── 8_flyweight.js
│   └── 9_proxy.js
└── 3 behaviour/
    ├── 10_chain_of_responsibility.js
    ├── 11_comand.js
    ├── 12_iterator.js
    ├── 13_mediator.js
    ├── 14_observer.js
    ├── 15_state.js
    ├── 16_strategy.js
    └── 17_template.js
Download .txt
SYMBOL INDEX (111 symbols across 17 files)

FILE: 1 creational/1_constructor.js
  class Server (line 10) | class Server {
    method constructor (line 11) | constructor(name, ip) {
    method getUrl (line 16) | getUrl() {

FILE: 1 creational/2_factory.js
  class SimpleMembership (line 1) | class SimpleMembership {
    method constructor (line 2) | constructor(name) {
  class StandardMembership (line 8) | class StandardMembership {
    method constructor (line 9) | constructor(name) {
  class PremiumMembership (line 15) | class PremiumMembership {
    method constructor (line 16) | constructor(name) {
  class MemberFactory (line 22) | class MemberFactory {
    method create (line 29) | create(name, type = 'simple') {

FILE: 1 creational/3_prototype.js
  method init (line 4) | init() {

FILE: 1 creational/4_singleton.js
  class Database (line 1) | class Database {
    method constructor (line 2) | constructor(data) {
    method getData (line 11) | getData() {

FILE: 2 structural/5_adapter.js
  class OldCalc (line 1) | class OldCalc {
    method operations (line 2) | operations(t1, t2, operation) {
  class NewCalc (line 11) | class NewCalc {
    method add (line 12) | add(t1, t2) {
    method sub (line 16) | sub(t1, t2) {
  class CalcAdapter (line 21) | class CalcAdapter {
    method constructor (line 22) | constructor() {
    method operations (line 26) | operations(t1, t2, operation) {

FILE: 2 structural/6_decorator.js
  class Server (line 1) | class Server {
    method constructor (line 2) | constructor(ip, port) {
    method url (line 7) | get url() {
  function aws (line 12) | function aws(server) {
  function azure (line 20) | function azure(server) {

FILE: 2 structural/7_facade.js
  class Complaints (line 1) | class Complaints {
    method constructor (line 2) | constructor() {
    method reply (line 6) | reply(complaint) {}
    method add (line 8) | add(complaint) {
  class ProductComplaints (line 14) | class ProductComplaints extends Complaints {
    method reply (line 15) | reply({id, customer, details}) {
  class ServiceComplaints (line 20) | class ServiceComplaints extends Complaints {
    method reply (line 21) | reply({id, customer, details}) {
  class ComplaintRegistry (line 26) | class ComplaintRegistry {
    method register (line 27) | register(customer, type, details) {

FILE: 2 structural/8_flyweight.js
  class Car (line 1) | class Car {
    method constructor (line 2) | constructor(model, price) {
  class CarFactory (line 8) | class CarFactory {
    method constructor (line 9) | constructor() {
    method create (line 13) | create(model, price) {
    method getCar (line 24) | getCar(model) {

FILE: 2 structural/9_proxy.js
  function networkFetch (line 1) | function networkFetch(url) {
  method apply (line 7) | apply(target, thisArg, args) {

FILE: 3 behaviour/10_chain_of_responsibility.js
  class MySum (line 1) | class MySum {
    method constructor (line 2) | constructor(initialValue = 42) {
    method add (line 6) | add(value) {

FILE: 3 behaviour/11_comand.js
  class MyMath (line 1) | class MyMath {
    method constructor (line 2) | constructor(initialValue = 0) {
    method square (line 6) | square() {
    method cube (line 10) | cube() {
  class Command (line 15) | class Command {
    method constructor (line 16) | constructor(subject) {
    method execute (line 21) | execute(command) {

FILE: 3 behaviour/12_iterator.js
  class MyIterator (line 1) | class MyIterator {
    method constructor (line 2) | constructor(data) {
  method [Symbol.iterator] (line 7) | [Symbol.iterator]() {

FILE: 3 behaviour/13_mediator.js
  class User (line 1) | class User {
    method constructor (line 2) | constructor(name) {
    method send (line 7) | send(message, to) {
    method receive (line 11) | receive(message, from) {
  class ChatRoom (line 16) | class ChatRoom {
    method constructor (line 17) | constructor() {
    method register (line 21) | register(user) {
    method send (line 26) | send(message, from, to) {

FILE: 3 behaviour/14_observer.js
  class Subject (line 1) | class Subject {
    method constructor (line 2) | constructor() {
    method subscribe (line 6) | subscribe(observer) {
    method unsubscribe (line 10) | unsubscribe(observer) {
    method fire (line 14) | fire(action) {
  class Observer (line 21) | class Observer {
    method constructor (line 22) | constructor(state = 1) {
    method update (line 27) | update(action) {

FILE: 3 behaviour/15_state.js
  class Light (line 1) | class Light {
    method constructor (line 2) | constructor(light) {
  class RedLight (line 7) | class RedLight extends Light {
    method constructor (line 8) | constructor() {
    method sign (line 12) | sign() {
  class YellowLight (line 17) | class YellowLight extends Light {
    method constructor (line 18) | constructor() {
    method sign (line 22) | sign() {
  class GreenLight (line 27) | class GreenLight extends Light {
    method constructor (line 28) | constructor() {
    method sign (line 32) | sign() {
  class TrafficLight (line 37) | class TrafficLight {
    method constructor (line 38) | constructor() {
    method change (line 47) | change() {
    method sign (line 58) | sign() {

FILE: 3 behaviour/16_strategy.js
  class Vehicle (line 1) | class Vehicle {
    method travelTime (line 2) | travelTime() {
  class Bus (line 7) | class Bus extends Vehicle {
    method constructor (line 8) | constructor() {
  class Taxi (line 14) | class Taxi extends Vehicle {
    method constructor (line 15) | constructor() {
  class Car (line 21) | class Car extends Vehicle {
    method constructor (line 22) | constructor() {
  class Commute (line 28) | class Commute {
    method travel (line 29) | travel(transport) {

FILE: 3 behaviour/17_template.js
  class Employee (line 1) | class Employee {
    method constructor (line 2) | constructor(name, salary) {
    method responsibilities (line 7) | responsibilities() {}
    method work (line 9) | work() {
    method getPaid (line 13) | getPaid() {
  class Developer (line 18) | class Developer extends Employee {
    method constructor (line 19) | constructor(name, salary) {
    method responsibilities (line 23) | responsibilities() {
  class Tester (line 28) | class Tester extends Employee {
    method constructor (line 29) | constructor(name, salary) {
    method responsibilities (line 33) | responsibilities() {
Condensed preview — 18 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (13K chars).
[
  {
    "path": ".gitignore",
    "chars": 6,
    "preview": ".idea\n"
  },
  {
    "path": "1 creational/1_constructor.js",
    "chars": 380,
    "preview": "// function Server(name, ip) {\n//   this.name = name\n//   this.ip = ip\n// }\n//\n// Server.prototype.getUrl = function() {"
  },
  {
    "path": "1 creational/2_factory.js",
    "chars": 1007,
    "preview": "class SimpleMembership {\n  constructor(name) {\n    this.name = name\n    this.cost = 50\n  }\n}\n\nclass StandardMembership {"
  },
  {
    "path": "1 creational/3_prototype.js",
    "chars": 274,
    "preview": "const car = {\n  wheels: 4,\n\n  init() {\n    console.log(`У меня есть ${this.wheels} колеса, мой владелец ${this.owner}`)\n"
  },
  {
    "path": "1 creational/4_singleton.js",
    "chars": 362,
    "preview": "class Database {\n  constructor(data) {\n    if (Database.exists) {\n      return Database.instance\n    }\n    Database.inst"
  },
  {
    "path": "2 structural/5_adapter.js",
    "chars": 766,
    "preview": "class OldCalc {\n  operations(t1, t2, operation) {\n    switch (operation) {\n      case 'add': return t1 + t2\n      case '"
  },
  {
    "path": "2 structural/6_decorator.js",
    "chars": 552,
    "preview": "class Server {\n  constructor(ip, port) {\n    this.ip = ip\n    this.port = port\n  }\n\n  get url() {\n    return `https://${"
  },
  {
    "path": "2 structural/7_facade.js",
    "chars": 947,
    "preview": "class Complaints {\n  constructor() {\n    this.complaints = []\n  }\n\n  reply(complaint) {}\n\n  add(complaint) {\n    this.co"
  },
  {
    "path": "2 structural/8_flyweight.js",
    "chars": 636,
    "preview": "class Car {\n  constructor(model, price) {\n    this.model = model\n    this.price = price\n  }\n}\n\nclass CarFactory {\n  cons"
  },
  {
    "path": "2 structural/9_proxy.js",
    "chars": 476,
    "preview": "function networkFetch(url) {\n  return `${url} - Ответ с сервера`\n}\n\nconst cache = new Set()\nconst proxiedFetch = new Pro"
  },
  {
    "path": "3 behaviour/10_chain_of_responsibility.js",
    "chars": 288,
    "preview": "class MySum {\n  constructor(initialValue = 42) {\n    this.sum = initialValue\n  }\n\n  add(value) {\n    this.sum += value\n "
  },
  {
    "path": "3 behaviour/11_comand.js",
    "chars": 511,
    "preview": "class MyMath {\n  constructor(initialValue = 0) {\n    this.num = initialValue\n  }\n\n  square() {\n    return this.num ** 2\n"
  },
  {
    "path": "3 behaviour/12_iterator.js",
    "chars": 838,
    "preview": "class MyIterator {\n  constructor(data) {\n    this.index = 0\n    this.data = data\n  }\n\n  [Symbol.iterator]() {\n    return"
  },
  {
    "path": "3 behaviour/13_mediator.js",
    "chars": 903,
    "preview": "class User {\n  constructor(name) {\n    this.name = name\n    this.room = null\n  }\n\n  send(message, to) {\n    this.room.se"
  },
  {
    "path": "3 behaviour/14_observer.js",
    "chars": 1086,
    "preview": "class Subject {\n  constructor() {\n    this.observers = []\n  }\n\n  subscribe(observer) {\n    this.observers.push(observer)"
  },
  {
    "path": "3 behaviour/15_state.js",
    "chars": 1190,
    "preview": "class Light {\n  constructor(light) {\n    this.light = light\n  }\n}\n\nclass RedLight extends Light {\n  constructor() {\n    "
  },
  {
    "path": "3 behaviour/16_strategy.js",
    "chars": 560,
    "preview": "class Vehicle {\n  travelTime() {\n    return this.timeTaken\n  }\n}\n\nclass Bus extends Vehicle {\n  constructor() {\n    supe"
  },
  {
    "path": "3 behaviour/17_template.js",
    "chars": 791,
    "preview": "class Employee {\n  constructor(name, salary) {\n    this.name = name\n    this.salary = salary\n  }\n\n  responsibilities() {"
  }
]

About this extraction

This page contains the full source code of the vladilenm/js-patterns-youtube GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 18 files (11.3 KB), approximately 3.6k tokens, and a symbol index with 111 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!