string-sum-lib
v1.0.2
Published
A library for summing numeric values extracted from strings.
Downloads
10
Maintainers
Readme
String-sum-library
Authors
Running Tests
To run tests, run the following command
npx jest√ should throw an error if input is not a string
√ should handle numbers at the start and end of the string
√ should handle multiple spaces and special characters
√ should handle only negative numbers
√ should handle only decimal numbers
√ should handle a mix of positive, negative, and decimal numbers (1 ms)sumString
√ should return 0 for an empty string
√ should return the sum of single numbers in a string
√ should return the sum of multiple numbers in a string
√ should ignore non-numeric values
√ should handle negative numbers
√ should handle decimal numbers
√ should handle mixed contentUsage/Examples
const { sumString } = require("string-sum-lib");
const result = sumString("The total is 5 and 10");
console.log(result);