From 7f71c29e6558eefc5904ca0dfcb7ec898b2492a5 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 14 May 2012 16:04:37 -0700 Subject: adding some test converters Signed-off-by: Valerio Virgillito --- js/components/converter/string-units-converter.js | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 js/components/converter/string-units-converter.js (limited to 'js/components/converter/string-units-converter.js') diff --git a/js/components/converter/string-units-converter.js b/js/components/converter/string-units-converter.js new file mode 100644 index 00000000..6b97d5c5 --- /dev/null +++ b/js/components/converter/string-units-converter.js @@ -0,0 +1,31 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +var Montage = require("montage").Montage, + Converter = require("montage/core/converter/converter").Converter, + NJUtils = require("js/lib/NJUtils").NJUtils; + +exports.StringUnitsConverter = Montage.create(Converter, { + + // convert fahrenheit to celsius (showing our non-metric heritage here) + convert: { + value: function(value) { + if(value) { + console.log("convert string to unit ", value); + var tmp = NJUtils.getValueAndUnits(value); + return tmp[1]; + } + } + }, + + // revert celsius to fahrenheit + revert: { + value: function(value) { + console.log("revert string to unit ", value); + return value; + } + } + +}); -- cgit v1.2.3