NOBUG: Fixed file access permissions
[moodle.git] / lib / yuilib / 3.13.0 / recordset-filter / recordset-filter-coverage.js
blob0f1f4a8719e4d507de40fad1194bdc0f0a4be785
1 /*
2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
8 if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
9 if (!__coverage__['build/recordset-filter/recordset-filter.js']) {
10    __coverage__['build/recordset-filter/recordset-filter.js'] = {"path":"build/recordset-filter/recordset-filter.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0},"b":{"1":[0,0],"2":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":47}}},"2":{"name":"RecordsetFilter","line":20,"loc":{"start":{"line":20,"column":0},"end":{"line":20,"column":33}}},"3":{"name":"(anonymous_3)","line":49,"loc":{"start":{"line":49,"column":12},"end":{"line":49,"column":37}}},"4":{"name":"(anonymous_4)","line":56,"loc":{"start":{"line":56,"column":21},"end":{"line":56,"column":36}}},"5":{"name":"(anonymous_5)","line":77,"loc":{"start":{"line":77,"column":12},"end":{"line":77,"column":30}}},"6":{"name":"(anonymous_6)","line":93,"loc":{"start":{"line":93,"column":10},"end":{"line":93,"column":29}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":105,"column":73}},"2":{"start":{"line":11,"column":0},"end":{"line":12,"column":14}},"3":{"start":{"line":20,"column":0},"end":{"line":22,"column":1}},"4":{"start":{"line":21,"column":4},"end":{"line":21,"column":66}},"5":{"start":{"line":24,"column":0},"end":{"line":32,"column":3}},"6":{"start":{"line":35,"column":0},"end":{"line":100,"column":3}},"7":{"start":{"line":50,"column":8},"end":{"line":51,"column":16}},"8":{"start":{"line":54,"column":8},"end":{"line":59,"column":9}},"9":{"start":{"line":55,"column":12},"end":{"line":55,"column":25}},"10":{"start":{"line":56,"column":12},"end":{"line":58,"column":14}},"11":{"start":{"line":57,"column":16},"end":{"line":57,"column":54}},"12":{"start":{"line":62,"column":8},"end":{"line":64,"column":11}},"13":{"start":{"line":78,"column":8},"end":{"line":80,"column":11}},"14":{"start":{"line":94,"column":8},"end":{"line":96,"column":11}},"15":{"start":{"line":102,"column":0},"end":{"line":102,"column":56}}},"branchMap":{"1":{"line":54,"type":"if","locations":[{"start":{"line":54,"column":8},"end":{"line":54,"column":8}},{"start":{"line":54,"column":8},"end":{"line":54,"column":8}}]},"2":{"line":54,"type":"binary-expr","locations":[{"start":{"line":54,"column":12},"end":{"line":54,"column":17}},{"start":{"line":54,"column":21},"end":{"line":54,"column":42}}]}},"code":["(function () { YUI.add('recordset-filter', function (Y, NAME) {","","/**"," * Plugin that provides the ability to filter through a recordset."," * Uses the filter methods available on Y.Array (see arrayextras submodule) to filter the recordset."," * @module recordset"," * @submodule recordset-filter"," */","","","var YArray = Y.Array,","Lang = Y.Lang;","","","/**"," * Plugin that provides the ability to filter through a recordset."," * Uses the filter methods available on Y.Array (see arrayextras submodule) to filter the recordset."," * @class RecordsetFilter"," */","function RecordsetFilter(config) {","    RecordsetFilter.superclass.constructor.apply(this, arguments);","}","","Y.mix(RecordsetFilter, {","    NS: \"filter\",","","    NAME: \"recordsetFilter\",","","    ATTRS: {","    }","","});","","","Y.extend(RecordsetFilter, Y.Plugin.Base, {","","","    /**","    Filter through the recordset with a custom filter function, or a key-value","    pair.","","    @method filter","    @param {Function|String} filter A custom filter function or a string","        representing the key to filter by.","    @param {Any} [value] If filtering by key (_filter_ is a string), further","        filter by a specific value.","    @return {Recordset} A new filtered Recordset instance","    **/","    filter: function (filter, value) {","        var recs = this.get('host').get('records'),","            key;","","        //If a key-value pair is passed in, generate a custom function","        if (value && Lang.isString(filter)) {","            key = filter;","            filter = function(item) {","                return (item.getValue(key) === value);","            };","        }","","        //TODO: PARENT CHILD RELATIONSHIP","        return new Y.Recordset({","            records: YArray.filter(recs, filter)","        });","    },","","    /**","    The inverse of filter. Executes the supplied function on each item. Returns","    a new Recordset containing the items that the supplied function returned","    `false` for.","","    @method reject","    @param {Function} filter A boolean function, executed on each item.","    @return {Recordset} A new Recordset instance containing the items on which","        the supplied function returned false.","    **/","    reject: function (filter) {","        return new Y.Recordset({","            records: YArray.reject(this.get('host').get('records'), filter)","        });","    },","","    /**","    Iterates over the Recordset, returning a new Recordset of all the elements","    that match the supplied regular expression","","    @method grep","    @param {RegExp} pattern The regular expression to test against each record.","    @return {Recordset} A Recordset instance containing all the items in the","        collection that produce a match against the supplied regular","        expression. If no items match, an empty Recordset instance is returned.","    **/","    grep: function (pattern) {","        return new Y.Recordset({","            records: YArray.grep(this.get('host').get('records'), pattern)","        });","    }","","    //TODO: Add more pass-through methods to arrayextras","});","","Y.namespace(\"Plugin\").RecordsetFilter = RecordsetFilter;","","","}, '3.13.0', {\"requires\": [\"recordset-base\", \"array-extras\", \"plugin\"]});","","}());"]};
12 var __cov_TsI_dK8wbZhYtrPX5hmtgA = __coverage__['build/recordset-filter/recordset-filter.js'];
13 __cov_TsI_dK8wbZhYtrPX5hmtgA.s['1']++;YUI.add('recordset-filter',function(Y,NAME){__cov_TsI_dK8wbZhYtrPX5hmtgA.f['1']++;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['2']++;var YArray=Y.Array,Lang=Y.Lang;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['3']++;function RecordsetFilter(config){__cov_TsI_dK8wbZhYtrPX5hmtgA.f['2']++;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['4']++;RecordsetFilter.superclass.constructor.apply(this,arguments);}__cov_TsI_dK8wbZhYtrPX5hmtgA.s['5']++;Y.mix(RecordsetFilter,{NS:'filter',NAME:'recordsetFilter',ATTRS:{}});__cov_TsI_dK8wbZhYtrPX5hmtgA.s['6']++;Y.extend(RecordsetFilter,Y.Plugin.Base,{filter:function(filter,value){__cov_TsI_dK8wbZhYtrPX5hmtgA.f['3']++;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['7']++;var recs=this.get('host').get('records'),key;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['8']++;if((__cov_TsI_dK8wbZhYtrPX5hmtgA.b['2'][0]++,value)&&(__cov_TsI_dK8wbZhYtrPX5hmtgA.b['2'][1]++,Lang.isString(filter))){__cov_TsI_dK8wbZhYtrPX5hmtgA.b['1'][0]++;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['9']++;key=filter;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['10']++;filter=function(item){__cov_TsI_dK8wbZhYtrPX5hmtgA.f['4']++;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['11']++;return item.getValue(key)===value;};}else{__cov_TsI_dK8wbZhYtrPX5hmtgA.b['1'][1]++;}__cov_TsI_dK8wbZhYtrPX5hmtgA.s['12']++;return new Y.Recordset({records:YArray.filter(recs,filter)});},reject:function(filter){__cov_TsI_dK8wbZhYtrPX5hmtgA.f['5']++;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['13']++;return new Y.Recordset({records:YArray.reject(this.get('host').get('records'),filter)});},grep:function(pattern){__cov_TsI_dK8wbZhYtrPX5hmtgA.f['6']++;__cov_TsI_dK8wbZhYtrPX5hmtgA.s['14']++;return new Y.Recordset({records:YArray.grep(this.get('host').get('records'),pattern)});}});__cov_TsI_dK8wbZhYtrPX5hmtgA.s['15']++;Y.namespace('Plugin').RecordsetFilter=RecordsetFilter;},'3.13.0',{'requires':['recordset-base','array-extras','plugin']});