Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@buildingsblock/core

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@buildingsblock/core - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

19

lib/stratas/index.js

@@ -6,3 +6,3 @@ "use strict";

});
exports.default = exports.calcSalesTurnoverRate = exports.calcContingencyReserveFundPerSquareFoot = void 0;
exports.default = exports.calcSalesTurnoverRate = exports.calcAverageSalesTurnoverRate = exports.calcContingencyReserveFundPerSquareFoot = void 0;

@@ -34,3 +34,3 @@ var _lodash = _interopRequireDefault(require("lodash"));

var calcSalesTurnoverRate = function calcSalesTurnoverRate(stratas) {
var calcAverageSalesTurnoverRate = function calcAverageSalesTurnoverRate(stratas) {
var stratasWithSalesAndUnits = stratas.filter(function (x) {

@@ -72,2 +72,16 @@ return x.units;

exports.calcAverageSalesTurnoverRate = calcAverageSalesTurnoverRate;
var calcSalesTurnoverRate = function calcSalesTurnoverRate(strata) {
var latestSales = _lodash.default.orderBy(strata.sales, ['at'], ['desc'])[0];
var units = strata.units;
if (!latestSales || !units) return null;
return {
pastYear: latestSales.pastYear / units,
twoYearsAgo: latestSales.twoYearsAgo / units,
threeYearsAgo: latestSales.threeYearsAgo / units
};
};
exports.calcSalesTurnoverRate = calcSalesTurnoverRate;

@@ -147,2 +161,3 @@

calcContingencyReserveFundPerSquareFoot: calcContingencyReserveFundPerSquareFoot,
calcAverageSalesTurnoverRate: calcAverageSalesTurnoverRate,
calcSalesTurnoverRate: calcSalesTurnoverRate,

@@ -149,0 +164,0 @@ createSchema: createSchema

2

package.json
{
"name": "@buildingsblock/core",
"version": "0.0.12",
"version": "0.0.13",
"description": "Core code base for Buildingsblock",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -5,2 +5,3 @@ import test from 'ava'

calcContingencyReserveFundPerSquareFoot,
calcAverageSalesTurnoverRate,
calcSalesTurnoverRate,

@@ -35,3 +36,3 @@ } from '../../src/stratas'

test('calcSalesTurnoverRate', (t) => {
test('calcAverageSalesTurnoverRate', (t) => {
const strata = [{

@@ -45,7 +46,20 @@ sales: [{ pastYear: 10, twoYearsAgo: 5, threeYearsAgo: 20 }],

const result = calcAverageSalesTurnoverRate(strata)
t.is(result.pastYear, 0.09, 'should return average turnover rate for past year')
t.is(result.twoYearsAgo, 0.13, 'should return average turnover rate for two years ago')
t.is(result.threeYearsAgo, 0.19, 'should return average turnover rate for three years ago')
})
test('calcSalesTurnoverRate', (t) => {
const strata = {
sales: [{ pastYear: 10, twoYearsAgo: 5, threeYearsAgo: 20 }],
units: 100,
}
const result = calcSalesTurnoverRate(strata)
t.is(result.pastYear, 0.09, 'should return turnover rate for past year')
t.is(result.twoYearsAgo, 0.13, 'should return turnover rate for two years ago')
t.is(result.threeYearsAgo, 0.19, 'should return turnover rate for three years ago')
t.is(result.pastYear, 0.1, 'should return turnover rate for past year')
t.is(result.twoYearsAgo, 0.05, 'should return turnover rate for two years ago')
t.is(result.threeYearsAgo, 0.2, 'should return turnover rate for three years ago')
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc