🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

large-number-sum

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

large-number-sum

count two large number sum

latest
npmnpm
Version
1.4.0-beta.1
Version published
Maintainers
1
Created
Source

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()
}

Keywords

large number sum

FAQs

Package last updated on 09 Jan 2022

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