🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

@darkpos/pricing

Package Overview
Dependencies
Maintainers
2
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@darkpos/pricing

Pricing calculator

latest
Source
npmnpm
Version
1.0.135
Version published
Maintainers
2
Created
Source

@dark/pricing

Dark Pricing

TODO: calculation of defined schemas

Usage

const usePricing = require('@darkpos/pricing');

const options = {
    ...localization,
};

const pricingService = usePricing(options);

//
const newOrder = pricingService.order.calculate(oldOrder);

Sample of a calculated Item:

const item = {
    name: 'shirt',
    price: 2,
    modifiers: [
    {
        action: 'add',
        type: 'fixed',
        amount: 1
        attributes: [hidden]
        category: 'fee',
        properties: {
            sort: 1,
            included: true,
        },
        computed: {
            amount: 1
        }
    }                            ----> subTotal: 3
    {
        action: 'add',
        type: 'percentage',
        amount: 20
        category: 'tax',
        properties: {
            direct: false,
            sort: 2,
            included: true
        }
        computed: {
         amount: 0.60
        }
    }                          
    {
        action: 'add',
        type: 'percentage',
        amount: 30
        category: 'tax',
        properties: {
            direct: false,
            sort: 2,
            included: true
        }
        computed: {
         amount: 0.90
        }
    }
                                 ----> subTotal: 4.50
    {
        action: 'subtract',
        type: 'fixed',
        amount: 1
        category: 'discount'
        properties: {
            direct: false,
            sort: 3,
            included: false
        }
        computed: {
         amount: -1
        }
    }],
    subTotals: {
        tax: (included: false)                                ---> 0.60
        discount: (included: false)                           --->-1.00
        fee:                                                ---> 0.00 
        _included: (included: true)                         ---> 1
        _xincluded                                          ---> -0.40
        _direct: sum(modifiers with direct: true)           ---> 1.60 *
        _xdirect: (direct: false)                           ---> -1
        _simple: price * quantity                           ---> 2.00 *
        _actual: _simple  + _included                       ---> 3.00
    }
    total: _actual + _xincluded                             ---> 2.60
}

const order = {
    items: [item],
    modifiers: [{
        action: 'subtract',
        type: 'fixed',
        amount: 1
        attributes: [hidden]
        group: 'discount'
    }],
    subTotal: sum of _actuals                   ---> 3.00
    ---
    subTotals: {
        tax: sum of subTotals.tax                ---> 0.60
        fee: sum of subTotals.fee                ---> 0.00
        discount: sum of subTotals.discount      --->-1.00
    }
    ---
    total: sum of above                          ---> 2.60
}

FAQs

Package last updated on 02 Dec 2025

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