Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

string-kit

Package Overview
Dependencies
Maintainers
1
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-kit - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

20

bdd-spec.md
# TOC
- [format()](#format)
- [Escape](#escape)
<a name=""></a>

@@ -7,2 +8,11 @@

# format()
should perform basic examples.
```js
expect( format( 'Hello world' ) ).to.be( 'Hello world' ) ;
expect( format( 'Hello %s' , 'world' ) ).to.be( 'Hello world' ) ;
expect( format( 'Hello %s %s, how are you?' , 'Joe' , 'Doe' ) ).to.be( 'Hello Joe Doe, how are you?' ) ;
expect( format( 'I have %i cookies.' , 3 ) ).to.be( 'I have 3 cookies.' ) ;
```
%u should format unsigned integer.

@@ -26,8 +36,8 @@

should.
should perform well the argument's number feature.
```js
expect( format( 'ABC: %s%s%s' , 'A' , 'B' , 'C' ) ) ;
expect( format( 'BAC: %+1s%-1s%s' , 'A' , 'B' , 'C' ) ) ;
expect( format( 'CBC: %3s%s' , 'A' , 'B' , 'C' ) ) ;
expect( format( '%s%s%s' , 'A' , 'B' , 'C' ) ).to.be( 'ABC' ) ;
expect( format( '%+1s%-1s%s' , 'A' , 'B' , 'C' ) ).to.be( 'BAC' ) ;
expect( format( '%3s%s' , 'A' , 'B' , 'C' ) ).to.be( 'CBC' ) ;
```

@@ -56,1 +66,3 @@

<a name="escape"></a>
# Escape

8

lib/string.js

@@ -222,11 +222,11 @@ /*

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
string.escape.regexp = function escapeRegexp( str )
{
string.escape.regExp = function escapeRegExp( str ) {
return str.replace( /([.*+?^${}()|\[\]\/\\])/g , '\\$1' ) ;
} ;
string.escape.shellArg = function escapeShellArg( str ) {
return '\'' + str.replace( /\'/g , "'\\''" ) + '\'' ;
} ;
module.exports = string ;
{
"name": "string-kit",
"version": "0.0.2",
"version": "0.0.3",
"description": "A string manipulation toolbox.",

@@ -5,0 +5,0 @@ "main": "lib/string.js",

@@ -28,2 +28,3 @@

- [format()](#format)
- [Escape](#escape)
<a name=""></a>

@@ -33,2 +34,11 @@

# format()
should perform basic examples.
```js
expect( format( 'Hello world' ) ).to.be( 'Hello world' ) ;
expect( format( 'Hello %s' , 'world' ) ).to.be( 'Hello world' ) ;
expect( format( 'Hello %s %s, how are you?' , 'Joe' , 'Doe' ) ).to.be( 'Hello Joe Doe, how are you?' ) ;
expect( format( 'I have %i cookies.' , 3 ) ).to.be( 'I have 3 cookies.' ) ;
```
%u should format unsigned integer.

@@ -52,8 +62,8 @@

should.
should perform well the argument's number feature.
```js
expect( format( 'ABC: %s%s%s' , 'A' , 'B' , 'C' ) ) ;
expect( format( 'BAC: %+1s%-1s%s' , 'A' , 'B' , 'C' ) ) ;
expect( format( 'CBC: %3s%s' , 'A' , 'B' , 'C' ) ) ;
expect( format( '%s%s%s' , 'A' , 'B' , 'C' ) ).to.be( 'ABC' ) ;
expect( format( '%+1s%-1s%s' , 'A' , 'B' , 'C' ) ).to.be( 'BAC' ) ;
expect( format( '%3s%s' , 'A' , 'B' , 'C' ) ).to.be( 'CBC' ) ;
```

@@ -82,1 +92,3 @@

<a name="escape"></a>
# Escape

@@ -46,2 +46,10 @@ /*

it( "should perform basic examples" , function() {
expect( format( 'Hello world' ) ).to.be( 'Hello world' ) ;
expect( format( 'Hello %s' , 'world' ) ).to.be( 'Hello world' ) ;
expect( format( 'Hello %s %s, how are you?' , 'Joe' , 'Doe' ) ).to.be( 'Hello Joe Doe, how are you?' ) ;
expect( format( 'I have %i cookies.' , 3 ) ).to.be( 'I have 3 cookies.' ) ;
} ) ;
it( "%u should format unsigned integer" , function() {

@@ -63,7 +71,7 @@

it( "should" , function() {
it( "should perform well the argument's number feature" , function() {
expect( format( 'ABC: %s%s%s' , 'A' , 'B' , 'C' ) ) ;
expect( format( 'BAC: %+1s%-1s%s' , 'A' , 'B' , 'C' ) ) ;
expect( format( 'CBC: %3s%s' , 'A' , 'B' , 'C' ) ) ;
expect( format( '%s%s%s' , 'A' , 'B' , 'C' ) ).to.be( 'ABC' ) ;
expect( format( '%+1s%-1s%s' , 'A' , 'B' , 'C' ) ).to.be( 'BAC' ) ;
expect( format( '%3s%s' , 'A' , 'B' , 'C' ) ).to.be( 'CBC' ) ;
} ) ;

@@ -92,1 +100,10 @@

describe( "Escape" , function() {
it( "escape.regExp" ) ;
it( "escape.shellArg" ) ;
} ) ;
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