Skip to content

Commit

Permalink
Merge pull request #75 from enten/master
Browse files Browse the repository at this point in the history
Fix toLowerCase hook
  • Loading branch information
ekryski authored and daffl committed Aug 29, 2018
1 parent a89f65b commit 6605e3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/authentication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ app.io.on('connect', function(){

## Changelog

### 0.3.1

- Fix `toLowerCase` hook ([#74](https://github.com/feathersjs/feathers-authentication/issues/74))

### 0.2.2

- Fix customization of the `tokenEndpoint` ([#57](https://github.com/feathersjs/feathers-authentication/issues/57))
Expand Down
6 changes: 3 additions & 3 deletions packages/authentication/src/hooks/to-lower-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* looks for the key on the data object for before hooks and the result object for
* the after hooks.
*/
export default function toLowercase(options = {}) {
export default function toLowerCase(options = {}) {
const fieldName = options.fieldName;

if (!fieldName) {
throw new Error('You must provide the name of the field to use in the toLowerCase hook.');
}

function convert(obj){
if (obj[fieldName] && obj[fieldName].toLowercase) {
if (obj[fieldName] && obj[fieldName].toLowerCase) {
obj[fieldName] = obj[fieldName].toLowerCase();
}
}
Expand Down

0 comments on commit 6605e3e

Please sign in to comment.