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

module-connector

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

module-connector - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

6

index.js

@@ -19,8 +19,8 @@ 'use strict'

/** @integer HTTP code response */
this.code = 500;
/** @obj || @array content of response*/
this.response = [];
/** @integer HTTP code response */
this.code = 500;
Object.preventExtensions(this);

@@ -27,0 +27,0 @@ };

{
"name": "module-connector",
"version": "1.0.1",
"version": "1.0.2",
"description": "object used to connect different backend and frontend components. in order to better control the different scenarios that could occur with the communication of these",

@@ -5,0 +5,0 @@ "main": "index.js",

# module-connector
object used to connect different backend and frontend components. in order to better control the different scenarios that could occur with the communication of these
object used to connect different backend and frontend components. in order to better control the different scenarios that could occur with the communication of these
## structure
| Attribute | Type | Default | Description |
| ------------- | :-------------: | :-------------: | ------------- |
| success | boolean | false | tells us if the process that the component is in charge of is completed successfully or not |
| message | string | module_connector | a message is left here depending on the conclusion of the component. for example: created_user, existing_name, id_no_found |
| response | array / object | [] | All the content that should come from the component is sent here, it can be a list, an element as such, but never a string, boolean or integer value, for reasons of scalability |
| code | integer | 500 | HTTP code |
## example
although the component is called a module connector. The most recommended is to define a variable with the name of output when creating a new connector, since it is more readable. it is also recommended to define it as let so that it never deceives us with other classes, functions or services
```javascript
//include library
let moduleConnector = require("module-connector");
//create default output from module connector
let output = new moduleConnector();
//you code
let arrayClientList = [
{ id:1, name: "diana" },
{ id:2, name: "jorge" }
];
//modify output
output.success = true;
output.message = "array_clients_list";
output.code = 200;
output.response = arrayClientList;
//return output
return output;
```
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