large-number-sum
v1.4.0-beta.1
Published
count two large number sum
Downloads
6
Readme
TOW LARGE NUMBERS SUM
install by npm
npm i large-number-sum
install by yarn
yarn add large-number-sum
Usage
largeNumberSum take two strings of number and return a string of sum.
cjs
const largeNumberSum = require('large-number-sum')
const sum = largeNumberSum('99999', '1') //100000
const sum2 = largeNumberSum('99999999999999999999999999', '1')
esm
import * as largeNumberSum from 'large-number-sum'
const sum = largeNumberSum('99999', '1') //100000
const sum2 = largeNumberSum('99999999999999999999999999', '1')
export function removeComments(sql) {
// eslint-disable-next-line quotes
const singleQuote = `'`
sql = sql.replace(/("(""|[^"])*")|('(''|[^'])*')|(--[^\n\r]*)|(\/\*[\w\W]*?(?=\*\/)\*\/)/gm, match => {
if (
(match[0] === '"' && match[match.length - 1] === '"') ||
(match[0] === singleQuote && match[match.length - 1] === singleQuote)
)
return match
return ''
})
return sql
}
export function minifySQL(sql) {
// eslint-disable-next-line quotes
const singleQuote = `'`
sql = sql.replace(/("(""|[^"])*")|('(''|[^'])*')|([\t\r\n])/gm, match => {
if (
(match[0] === '"' && match[match.length - 1] === '"') ||
(match[0] === singleQuote && match[match.length - 1] === singleQuote)
)
return match
return ' '
})
sql = sql.replace(/("(""|[^"])*")|('(''|[^'])*')|([ ]{2,})/gm, match => {
if (
(match[0] === '"' && match[match.length - 1] === '"') ||
(match[0] === singleQuote && match[match.length - 1] === singleQuote)
)
return match
return ' '
})
sql = sql.replace(/\s+,/gm, ',')
return sql.trim()
}