🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

string-collapse-white-space

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-collapse-white-space - npm Package Compare versions

Comparing version

to
11.0.17

/**
* @name string-collapse-white-space
* @fileoverview Replace chunks of whitespace with a single spaces
* @version 11.0.16
* @version 11.0.17
* @author Roy Revelt, Codsen Ltd

@@ -10,3 +10,3 @@ * @license MIT

import{rApply as w}from"ranges-apply";import{Ranges as x}from"ranges-push";import{right as D}from"string-left-right";var A="11.0.16";var L=A,O={trimStart:!0,trimEnd:!0,trimLines:!1,trimnbsp:!1,removeEmptyLines:!1,limitConsecutiveEmptyLinesTo:0,enforceSpacesOnly:!1,cb:({suggested:e})=>e},R=["suggested","whiteSpaceStartsAt","whiteSpaceEndsAt","str"];function J(e,b){if(typeof e!="string")throw new Error(`string-collapse-white-space/collapse(): [THROW_ID_01] The input is not string but ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(b&&typeof b!="object")throw new Error(`string-collapse-white-space/collapse(): [THROW_ID_02] The resolvedOpts is not a plain object but ${typeof b}, equal to:
import{rApply as w}from"ranges-apply";import{Ranges as x}from"ranges-push";import{right as D}from"string-left-right";var A="11.0.17";var L=A,O={trimStart:!0,trimEnd:!0,trimLines:!1,trimnbsp:!1,removeEmptyLines:!1,limitConsecutiveEmptyLinesTo:0,enforceSpacesOnly:!1,cb:({suggested:e})=>e},R=["suggested","whiteSpaceStartsAt","whiteSpaceEndsAt","str"];function J(e,b){if(typeof e!="string")throw new Error(`string-collapse-white-space/collapse(): [THROW_ID_01] The input is not string but ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(b&&typeof b!="object")throw new Error(`string-collapse-white-space/collapse(): [THROW_ID_02] The resolvedOpts is not a plain object but ${typeof b}, equal to:
${JSON.stringify(b,null,4)}`);if(!e.length)return{result:"",ranges:null};let S=new x,c="\xA0",n={...O,...b};function p(t,y){if(typeof n.cb=="function"){let o=n.cb({suggested:t,...y});Array.isArray(o)&&S.push(...o)}else t&&S.push(...t)}let l=null,s=null,i=null,a=null,E=null,m=!1,f=[],h=0;for(let t=0,y=e.length;t<=y;t++){if((e[t]==="\r"||e[t]===`

@@ -13,0 +13,0 @@ `&&e[t-1]!=="\r")&&(h+=1,a===null&&(a=t),E=e[t]==="\r"&&e[t+1]===`

/**
* @name string-collapse-white-space
* @fileoverview Replace chunks of whitespace with a single spaces
* @version 11.0.16
* @version 11.0.17
* @author Roy Revelt, Codsen Ltd

@@ -19,3 +19,3 @@ * @license MIT

\r`.includes(e[n+2])||s&&e[n+2]===j))return n+2;for(let i=n+1,r=e.length;i<r;i++)if(e[i].trim()||o&&`
\r`.includes(e[i])||s&&e[i]===j)return i;return null}function C(e,n=0){return ge({str:e,idx:n,stopAtNewlines:!1,stopAtRawNbsp:!1})}var K="11.0.16";var ce=K,Z={trimStart:!0,trimEnd:!0,trimLines:!1,trimnbsp:!1,removeEmptyLines:!1,limitConsecutiveEmptyLinesTo:0,enforceSpacesOnly:!1,cb:({suggested:e})=>e},me=["suggested","whiteSpaceStartsAt","whiteSpaceEndsAt","str"];function he(e,n){if(typeof e!="string")throw new Error(`string-collapse-white-space/collapse(): [THROW_ID_01] The input is not string but ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(n&&typeof n!="object")throw new Error(`string-collapse-white-space/collapse(): [THROW_ID_02] The resolvedOpts is not a plain object but ${typeof n}, equal to:
\r`.includes(e[i])||s&&e[i]===j)return i;return null}function C(e,n=0){return ge({str:e,idx:n,stopAtNewlines:!1,stopAtRawNbsp:!1})}var K="11.0.17";var ce=K,Z={trimStart:!0,trimEnd:!0,trimLines:!1,trimnbsp:!1,removeEmptyLines:!1,limitConsecutiveEmptyLinesTo:0,enforceSpacesOnly:!1,cb:({suggested:e})=>e},me=["suggested","whiteSpaceStartsAt","whiteSpaceEndsAt","str"];function he(e,n){if(typeof e!="string")throw new Error(`string-collapse-white-space/collapse(): [THROW_ID_01] The input is not string but ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(n&&typeof n!="object")throw new Error(`string-collapse-white-space/collapse(): [THROW_ID_02] The resolvedOpts is not a plain object but ${typeof n}, equal to:
${JSON.stringify(n,null,4)}`);if(!e.length)return{result:"",ranges:null};let o=new U,s="\xA0",i=h(h({},Z),n);function r(f,T){if(typeof i.cb=="function"){let d=i.cb(h({suggested:f},T));Array.isArray(d)&&o.push(...d)}else f&&o.push(...f)}let a=null,l=null,u=null,t=null,g=null,c=!1,m=[],p=0;for(let f=0,T=e.length;f<=T;f++){if((e[f]==="\r"||e[f]===`

@@ -35,3 +35,3 @@ `&&e[f-1]!=="\r")&&(p+=1,t===null&&(t=f),g=e[f]==="\r"&&e[f+1]===`

* @fileoverview Sort string index ranges
* @version 6.0.10
* @version 6.0.11
* @author Roy Revelt, Codsen Ltd

@@ -44,3 +44,3 @@ * @license MIT

* @fileoverview Merge and sort string index ranges
* @version 9.0.13
* @version 9.0.14
* @author Roy Revelt, Codsen Ltd

@@ -53,3 +53,3 @@ * @license MIT

* @fileoverview Take an array of string index ranges, delete/replace the string according to them
* @version 7.0.13
* @version 7.0.14
* @author Roy Revelt, Codsen Ltd

@@ -62,3 +62,3 @@ * @license MIT

* @fileoverview Collapse the leading and trailing whitespace of a string
* @version 7.0.6
* @version 7.0.7
* @author Roy Revelt, Codsen Ltd

@@ -71,3 +71,3 @@ * @license MIT

* @fileoverview Various utility functions
* @version 1.6.2
* @version 1.6.3
* @author Roy Revelt, Codsen Ltd

@@ -80,3 +80,3 @@ * @license MIT

* @fileoverview Gather string index ranges
* @version 7.0.13
* @version 7.0.14
* @author Roy Revelt, Codsen Ltd

@@ -89,3 +89,3 @@ * @license MIT

* @fileoverview Looks up the first non-whitespace character to the left/right of a given index
* @version 6.0.15
* @version 6.0.16
* @author Roy Revelt, Codsen Ltd

@@ -92,0 +92,0 @@ * @license MIT

{
"name": "string-collapse-white-space",
"version": "11.0.16",
"version": "11.0.17",
"description": "Replace chunks of whitespace with a single spaces",

@@ -72,9 +72,9 @@ "keywords": [

"dependencies": {
"ranges-apply": "^7.0.13",
"ranges-push": "^7.0.13",
"string-left-right": "^6.0.15"
"ranges-apply": "^7.0.14",
"ranges-push": "^7.0.14",
"string-left-right": "^6.0.16"
},
"devDependencies": {
"test-mixer": "^4.1.12"
"test-mixer": "^4.1.13"
}
}

@@ -78,4 +78,4 @@ <h1 align="center">string-collapse-white-space</h1>

Copyright © 2010-2023 Roy Revelt and other contributors.
Copyright © 2010-2024 Roy Revelt and other contributors.
<p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>

Sorry, the diff of this file is not supported yet