Code Monkey home page Code Monkey logo

inversionofcontrol's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

inversionofcontrol's Issues

Помилка при запуску застосунку interfaceWrapper

Помилка при запуску застосунку

Опис

При сробі запуску застосунку interfaceWrapper, як це вказано в README.md:

Из командной строки пишем node application, а потом node framework, сравниваем вывод

виникає помилка, що fs не визначено

Кроки відтвореня

  1. Перейти у директорію із відповідним завданням. Для цього у корені проекту виконати:
    cd interfaceWrapper/ru
  2. Виконати команду, вказану у README.md:
    node application.js

Очікуваний результат:

Застосунок виконується успішно

Дійсний результат:

Під час виконання застосунку виникає помилка, що змінна fs не визначена:

% node application.js 
From application global context
Application going to read ./README.md
/home/oleksandr/workspace/InversionOfControl/interfaceWrapper/ru/application.js:15
fs.readFile(fileName, function(err, src) {
^

ReferenceError: fs is not defined
    at Object.<anonymous> (/home/oleksandr/workspace/InversionOfControl/interfaceWrapper/ru/application.js:15:1)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:136:18)
    at node.js:972:3

Красивий спосіб доступу до module.exports додатку з фреймворку

Завдання №7:

Export a hash from application.js with multiple functions and variables, print the list with types from framework

Теоретично можна використати require для виконання цієї задачі, але в цьому випадку затягувати прикладний код доведеться двічі: один раз для створення скрипта, а другий -- для отримання exports цього модуля. Більш того, код в такому випадку буде, що називається: "code smells" 💩 .

Як красиво можна отримати module.exports завантажуваного застосунку, який виконується у пісочниці?

Wrong assignment to mod.interface

In dependencyInjection/framework.js line 47

     mod.interface = mod.sandbox.exports;

should be replaced with

     mod.interface = mod.sandbox.module.exports;

Otherwise, mod.interface will always be undefined

Неправильна поведінка wrapFunction() у застосунку interfaceWrapper

Неправильна поведінка wrapFunction() у застосунку interfaceWrapper

Опис

У завданні наведено таку реалізацію функції wrapFunction:

function wrapFunction(fnName, fn) {
  return function wrapper() {
    var args = [];
    Array.prototype.push.apply(args, arguments);
    console.log('Call: ' + fnName);
    console.dir(args);
    fn.apply(undefined, args);
  }
}

Дана реалзіація цієї функції ламає виконання програм, де використовується результат, який повертає оригінальна функція, оскільки обгортка не повертає результату (точніше, повертає undefined) і результат функції губиться.

Пропозиція

Змінити реалізацію таким чином, щоб wrapper повертав результат оригінаьної функції.

return function wrapper() {
    ...
    return fn.apply(undefined, args);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.