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

jasmine-expect

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasmine-expect - npm Package Compare versions

Comparing version 1.16.4 to 1.17.0

15

dist/jasmine-matchers.js

@@ -364,2 +364,17 @@ /*

/**
* Assert subject is string containing parseable JSON
* @return {Boolean}
*/
matchers.toBeJsonString = function() {
var isParseable;
var json;
try {
json = JSON.parse(this.actual);
} catch (e) {
isParseable = false;
}
return isParseable !== false && json !== null;
};
/**
* Assert subject is a String containing nothing but whitespace

@@ -366,0 +381,0 @@ * @return {Boolean}

2

package.json
{
"name": "jasmine-expect",
"version": "1.16.4",
"version": "1.17.0",
"description": "35+ additional matchers for the Jasmine BDD JavaScript test library",

@@ -5,0 +5,0 @@ "main": "jasmine-matchers.js",

@@ -74,2 +74,3 @@ # Jasmine-Matchers

expect(string).toBeHtmlString()
expect(string).toBeJsonString()
expect(string).toBeWhitespace()

@@ -76,0 +77,0 @@ expect(string).toStartWith(substring)

@@ -35,2 +35,17 @@ // Strings

/**
* Assert subject is string containing parseable JSON
* @return {Boolean}
*/
matchers.toBeJsonString = function() {
var isParseable;
var json;
try {
json = JSON.parse(this.actual);
} catch (e) {
isParseable = false;
}
return isParseable !== false && json !== null;
};
/**
* Assert subject is a String containing nothing but whitespace

@@ -37,0 +52,0 @@ * @return {Boolean}

@@ -34,2 +34,15 @@ describe('Strings', function() {

describe('toBeJsonString', function () {
it('asserts value is a string of parseable JSON', function () {
expect('{}').toBeJsonString();
expect('[]').toBeJsonString();
expect('[1]').toBeJsonString();
expect('[1,]').not.toBeJsonString();
expect('<>').not.toBeJsonString();
expect(null).not.toBeJsonString();
expect('').not.toBeJsonString();
expect(void(0)).not.toBeJsonString();
});
});
describe('toBeWhitespace', function () {

@@ -36,0 +49,0 @@ it('asserts value is a string containing only tabs, spaces, returns etc', function () {

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