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

@janiscommerce/api

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@janiscommerce/api - npm Package Compare versions

Comparing version 6.5.2 to 6.6.0

4

CHANGELOG.md

@@ -9,2 +9,6 @@ # Changelog

## [6.6.0] - 2022-11-18
### Changed
- Now data received is trimmed to avoid empty spaces before and after for strings
## [6.5.2] - 2022-07-15

@@ -11,0 +15,0 @@ ### Added

8

lib/dispatcher.js

@@ -8,4 +8,5 @@ 'use strict';

const cloneObj = require('lodash.clonedeep');
const Fetcher = require('./fetcher');
const { isObject } = require('./utils');
const { isObject, trimObjectValues } = require('./utils');

@@ -40,7 +41,6 @@ const API = require('./api');

this._validateRequest(request);
this.endpoint = request.endpoint.replace(/^\/?(api\/)?/i, '');
this.method = (request.method || 'get').toLowerCase();
this.data = request.data || {};
this.pristineData = request.data && { ...request.data };
this.data = trimObjectValues(request.data && cloneObj(request.data));
this.pristineData = request.data;
Object.freeze(this.pristineData);

@@ -47,0 +47,0 @@ this.rawData = request.rawData;

@@ -32,5 +32,23 @@ 'use strict';

const trimObjectValues = value => {
if(typeof value !== 'object' || !value)
return value;
Object.keys(value).forEach(k => {
if((typeof value[k] === 'string'))
value[k] = value[k].trim();
if(typeof value[k] === 'object' && value[k] !== null)
value[k] = trimObjectValues(value[k]);
});
return value;
};
module.exports = {
isObject,
omitRecursive
omitRecursive,
trimObjectValues
};
{
"name": "@janiscommerce/api",
"version": "6.5.2",
"version": "6.6.0",
"description": "A package for managing API from any origin",

@@ -31,3 +31,3 @@ "main": "lib/index.js",

"devDependencies": {
"eslint": "^8.8.0",
"eslint": "^8.27.0",
"eslint-config-airbnb-base": "^13.2.0",

@@ -45,4 +45,5 @@ "eslint-plugin-import": "^2.25.3",

"@janiscommerce/events": "^0.1.0",
"@janiscommerce/log": "^3.5.1",
"@janiscommerce/superstruct": "^1.2.0",
"@janiscommerce/log": "^3.6.0",
"@janiscommerce/superstruct": "^1.2.1",
"lodash.clonedeep": "^4.5.0",
"lodash.omit": "4.5.0",

@@ -49,0 +50,0 @@ "uuid": "^8.3.2"

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

}, exclude: string | Array<string>): any;
export function trimObjectValues(value: any): any;
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