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

operation-strint

v1.1.1

Published

String-based integer arithmetic utilities for JavaScript

Readme

operation-strint

String-based integer arithmetic helpers for JavaScript and TypeScript.

operation-strint works on base-10 integers stored as strings, which makes it useful when values may exceed JavaScript's safe integer range. The package now ships as an ES module and includes built-in TypeScript declarations.

Install

npm install operation-strint

Usage

import { sum, minus, multiply, divby2, pow, photo } from 'operation-strint';

sum('12983479272', '323984729837');
// '336968209109'

minus('10001', '2');
// '9999'

multiply('30', '1023');
// '30690'

divby2('121');
// '60.5'

pow('2', '5');
// '32'

photo('JHGAJHFJD000000');
// 'JHGAJHFJD000001'

You can also import the full namespace:

import op from 'operation-strint';

op.sum('9', '3');
// '12'

TypeScript

import { sum, type ValidationMessage } from 'operation-strint';

const result: string = sum('12', '3');
const validation: ValidationMessage = 'Numbers cannot be empty';

API

All arithmetic inputs are expected to be strings containing decimal digits unless noted otherwise.

  • sum(a, b, removeLeadingZeros = true): string
  • minus(a, b, removeLeadingZeros = true): string
  • multiply(a, b, removeLeadingZeros = true): string
  • multiplybysum(a, b, removeLeadingZeros = true): string
  • divby2(value, removeLeadingZeros = true): string
  • pow(base, exponent, removeLeadingZeros = true): string
  • fact(value): string
  • photo(value): string
  • IsMoreThan(a, b, removeLeadingZeros = true): boolean | ValidationMessage
  • CSRange: { sbyte; byte; short; ushort; int; uint; long; ulong }
  • numinbase10: string[]
  • snumpat: RegExp

Behavior Notes

  • Empty inputs return Numbers cannot be empty in the validated arithmetic helpers.
  • Non-digit input returns Numbers must be numbers in the validated arithmetic helpers.
  • Leading zeros are removed by default for arithmetic operations.
  • Negative numbers and decimal values are not supported.

Examples Covered by Tests

import * as op from 'operation-strint';

op.sum('0012', '3');
// '15'

op.sum('323928374982384729837', '323928374982384729837');
// '647856749964769459674'

op.minus('100000', '1');
// '99999'

op.multiply('123', '4');
// '492'

op.divby2('12000001');
// '6000000.5'

op.pow('4', '0');
// '1'

op.photo('9999');
// '0000'

op.multiplybysum('12', '3');
// '36'

op.fact('5');
// '120'

License

MIT