From 8fee1edb25b7875f6ca51eb70dc2b6687e55cccd Mon Sep 17 00:00:00 2001 From: fabioh8010 Date: Tue, 29 May 2018 15:27:19 -0300 Subject: [PATCH 1/3] Adds toRawValue() method to service --- lib/mask-service.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/mask-service.js b/lib/mask-service.js index 19376077..41e3a606 100644 --- a/lib/mask-service.js +++ b/lib/mask-service.js @@ -5,6 +5,10 @@ export default class MaskService { return MaskResolver.resolve(type).getValue(value, settings); } + static toRawValue(type, maskedValue, settings) { + return MaskResolver.resolve(type).getRawValue(maskedValue, settings); + } + static isValid(type, value, settings) { return MaskResolver.resolve(type).validate(value, settings); } From 66d918d202a663ee3e88cd070ae01a40b8b7a646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Tue, 29 May 2018 15:42:33 -0300 Subject: [PATCH 2/3] Updates lib version, dist and readme --- README.md | 4 ++++ dist/lib/mask-service.js | 4 ++++ package-lock.json | 2 +- package.json | 9 +++++++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c0826236..2497ebd2 100644 --- a/README.md +++ b/README.md @@ -392,6 +392,10 @@ var money = MaskService.toMask('money', '123', { # Changelog +## 1.6.6 + +* Adding `toRawValue` method to MaskService. (thanks to [fabioh8010](https://github.com/fabioh8010)) + ## 1.6.5 * Fixing validation for CPF and CNPJ when empty string is inputed. (thanks to [gabuael](https://github.com/gabuael)) diff --git a/dist/lib/mask-service.js b/dist/lib/mask-service.js index 7551887a..af23f8b7 100644 --- a/dist/lib/mask-service.js +++ b/dist/lib/mask-service.js @@ -3,6 +3,10 @@ Object.defineProperty(exports,"__esModule",{value:true});var _createClass=functi MaskService=function(){function MaskService(){_classCallCheck(this,MaskService);}_createClass(MaskService,null,[{key:'toMask',value:function toMask( type,value,settings){ return _maskResolver2.default.resolve(type).getValue(value,settings); +}},{key:'toRawValue',value:function toRawValue( + +type,maskedValue,settings){ +return _maskResolver2.default.resolve(type).getRawValue(maskedValue,settings); }},{key:'isValid',value:function isValid( type,value,settings){ diff --git a/package-lock.json b/package-lock.json index e28cb996..49c2fef5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-masked-text", - "version": "1.6.4", + "version": "1.6.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f39b1237..a297bb88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-masked-text", - "version": "1.6.5", + "version": "1.6.6", "description": "Text and TextInput with mask for React Native applications", "licenses": [ { @@ -19,7 +19,12 @@ "type": "git", "url": "git+https://github.com/benhurott/react-native-masked-text.git" }, - "keywords": ["mask", "text", "textinput", "react-native"], + "keywords": [ + "mask", + "text", + "textinput", + "react-native" + ], "author": "Ben-hur Santos Ott", "license": "ISC", "bugs": { From cca30ff89a154ecad0ea8ec35762a2c678705a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Tue, 29 May 2018 15:47:10 -0300 Subject: [PATCH 3/3] Updates readme methods --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2497ebd2..08eef06a 100644 --- a/README.md +++ b/README.md @@ -368,6 +368,9 @@ If you want, we expose the `MaskService`. You can use it: * static toMask(type, value, settings): mask a value. _ `type` (String, required): the type of the mask (`cpf`, `datetime`, etc...) _ `value` (String, required): the value to be masked \* `settings` (Object, optional): if the mask type accepts options, pass it in the settings parameter +* static toRawValue(type, maskedValue, settings): get the raw value of a masked value. + _ `type` (String, required): the type of the mask (`cpf`, `datetime`, etc...) + _ `maskedValue` (String, required): the masked value to be converted in raw value \* `settings` (Object, optional): if the mask type accepts options, pass it in the settings parameter * static isValid(type, value, settings): validate if the mask and the value match. _ `type` (String, required): the type of the mask (`cpf`, `datetime`, etc...) _ `value` (String, required): the value to be masked \* `settings` (Object, optional): if the mask type accepts options, pass it in the settings parameter