Socket
Book a DemoInstallSign in
Socket

gcn_sample

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcn_sample

A geometry calculator in node.js

0.3.3
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

gcn_sample

A geometry calculator in nodeJS.

install

# install
$ npm install gcn_sample
# run tests
$ npm test
# run tests with coverage
$ npm run test-cov

Note: I filed an issue on the buffer deprecation warning for covert.

api

calc(shape)

Calculates the geometry of the shape based on dimensions

Required argument

  • shape Object

Required keys for shape

  • shape String triangle|rectangle
  • geometry String area|circumference
  • dimensions Array [numbers]

Required arguments for dimensions by shape and geometry

  • Area of triangle [base, height]
  • Circumference of triangle [sideA, sideB, sideC]
  • Area of rectangle [base, height]
  • Circumference of rectangle [base, height]

totalAreaMultipleShapes(shapes)

Calculates the total area of shapes provided

Required argument

  • shapes Array [Objects]

Required keys for each shape

  • shape String triangle|rectangle|circle
  • dimensions Array [numbers]

Required arguments for dimensions by shape

  • Area of triangle [base, height]
  • Area of rectangle [base, height]
  • Area of circle [radius]

Example

var GCN = require('gcn_sample'),
    gcn = new GCN(),
    triangle = {
      shape: 'triangle', geometry: 'circumference', dimensions: [5, 5, 5]
    },  
    circumferenceOfTriangle = gcn.calc(triangle),
    multipleShapes = [
      {shape: 'triangle', dimensions: [6, 6]},
      {shape: 'rectangle', dimensions: [10, 10]},
      {shape: 'circle', dimensions: [5]}
    ],
    totalArea = gcn.totalAreaMultipleShapes(multipleShapes);

License

MIT

FAQs

Package last updated on 27 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.