New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chai-string

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-string - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

25

chai-string.js

@@ -53,2 +53,9 @@ (function (plugin) {

chai.string.containIgnoreSpaces = function (str1, str2) {
if (!isString(str1) || !isString(str2)) {
return false;
}
return str1.replace(/\s/g, '').indexOf(str2.replace(/\s/g, '')) > -1;
};
chai.string.singleLine = function(str) {

@@ -151,2 +158,12 @@ if (!isString(str)) {

chai.Assertion.addChainableMethod('containIgnoreSpaces', function (expected) {
var actual = this._obj;
return this.assert(
chai.string.containIgnoreSpaces(actual, expected),
'expected ' + this._obj + ' to contain ' + expected + ' ignoring spaces',
'expected ' + this._obj + ' not to contain ' + expected + ' ignoring spaces'
);
});
chai.Assertion.addChainableMethod('singleLine', function () {

@@ -237,2 +254,10 @@ var actual = this._obj;

assert.containIgnoreSpaces = function (val, exp, msg) {
new chai.Assertion(val, msg).to.be.containIgnoreSpaces(exp);
};
assert.notContainIgnoreSpaces = function (val, exp, msg) {
new chai.Assertion(val, msg).to.not.be.containIgnoreSpaces(exp);
};
assert.singleLine = function(val, exp, msg) {

@@ -239,0 +264,0 @@ new chai.Assertion(val, msg).to.be.singleLine();

2

package.json
{
"name": "chai-string",
"version": "1.2.0",
"version": "1.3.0",
"keywords": ["chai", "testing", "string", "chai-plugin", "browser"],

@@ -5,0 +5,0 @@ "description": "strings comparison matchers for chai",

@@ -30,2 +30,3 @@ # chai-string

* equalIgnoreSpaces
* containIgnoreSpaces
* singleLine

@@ -74,2 +75,8 @@ * reverseOf

### containIgnoreSpaces
```javascript
assert.containIgnoreSpaces('abcdefgh', 'a\nb\tc\r d ef');
expect('abcdefgh').to.containIgnoreSpaces('a\nb\tc\r d ef');
```
### singleLine

@@ -76,0 +83,0 @@ ```javascript

@@ -201,2 +201,31 @@ (function (test) {

describe('#containIgnoreSpaces', function () {
it('should return true', function () {
var str1 = '1234abcdef56',
str2 = '1234a\nb\tc\r d ef56';
chai.string.containIgnoreSpaces(str1, str2).should.be.true;
});
it('should return true (2)', function () {
var str1 = 'abcdef',
str2 = 'a\nb\tc\r d ef';
chai.string.containIgnoreSpaces(str1, str2).should.be.true;
});
it('should return false', function () {
var str1 = 'abdef',
str2 = 'a\nb\tc\r d ef';
chai.string.containIgnoreSpaces(str1, str2).should.be.false;
});
it('should return false (2)', function () {
chai.string.containIgnoreSpaces('12', 12).should.be.false;
});
it('should return false (3)', function () {
chai.string.containIgnoreSpaces(12, '12').should.be.false;
});
});
describe('#singleLine', function() {

@@ -442,2 +471,10 @@

it('.containIgnoreSpaces', function () {
assert.containIgnoreSpaces(this.str, this.str2);
});
it('.notContainIgnoreSpaces', function () {
assert.notContainIgnoreSpaces(this.str, this.str2 + 'g');
});
it('.singleLine', function() {

@@ -444,0 +481,0 @@ assert.singleLine(this.str);

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