npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

window-calculator

v1.0.2

Published

A calculator for wall windows parameters (area, lighting, building regulations)

Readme

Window Calculator - NPM Package

Описание

Window Calculator - это простой npm-пакет для расчетов, связанных с окнами в архитектуре и строительстве. Пакет предоставляет функциональность для:

  • Расчет площади окна с учетом различных типов
  • Расчет естественной освещенности помещения
  • Проверка соответствия окна строительным нормам

Установка

npm install window-calculator

Использование

const WindowCalculator = require('window-calculator');
const calculator = new WindowCalculator();

// Расчет площади окна
const area = calculator.calculateArea(2, 1.5, 'arched');
console.log(`Площадь окна: ${area} м²`);

// Расчет освещенности
const lighting = calculator.calculateLighting(area, 20, 'arched');
console.log(`Коэффициент освещенности: ${lighting}`);

// Проверка строительных норм
const meetsRegulations = calculator.checkBuildingRegulations(area, 20);
console.log(`Соответствует нормам: ${meetsRegulations}`);

API

calculateArea(width, height, [type])

Рассчитывает площадь окна с учетом типа.

Параметры:

  • width (number): ширина окна в метрах
  • height (number): высота окна в метрах
  • type (string, optional): тип окна (standard, arched, bay). По умолчанию standard

Возвращает: площадь окна в м²

Исключения: выбрасывает ошибку при недопустимых параметрах


calculateLighting(area, roomArea, [type])

Рассчитывает коэффициент естественной освещенности.

Параметры:

  • area (number): площадь окна в м²
  • roomArea (number): площадь комнаты в м²
  • type (string, optional): тип окна. По умолчанию standard

Возвращает: коэффициент естественной освещенности

Исключения: выбрасывает ошибку при недопустимых параметрах


checkBuildingRegulations(area, roomArea)

Проверяет соответствие окна строительным нормам.

Параметры:

  • area (number): площадь окна в м²
  • roomArea (number): площадь комнаты в м²

Возвращает: true, если соотношение площади окна к площади комнаты ≥ 0.1 (10%)

Поддерживаемые типы окон

  1. standard - стандартное прямоугольное окно

    • Множитель площади: 1.0
    • Множитель освещенности: 1.0
  2. arched - арочное окно

    • Множитель площади: 0.8 (учитывает неиспользуемую площадь в верхней части)
    • Множитель освещенности: 1.2 (лучшее рассеивание света)
  3. bay - эркерное окно

    • Множитель площади: 1.5 (учитывает выступ)
    • Множитель освещенности: 0.9 (меньшая эффективность из-за углов)

Примеры

// Пример 1: Расчет для стандартного окна
const standardArea = calculator.calculateArea(1.5, 2);
const standardLight = calculator.calculateLighting(standardArea, 15);

// Пример 2: Проверка соответствия нормам
const isValid = calculator.checkBuildingRegulations(2.5, 20); // true (2.5/20 = 0.125 > 0.1)

Лицензия

MIT