1//======================================= FUNCTIONS =========================================// 2 3/** 4 * @param{number} n - колиÑеÑÑво пÑедмеÑов 5 * @param{Array} titles - маÑÑив ваÑианÑов Ñлова, напÑ. ['ÑоваÑ','ÑоваÑа','ÑоваÑов'] 6 * */ 7if (typeof declOfNum === 'undefined') { 8 declOfNum = (n, titles) => titles[(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2)]; 9} 10 11if (typeof capitalize === 'undefined') { 12 capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1); 13} 14 15if (typeof array_max === 'undefined') { 16 array_max = (numArray) => Math.max.apply(null, numArray); 17} 18 19if (typeof array_intersect === 'undefined') { 20 array_intersect = (array1, array2) => array1.filter(n => array2.indexOf(n) !== -1); 21} 22 23if (typeof in_array === 'undefined') { 24 in_array = (needle, array) => array.indexOf(needle) !== -1; 25} 26 27if (typeof distinct === 'undefined') { 28 distinct = (value, index, self) => self.indexOf(value) === index; 29} 30 31if (typeof array_distinct === 'undefined') { 32 array_distinct = (array) => array.filter(distinct); 33} 34 35if (typeof array_merge === 'undefined') { 36 array_merge = (array1, array2) => array1.concat(array2); 37} 38 39if (typeof array_merge_unique === 'undefined') { 40 array_merge_unique = (array1, array2) => array_distinct(array_merge(array1, array2)); 41} 42 43/** 44 * пÑовеÑÑеÑ, ÑÑÑеÑÑвÑÐµÑ Ð»Ð¸ вложеннÑй пÑÑÑ Ð² обÑекÑе, маÑÑиве или ÑÑÑоке 45 * ÑоÑÐ¼Ð°Ñ Ð²Ñзова checkPath({a:{b:{c:{}}}},'a','b','c'), checkPath(['a',['b',['c']]],0,1,0) 46 * Ð´Ð»Ñ Ð¾Ð±ÑекÑов Ð¸Ð´ÐµÑ Ð¿Ð¾ клÑÑам, Ð´Ð»Ñ Ð¼Ð°ÑÑивов и ÑÑÑок - по индекÑам 47 * возвÑаÑÐ°ÐµÑ true/false 48 * https://stackoverflow.com/questions/2631001/test-for-existence-of-nested-javascript-object-key 49 * */ 50if (typeof checkPath === 'undefined') { 51 checkPath = (obj, level, ...rest) => { 52 if (obj === undefined) return false; 53 if (rest.length == 0 && obj.hasOwnProperty(level)) return true; 54 return checkPath(obj[level], ...rest); 55 } 56} 57 58/** 59 * возвÑаÑÐ°ÐµÑ Ð²Ð»Ð¾Ð¶ÐµÐ½Ð½Ð¾Ðµ знаÑение по пÑÑи в обÑекÑе, маÑÑиве или ÑÑÑоке 60 * ÑоÑÐ¼Ð°Ñ Ð²Ñзова getPath({a:{b:{c:{}}}},'a','b','c'), getPath(['a',['b',['c']]],0,1,0) 61 * Ð´Ð»Ñ Ð¾Ð±ÑекÑов Ð¸Ð´ÐµÑ Ð¿Ð¾ клÑÑам, Ð´Ð»Ñ Ð¼Ð°ÑÑивов и ÑÑÑок - по индекÑам 62 * возвÑаÑÐ°ÐµÑ Ð·Ð½Ð°Ñение или undefined 63 * https://stackoverflow.com/questions/2631001/test-for-existence-of-nested-javascript-object-key 64 * */ 65if (typeof getPath === 'undefined') { 66 getPath = (obj, level, ...rest) => { 67 if (obj === undefined) return undefined; 68 if (rest.length == 0 && obj.hasOwnProperty(level)) return obj[level]; 69 return getPath(obj[level], ...rest); 70 } 71} 72 73if (typeof newUUID === 'undefined') { 74 newUUID = () => (new Date).getTime().toString(36); 75}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.