Skip to content

Commit dc49873

Browse files
committed
fix(Builder): fixes mask modifier being removed by mistake
1 parent 9f6e180 commit dc49873

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,9 +896,9 @@ Following the Angular conventions, attributes that start with a '$' symbol are c
896896

897897
```javascript
898898
var Bike = restmod.model('/bikes').mix({
899-
createdAt: {mask:'CU'}, // won't send this attribute on Create or Update
900-
viewCount: {mask:'R'}, // won't load this attribute on Read (fetch)
901-
opened: {mask:true}, // will ignore this attribute in relation to the API
899+
createdAt: { ignore: 'CU' }, // won't send on Create or Update
900+
viewCount: { ignore: 'R' }, // won't load on Read (fetch)
901+
opened: { ignore: true }, // will ignore in every request and response
902902
});
903903
```
904904

src/module/builder.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ RMModule.factory('RMBuilder', ['$injector', 'inflector', '$log', 'RMUtils', func
175175
var mappings = [
176176
{ fun: 'attrDefault', sign: ['init'] },
177177
{ fun: 'attrMask', sign: ['ignore'] },
178+
{ fun: 'attrMask', sign: ['mask'] },
178179
{ fun: 'attrMap', sign: ['map', 'force'] },
179180
{ fun: 'attrDecoder', sign: ['decode', 'param', 'chain'] },
180181
{ fun: 'attrEncoder', sign: ['encode', 'param', 'chain'] },

test/builder-spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,18 @@ describe('Restmod builder:', function() {
139139
});
140140
});
141141

142+
// Builtin object modifiers
143+
144+
describe('mask', function() {
145+
it('should register a new mask ', function() {
146+
var Bike = restmod.model(null, {
147+
foo: { mask: 'CU' }
148+
});
149+
150+
var bike = Bike.$build({ foo: 'bar' }).$encode('CU');
151+
expect(bike.foo).toBeUndefined();
152+
});
153+
});
154+
142155
});
143156

0 commit comments

Comments
 (0)