Skip to content

Instantly share code, notes, and snippets.

'use strict';
const filtr = require('filterable');
module.exports = toJSFunction;
function toJSFunction(conditions) {
const keys = [];
const includes = ($v, v) => typeof v === 'string' ?
$v.toLowerCase().indexOf(v.toLowerCase()) !== -1 :
v.some((_v) => $v.toLowerCase() === _v.toLowerCase());
let REFLECTION_ID = 0;
const ReflectionFlag = {
Private: 1,
Protected: 2,
Public: 4,
Static: 8,
Exported: 16,
ExportAssignment: 32,
External: 64,
// Узел содержит значение с маской и связи. Формат узла:
{
scope: {block: ?String, elem: ?String},
block: ?String,
elems: ?Array<{
scope: {block: ?String, elem: ?String},
elem: ?String,
mods: ?Object<String, String[]>,
shouldDeps: ?Array,
mustDeps: ?Array
/* $ for i in common.blocks/button2/_theme/button2_theme_*.css; echo $i:; head $i; echo '---'; end */
/* common.blocks/button2/_theme/button2_theme_action.css: */
.button2_theme_action {
position: relative;
z-index: 0;
color: #000;
border: none;
outline: none;
}
/node_modules
/.gitignore
@qfox
qfox / gulpfile.js
Last active September 30, 2016 02:57
const path = require('path');
const gulp = require('gulp');
const debug = require('gulp-debug');
const Builder = require('gulp-bem-bundle-builder');
const bundler = require('gulp-bem-bundler-fs');
const postcss = require('gulp-postcss');
const postcssUrl = require('postcss-url');
const autoprefixer = require('autoprefixer');
const csso = require('gulp-csso');
@qfox
qfox / .eslintrc
Last active July 15, 2016 22:28
bundle-builder-prototype
parserOptions:
ecmaVersion: 6
sourceType: module
env:
node: true
es6: true
extends: pedant
@qfox
qfox / comb.js
Created June 30, 2016 21:30
comb.js
module.exports = function comb(matrix) {
return Object.keys(matrix).reduce((res, k) => _fillIn(res, k, matrix[k]), [{}]);
/**
* Adds all combinations of existing array and incoming variants
* @param {Array<Object>} combinations - existing combinations
* @param {String} key - new key for items in combinations
* @param {Array} values - values for new key
* @returns {Array<Object>} - modified
*/
@qfox
qfox / make.js
Last active February 3, 2016 13:23
nodeConfig.addTechs([
[require('enb-define'), {
target: '?.fullofconsoles.js',
sources: ['?.js'],
variables: {
ISLDEBUG: '*/!/*'
},
sourcemap: true
}]
]);
@qfox
qfox / gist:4688012
Created February 1, 2013 00:19
Variable naming style converters via camelCase one
String.prototype.toCamelCase = function() {
return this.substr(0, 1).toLowerCase() + this.substr(1).replace(/[\-_][a-z]/g, function($0){return $0.toUpperCase().replace(/[\_\-]/,'');});
};
String.prototype.toPascalCase = function() {
return this.substr(0, 1).toUpperCase() + this.substr(1).toCamelCase();
};
String.prototype.toUnderscore = function() {
return this.toCamelCase().replace(/[A-Z]/g, function($0){return "_"+$0.toLowerCase();}).replace(/^_/,'');
};
String.prototype.toDash = function() {