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

@symbolic/lib

Package Overview
Dependencies
Maintainers
0
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@symbolic/lib - npm Package Compare versions

Comparing version 1.0.222 to 1.0.223

2

package.json
{
"name": "@symbolic/lib",
"version": "1.0.222",
"version": "1.0.223",
"description": "plain js utilities",

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

@@ -5,6 +5,6 @@ import memo from '../memo';

export default function __getHelper({shouldMemo}, {priceFor, productPricingRuleVersionFor}) {
function calculatePriceForInstance({productInstance}, dependencies) {
function calculatePriceForInstance({productInstance, productOrder}, dependencies) {
const {productsById, productPricingRulesById} = dependencies;
const {expressions} = productPricingRuleVersionFor({productInstance}, {productsById, productPricingRulesById});
const {expressions} = productPricingRuleVersionFor({productInstance, productOrder}, {productsById, productPricingRulesById});
const product = productsById[productInstance.productId];

@@ -11,0 +11,0 @@

@@ -9,3 +9,3 @@ import dinero from "dinero.js";

var allProductsPrices = _.map(productInstances, (productInstance) => dinero({amount: calculatePriceForInstance({productInstance}, dependencies)}));
var allProductsPrices = _.map(productInstances, (productInstance) => dinero({amount: calculatePriceForInstance({productInstance, productOrder}, dependencies)}));

@@ -12,0 +12,0 @@ var orderSubTotal = _.reduce(allProductsPrices, (sum, n) => sum.add(n), dinero({amount: 0})).getAmount();

@@ -5,3 +5,3 @@ import _ from 'lodash';

export default function __getHelper() {
return function productPricingRuleVersionFor({productInstance, productPricingRule}, dependencies) {
return function productPricingRuleVersionFor({productInstance, productPricingRule, productOrder}, dependencies) {
if (productInstance.productId === -1) return {expressions: []};

@@ -19,9 +19,15 @@ else {

var productPricingRuleVersionsCreatedBeforeProductInstance = _.filter(productPricingRule.versions, (version) => {
return moment(version.created).isSameOrBefore(productInstance.created);
var effectivePricingDate = moment().format('YYYY-MM-DD HH:mm:ss');
if (productOrder) effectivePricingDate = _.get(productOrder, 'effectivePricingDate', productOrder.created);
var productPricingRuleVersionsCreatedBeforeEffectivePricingDate = _.filter(productPricingRule.versions, (version) => {
return moment(version.created).isSameOrBefore(effectivePricingDate);
});
return _.last(productPricingRuleVersionsCreatedBeforeProductInstance);
return _.last(_.sortBy(_.map(productPricingRuleVersionsCreatedBeforeEffectivePricingDate, (version) => {
return {...version, createdUnixTimestamp: moment(version.created).unix()}
}), ['createdUnixTimestamp']));
}
};
}

Sorry, the diff of this file is too big to display

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