diff -r 322d0feea350 -r 89ef5ed3c48b src/cm/media/js/lib/yui/yui_3.10.3/build/dataschema-base/dataschema-base-debug.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.10.3/build/dataschema-base/dataschema-base-debug.js Tue Jul 16 14:29:46 2013 +0200 @@ -0,0 +1,74 @@ +/* +YUI 3.10.3 (build 2fb5187) +Copyright 2013 Yahoo! Inc. All rights reserved. +Licensed under the BSD License. +http://yuilibrary.com/license/ +*/ + +YUI.add('dataschema-base', function (Y, NAME) { + +/** + * The DataSchema utility provides a common configurable interface for widgets to + * apply a given schema to a variety of data. + * + * @module dataschema + * @main dataschema + */ + +/** + * Provides the base DataSchema implementation, which can be extended to + * create DataSchemas for specific data formats, such XML, JSON, text and + * arrays. + * + * @module dataschema + * @submodule dataschema-base + */ + +var LANG = Y.Lang, +/** + * Base class for the YUI DataSchema Utility. + * @class DataSchema.Base + * @static + */ + SchemaBase = { + /** + * Overridable method returns data as-is. + * + * @method apply + * @param schema {Object} Schema to apply. + * @param data {Object} Data. + * @return {Object} Schema-parsed data. + * @static + */ + apply: function(schema, data) { + return data; + }, + + /** + * Applies field parser, if defined + * + * @method parse + * @param value {Object} Original value. + * @param field {Object} Field. + * @return {Object} Type-converted value. + */ + parse: function(value, field) { + if(field.parser) { + var parser = (LANG.isFunction(field.parser)) ? + field.parser : Y.Parsers[field.parser+'']; + if(parser) { + value = parser.call(this, value); + } + else { + Y.log("Could not find parser for field " + Y.dump(field), "warn", "dataschema-json"); + } + } + return value; + } +}; + +Y.namespace("DataSchema").Base = SchemaBase; +Y.namespace("Parsers"); + + +}, '3.10.3', {"requires": ["base"]});