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

sidelines-utils

v1.3.4

Published

This package will contain utils that will serve all the platforms in sidelines

Downloads

500

Readme

sidelines-utils

Overview

The sidelines-utils package provides a collection of utility functions designed to enhance the efficiency and effectiveness of platform development within our company. It includes specialized functionalities for frontend development, such as deep linking and bet slip management.

Installation

npm i sidelines-utils

Usage

1.Frontend Utilities (FE)

Deep Linking

The FE module in sidelines-utils offers deep linking capabilities. Use FE.DeepLink.init to create a deep link builder which can be used to construct bet slips and manage offers.

Initializing Deep Link Builder
const { FE } = require('sidelines-utils');

// Initialize the deep link builder
const deepLinkBuilder = FE.DeepLink.init('ios', deepLinkMap, deepLinkSettings, depth = Infinity);

/**
 * Explanation of `FE.DeepLink.init` arguments:
 *
 * arguments[0] - platform: (string, required)
 *    The platform for which the deep link is being built. 
 *    Acceptable values: 'ios' or 'android'.
 *
 * arguments[1] - deepLinkMap: (object, required)
 *    A map of deep links based on the user's location or context.
 *
 * arguments[2] - deepLinkSettings: (object, required)
 *    Settings that define how each deep link is constructed.
 *
 * arguments[3] - depth: (number, optional)
 *    The number of levels to search for offerings before stopping. 
 *    Default value: Infinity.
 */

Creating and Managing Bet Slips

const newBetSlip = deepLinkBuilder('TEST_SESSIONID');
newBetSlip.add(betsApi[0], { line: 265.5, position: 'under' });

Deep Link Builder Functions

 *  deepLinkBuilder(id): //Creates a bet slip object for managing bets and offers.
 *  deepLinkBuilder(id).add(betApi, {line, position}):// Adds a bet with specified line and position.
 *  deepLinkBuilder(id).remove(betApi.id):// Removes a bet from the slip
 *  deepLinkBuilder(id).amount(amountOfMoney):// Set the amount of money user want to bet on the bet-slip 
 *  deepLinkBuilder(id).clear():// Clears all bets and resets the amount, except for the ID.
 *  deepLinkBuilder(id).offers: //Retrieves an array of offers for the bet slip.
 *  deepLinkBuilder(id).availableOperators: //Retrieves an array of operator ids that are support in all bets for the bet slip.

Notes

  • Empty offers result if no matching operators are found.
  • Duplicate bet IDs are not allowed.
  • Deep link type (single or double) is determined by package logic.
  • availableOperators can be use after each add to know what the operators that the betslip can support

2. Generic Utilities

Deep Link

const { DeepLink } = require('sidelines-utils');
const deepLinkSettingsBuilder = DeepLink.deepLinkSettings;

const settings = deepLinkSettingsBuilder()
 .replace({
   placeHolder: '{userName}',
   key: 'userName',
   global: true,
 })
 .replace({
   placeHolder: '{values}',
   key: 'values',
   dataMethods: deepLinkSettingsBuilder()
     .join({
       keys: ['a', 'x', 'c'],
       joinDelimiter: '-',
     })
     .build(),
   joinDelimiter: ',',
 })
 .build();
const link = 'https://test.com/en/xports?options={values}&ui={userName}';
const data = {
 userName: 'test',
 values: [{ a: '1234', x: '555', c: '7878' }],
};

const resultLink = DeepLink.createDeepLink(data, link, settings) // "https://test.com/en/xports?options=1234-555-7878&ui=test";

what we want?

we want to change the link 'https://test.com/en/xports?options={values}&ui={userName}' to look like this "https://test.com/en/xports?options=1234-555-7878&ui=test" how we doing it

  • we want to do this by replace the placeHolder {userName} with the userName from our data
  • we want to take each object in our data.values and join all the inner values by the delimiter '-' in the order of a-x-c and each of this result to join by the delimiter ',' a-x-c,a-x-c and replace the placeHolder {values} with that a-x-c,a-x-c

replace:

key?: string;
value?: string | null;
dataMethods?: Array<ReplaceSetting | AddQueryParamsSetting | JoinSetting | MapSetting>;
joinDelimiter?: string;
placeHolder: string;
global?: boolean;
index?: number; 
  • key = what is the key on the data that you want to target.
  • value = if we do not want to take use a data from the data object that we transfer and we just want to replace a key with some random value we can use this.
  • dataMethods = those method will run on the data that we transfer please make sure the the key that you chose point to array.
  • joinDelimiter = this delimiter will active on the key that you chose only if it is array of data
  • placeHolder = the string that you want to replace
  • global = if true will replace all the placeHolder that he can found (using regex)
  • index = we replace using index let say i have the string {t}qq{t}mm{t} and i want to replace {t} but only the second one so i will put index = 1 and the string will look like this {t}qqXXmm{t}

addQueryParams:

 queryParams: Array<QueryParams>;
 key: string;

 QueryParams {
  key: string;
  val: string;
  default: string | number;
  valPrefix?: string;
  valSuffix?: string;
 }
  1. QueryParams Array
  • key = the name of the query param that you want to add
  • val = the key of the value of the query params in the data
  • default = the default value that we want to set if we do not find the val
  • valPrefix = prefix to the queryParam value
  • valSuffix = suffix to the queryParam value
  1. key = what is the key on the data that you want to target.

join:

keys: string[];
joinDelimiter: string;

NOTE : join is only dataMethod and the target data is array

  • keys = the order of the keys that you want to join from the inner object in target data
  • joinDelimiter = this delimiter will active on the key that you chose only if it is array of data

map:

key: string;

NOTE : map is only dataMethod and the target data is array

  • key = one key that you want to extract from the target data
build:

The build function will return you the array of settings that you could use in the createDeepLink function.

3. DR Utilities (DR)

The DR module provides direct deep link creation only using built-in, encrypted constants. This utility provides the createDeepLink method for simple, direct deep link generation.

Direct Deep Link Creation Only

The DR utility provides:

  • Simple initialization with secret token
  • Only direct deep link generation via createDeepLink
  • Built-in operator and platform support
  • Automatic validation and error handling

Initialization

const { DR } = require('sidelines-utils');

// Initialize with secret token
DR.init('your_secret_token_123');

Parameters:

  • secretToken (string, required): Secret token to decrypt built-in constants
    • Must be alphanumeric with underscores only (no hyphens)
    • Maximum length: 1000 characters
    • Used to decrypt the built-in DEEP_LINK_MAP and DEEP_LINK_SETTINGS

Creating Deep Links (Only Method Available)

// After initialization, create deep links directly
const deepLink = DR.createDeepLink(data, operatorName, platform, type);

Parameters:

  • data (object, required): Bet data object
    • values (array, required): Array of deep link values to process
    • betAmount (number, optional): Bet amount, defaults to 0
  • operatorName (string, required): Operator name ('someOperator')
  • platform (string, optional): Target platform, default: 'web'
    • Acceptable values: 'web', 'ios', 'android'
  • type (string, optional): Deep link type, default: 'parlay'
    • Acceptable values: 'single', 'parlay'

Complete DR Examples

const { DR } = require('sidelines-utils');

// Initialize with secret token
DR.init('your_secret_token_123');

// Example 1: Single bet on web platform
const singleBetData = {
    values: [{ deepLink: 'bet_value_123' }],
    betAmount: 100,
};

const singleBetLink = DR.createDeepLink(
    singleBetData,
    'aaa', // operator
    'web', // platform
    'single' // type
);
console.log('Single bet link:', singleBetLink);

// Example 2: Parlay bet on iOS
const parlayBetData = {
    values: [{ deepLink: 'bet_value_123' }, { deepLink: 'bet_value_345' }],
    betAmount: 250,
};

const parlayBetLink = DR.createDeepLink(
    parlayBetData,
    'bbb', // operator
    'ios', // platform
    'parlay' // type
);

Updating Encrypted Constants

# Encrypt production constants
npm run encrypt-constants

# Encrypt test constants
npm run encrypt-constants:test

Note: The encryption utility uses AES-256-CBC encryption with the provided secret token. Keep your secret tokens secure and never commit them to version control.