Here is an example of ES6 classes without a class keyword but with class variables. Looks the same as classes and has the same structure internally.
// class
var Foo = {
classVariable: true,
var vfs = require('vinyl-fs'); | |
// symbolic links to folders | |
gulp.task('fonts', symlink('fonts', '..')); | |
gulp.task('images', symlink('images', '..')); | |
gulp.task('vendor', symlink('vendor', '..')); | |
function symlink(folder, dest) { | |
return function(){ | |
return vfs.src(folder, {followSymlinks: false}) |
function collapse (arr) { | |
return [...new Set(arr)]; | |
} | |
function isIterable(obj) { | |
return obj != null && typeof obj[Symbol.iterator] === 'function'; | |
} | |
function collapseAll (...args) { | |
const all = args.reduce((arr, arg) => { |
☄️ Why do you need Effector?
Effector is reactive state manager. It is decentralized, declarative and efficienct.
Effector was created to manage data in complex applications without danger of inflating a monolithic central store. It provides events/effects and reactive storages. It has explicit control flow, Flow and TypeScript type definitions and sufficient API
Here are some principles:
const groupEvents = events => { | |
for (const fromEvent of events) { | |
const eventCreate = fromEvent.create; | |
fromEvent.create = (data, fullName, args) => { | |
const [meta = {}] = args; | |
if (meta !== null && !meta.single) { | |
for (const toEvent of events) { | |
if (toEvent !== fromEvent) { | |
toEvent(data, { single: true }); |
Create $todos store (with an array) using createStore
. Then create a $todoList store using createStoreMap
.
There will be a map inside of $todoList store. Define map keys with getKey
function and values with createValue
function.
A value object should contain a store inside which will represent an item of your $todos array. Provide this store with a getStore
function.
As a result, $todoList will contain a map of value-objects (by keys). Each object will contain an item-store (with an item of a mapped array)
You can filter, map, concat or do anything you want with items of an array inside $todos.
// @flow | |
const myEvent = new CustomEvent<{ body: string }>('eventType', { | |
detail: { body: 'Specific Text' }, | |
}); | |
const myEventHandler = (event: typeof myEvent) => { | |
if (event.detail.body === 'Specific Text') { | |
// perform a certain action | |
} |
// Run each test in the new tab | |
const { performance, PerformanceObserver } = typeof window !== 'undefined' ? window : require('perf_hooks'); | |
function test() { | |
let objectSize = 30; | |
let iterations = 7000; | |
const values = { | |
'ENTRIES': 0, | |
'FOR-OF-KEYS': 0, |
var gulp = require('gulp'); | |
var gulpSequence = require('gulp-sequence'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var browserify = require('browserify'); | |
var uglify = require('gulp-uglify'); | |
gulp.task('mongoose', function() { | |
return browserify('./node_modules/mongoose/lib/browser.js') | |
.bundle() |
import { | |
notEmpty, | |
booleanType, | |
numberType, | |
numberMin, | |
numberMax, | |
numberGt, | |
numberLt, | |
numberBetween, | |
integerType, |