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

simpler-mocks

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simpler-mocks - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

4

package.json
{
"name": "simpler-mocks",
"version": "1.5.0",
"version": "1.5.1",
"description": "REST API mock server made simple. Runs on Node with YAML and JSON mock definitions.",

@@ -33,3 +33,3 @@ "keywords": [

"start": "nodemon ./src/cli.js -- -p 8080 './tests'",
"samples": "nodemon ./src/cli.js -- './samples'",
"samples": "node ./src/cli.js './samples'",
"prof": "node --prof ./src/cli.js -p 8080 './tests'",

@@ -36,0 +36,0 @@ "test": "jest --coverage",

@@ -149,3 +149,3 @@ # Simpler Mocks

Aside from static values, the request conditions may also be checked against a function or regular express by ways of YAML tags `!!js/function` and `!!js/regexp`. A boolean response or a successful match respectively, determines if the condition is met. Additionally you can also use the custom tag `!any` to check nested object for the existance of a key and not the specific value. The `!any` tag also accepts an optional parameter to check against the value type against.
Aside from static values, the request conditions may also be checked against a function or regular express by ways of YAML tags `!!js/function` and `!!js/regexp`. A boolean response or a successful match respectively, determines if the condition is met. Additionally you can also use the custom tag `!any` to check nested object for the existance of a key and not the specific value. The `!any` tag also accepts an optional parameter to check against the value.

@@ -152,0 +152,0 @@ ### Examples

@@ -36,2 +36,3 @@ const path = require('path')

addMock(file)
cache.mocks.sort(mocksSorter)
}

@@ -103,7 +104,6 @@ }

function removeMock(file) {
util.log('Removed Mock: ', file)
const index = cache.mocks.findIndex((mock) => mock.file.endsWith(file))
const index = cache.mocks.find((mock) => mock.file === file)
if (index > -1) {
util.log('Removed Mock: ', file)
cache.mocks.splice(index, 1)

@@ -131,4 +131,18 @@ }

mocks.forEach(addMock)
cache.mocks.sort(mocksSorter)
}
/**
* Sorts the mocks, putting any with a wildcard towards the bottom
* @param {*} a
* @param {*} b
*/
function mocksSorter(a, b) {
if (a.pattern.indexOf('*') > -1) {
return 1
} else {
return 0
}
}
module.exports = app
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