1- /*
2- * Utility functions that make life easier.
3- */
1+
2+ /*global CSSLint*/
43
54/*
6- * Adds all properties from supplier onto receiver,
7- * overwriting if the same name already exists on
8- * reciever.
9- * @param {Object } The object to receive the properties.
10- * @param {Object } The object to provide the properties.
11- * @return {Object } The receiver
5+ * Utility functions that make life easier.
126 */
13- function mix ( receiver , supplier ) {
14- var prop ;
7+ CSSLint . Util = {
8+ /*
9+ * Adds all properties from supplier onto receiver,
10+ * overwriting if the same name already exists on
11+ * reciever.
12+ * @param {Object } The object to receive the properties.
13+ * @param {Object } The object to provide the properties.
14+ * @return {Object } The receiver
15+ */
16+ mix : function ( receiver , supplier ) {
17+ var prop ;
1518
16- for ( prop in supplier ) {
17- if ( supplier . hasOwnProperty ( prop ) ) {
18- receiver [ prop ] = supplier [ prop ] ;
19+ for ( prop in supplier ) {
20+ if ( supplier . hasOwnProperty ( prop ) ) {
21+ receiver [ prop ] = supplier [ prop ] ;
22+ }
1923 }
20- }
2124
22- return prop ;
23- }
25+ return prop ;
26+ } ,
2427
25- /*
26- * Polyfill for array indexOf() method.
27- * @param {Array } values The array to search.
28- * @param {Variant } value The value to search for.
29- * @return {int } The index of the value if found, -1 if not.
30- */
31- function indexOf ( values , value ) {
32- if ( values . indexOf ) {
33- return values . indexOf ( value ) ;
34- } else {
35- for ( var i = 0 , len = values . length ; i < len ; i ++ ) {
36- if ( values [ i ] === value ) {
37- return i ;
28+ /*
29+ * Polyfill for array indexOf() method.
30+ * @param {Array } values The array to search.
31+ * @param {Variant } value The value to search for.
32+ * @return {int } The index of the value if found, -1 if not.
33+ */
34+ indexOf : function ( values , value ) {
35+ if ( values . indexOf ) {
36+ return values . indexOf ( value ) ;
37+ } else {
38+ for ( var i = 0 , len = values . length ; i < len ; i ++ ) {
39+ if ( values [ i ] === value ) {
40+ return i ;
41+ }
42+ }
43+ return - 1 ;
44+ }
45+ } ,
46+
47+ /*
48+ * Polyfill for array forEach() method.
49+ * @param {Array } values The array to operate on.
50+ * @param {Function } func The function to call on each item.
51+ * @return {void }
52+ */
53+ forEach : function ( values , func ) {
54+ if ( values . forEach ) {
55+ return values . forEach ( func ) ;
56+ } else {
57+ for ( var i = 0 , len = values . length ; i < len ; i ++ ) {
58+ func ( values [ i ] , i , values ) ;
3859 }
3960 }
40- return - 1 ;
4161 }
42- }
62+ } ;
0 commit comments