Socket
Socket
Sign inDemoInstall

smartwrap

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smartwrap - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

12

index.js

@@ -24,2 +24,3 @@ function smartWrap(text,options){

defaults.splitAt = [" ","\t"];
defaults.trim = true;
defaults.width = 10;

@@ -49,9 +50,16 @@ defaults.words = [];

var unfilteredWords = [];
//to trim or not to trim...
var modifiedText = text;
if(wrapObj.trim){
modifiedText = modifiedText.trim();
}
if(wrapObj.splitAt.indexOf('\t')!==-1){
//split at both spaces and tabs
unfilteredWords = text.split(/ |\t/i);
unfilteredWords = modifiedText.split(/ |\t/i);
}
else{
//split at whitespace
unfilteredWords = text.split(' ');
unfilteredWords = modifiedText.split(' ');
}

@@ -58,0 +66,0 @@

2

package.json
{
"name": "smartwrap",
"version": "1.0.0",
"version": "1.0.1",
"description": "Wordwrap that doesn't split words unless the word length is greater that the line width.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,1 +19,3 @@ # smartwrap

```
*Because these are wide characters and occupy 2 spaces, even though
in javascript their string length is 1.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc