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

sails

Package Overview
Dependencies
Maintainers
4
Versions
236
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sails - npm Package Compare versions

Comparing version 1.5.3 to 1.5.4

31

docs/concepts/Helpers/Helpers.md

@@ -12,3 +12,3 @@ # Helpers

```javascript
var greeting = await sails.helpers.formatWelcomeMessage('Bubba');
const greeting = await sails.helpers.formatWelcomeMessage('Bubba');
sails.log(greeting);

@@ -48,3 +48,3 @@ // => "Hello, Bubba!"

fn: async function (inputs, exits) {
var result = `Hello, ${inputs.name}!`;
const result = `Hello, ${inputs.name}!`;
return exits.success(result);

@@ -82,3 +82,3 @@ }

```javascript
var greeting = await sails.helpers.formatWelcomeMessage.with({ name: 'Bubba' });
const greeting = await sails.helpers.formatWelcomeMessage.with({ name: 'Bubba' });
```

@@ -102,3 +102,3 @@

```javascript
var newUserId = sails.helpers.inviteNewUser('bubba@hawtmail.com')
const newUserId = sails.helpers.inviteNewUser('bubba@hawtmail.com')
.intercept('emailAddressInUse', 'badRequest');

@@ -148,3 +148,3 @@ ```

```javascript
var headers = await sails.helpers.parseMyHeaders(req);
const headers = await sails.helpers.parseMyHeaders(req);
```

@@ -167,3 +167,3 @@

```javascript
var result = await sails.helpers.formatWelcomeMessage('Dolly');
const result = await sails.helpers.formatWelcomeMessage('Dolly');
sails.log('Ok it worked! The result is:', result);

@@ -179,3 +179,3 @@ ```

```javascript
var greeting = sails.helpers.formatWelcomeMessage('Timothy');
const greeting = sails.helpers.formatWelcomeMessage('Timothy');
```

@@ -185,3 +185,20 @@

##### Organizing helpers
If your application uses many helpers, you might find it helpful to group related helpers into subdirectories. For example, imagine you had a number of `user` helpers and several `item` helpers, organized in the following directory structure
```
api/
helpers/
user/
find-by-username.js
toggle-admin-role.js
validate-username.js
item/
set-price.js
apply-coupon.js
```
When calling these helpers, each subfolder name (e.g. `user` and `item`) becomes an additional property layer in the `sails.helpers` object, so you can call `find-by-username.js` using `sails.helpers.user.findByUsername()` and you can call `set-price.js` with `sails.helpers.item.setPrice()`.
> For more information, you can read a [conversation between Ryan Emberling and Mike McNeil](https://www.linkedin.com/feed/update/urn:li:activity:6998946887701565440?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A6998946887701565440%2C7000154787505668096%29) which goes into more detail about this use case, including some general tips and tricks for working with custom helpers and organics.
### Handling exceptions

@@ -188,0 +205,0 @@

@@ -299,2 +299,4 @@ # Attributes

> When using `unique: true` on an attribute with the `utf8mb4` character set in a MySQL database, you will need to set the column size manually via the [`columnType` property](https://sailsjs.com/documentation/concepts/models-and-orm/attributes#?columntype) to avoid a possible 'index too long' error. For example: `columnType: varchar(100) CHARACTER SET utf8mb4`.
<!--

@@ -301,0 +303,0 @@

@@ -22,2 +22,4 @@ # `.update()`

> **Note**: For performance reasons, as of Sails v1.0 / Waterline 0.13, the `valuesToSet` object passed into this model method will be mutated in-place in most situations (whereas in Sails/Waterline v0.12, this was not necessarily the case).
##### Result

@@ -24,0 +26,0 @@

@@ -20,2 +20,4 @@ # `.updateOne()`

> **Note**: For performance reasons, as of Sails v1.0 / Waterline 0.13, the `valuesToSet` object passed into this model method will be mutated in-place in most situations (whereas in Sails/Waterline v0.12, this was not necessarily the case).
##### Result

@@ -22,0 +24,0 @@

@@ -7,3 +7,3 @@ # Full-stack JavaScript with Sails

#### Links
+ [Take the course](https://courses.platzi.com/classes/sails-js/)
+ [Take the course](https://platzi.com/cursos/sails-js/)
+ [Try out the demo app (Ration)](https://ration.io)

@@ -10,0 +10,0 @@ + [Download the source code](https://github.com/mikermcneil/ration) for the demo app

{
"name": "sails",
"author": "Mike McNeil <@mikermcneil>",
"version": "1.5.3",
"version": "1.5.4",
"description": "API-driven framework for building realtime apps, using MVC conventions (based on Express and Socket.io)",

@@ -40,3 +40,3 @@ "license": "MIT",

"ejs": "3.1.7",
"express": "4.17.1",
"express": "4.17.3",
"express-session": "1.17.0",

@@ -43,0 +43,0 @@ "flaverr": "^1.10.0",

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