@danielkalen/simplybind
Version:
Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.
120 lines (114 loc) • 3.12 kB
text/coffeescript
fs = require 'fs'
files = ['dist/simplybind.js', 'dist/simplybind.node.ugly.js']
replacements = [
[/optionsPassed/g, 'opts']
[/selector/g, 'selc']
[/property/g, 'prop']
[/descriptor/g, 'desc']
# [/this.placeholder/g, 'PH']
[/pholderValues/g, 'pVL']
[/pholderContexts/g, 'pCT']
[/pholderIndexMap/g, 'pIM']
[/this\[\"new"\]/g, 'this.new']
[/valuePassed/g, 'VLp']
[/valueOriginal/g, 'VLo']
[/simpleObject/g, 'sOJ']
[/textNodes/g, 'txN']
[/choices/g, 'cH']
# [/\.object/g, '.OB']
[/isLiveProp/g, 'isL']
[/isIterable/g, 'isI']
[/isDefined/g, 'iD']
[/isObject/g, 'iO']
[/isString/g, 'iS']
[/isNumber/g, 'iN']
[/isFunction/g, 'iF']
[/isBindingInterface/g, 'iBI']
[/isBinding/g, 'iB']
[/isDomInput/g, 'doI']
[/isDomRadio/g, 'doR']
[/isDomCheckbox/g, 'doC']
[/isDom/g, 'doM']
[/isMultiChoice/g, 'mC']
[/isElCollection/g, 'eC']
[/domElsAreSame/g, 'eAS']
[/lastProxied/g, 'lpX']
[/proxies/g, 'pX']
[/arrayBinding/g, 'aBI']
[/trackedChildren/g, 'tC']
[/eventName/g, 'evN']
[/isEmitter/g, 'iE']
[/eventHandler/g, 'evH']
[/eventObject/g, 'evO']
[/pollInterval/g, 'PI']
[/depsPholders/g, 'dPH']
[/depsMap/g, 'dM']
[/myPholders/g, 'mPH']
[/transforms/g, 'tfms']
[/conditions/g, 'cnds']
[/selfTransform/g, 'tfS']
[/customEventMethod/g, 'cEM']
[/throttleRate/g, 'thR']
[/throttleTimeout/g, 'thT']
[/lastUpdate/g, 'thLU']
[/stage/g, 'sG']
[/state/g, 'sT']
[/hasInitialBinding/g, 'hIB']
[/hasEventName/g, 'hEN']
[/hasTransform/g, 'hTf']
[/hasMultiTransform/g, 'hMTf']
[/hasConditions/g, 'hCs']
[/groupBinding/g, 'gB']
[/BindingInterface/g, 'BPi']
[/BindingMulti/g, 'BM']
[/Binding/g, 'BP']
[/defineMainProps/g, 'sOB']
[/createBinding/g, 'sOB']
[/patchCachedBinding/g, 'paC']
[/processTransform/g, 'pTF']
[/processCondition/g, 'pCN']
[/destroy/g, 'DES']
[/scanForPholders/g, 'sPH']
[/addUpdateListener/g, 'aUV']
[/attachEvents/g, 'aEV']
[/attachedEvents/g, 'atEV']
[/fetchDirectValue/g, 'fDV']
[/setValue/g, 'sV']
[/updateAllDeps/g, 'uAD']
[/updateDep\:/g, 'uD:']
[/updateDep\(/g, 'uD(']
[/updateSelf/g, 'uS']
[/applyPlaceholders/g, 'apP']
[/applyTransform/g, 'apT']
[/checkCondition/g, 'cC']
[/makePropertyLive/g, 'mPL']
[/invokeEventMethod/g, 'iEM']
[/emitEvent/g, 'eE']
[/emitChangeEvent/g, 'eCE']
[/addDep/g, 'aD']
[/removeDep/g, 'rD']
[/removeAllDeps/g, 'rAD']
[/addTransform/g, 'aTF']
[/addCondition/g, 'aCND']
[/registerEvent/g, 'rEVE']
[/unRegisterEvent/g, 'urEVE']
[/addPollInterval/g, 'aPI']
[/removePollInterval/g, 'rPI']
[/scanTextNodesPlaceholders/g, 'sTNP']
[/getNodeFullValue/g, 'gTNV']
[/applyTextContentReplace/g, 'aTNR']
[/invalidParamName/g, 'erIP']
[/fnOnly/g, 'erFN']
[/badEventArg/g, 'erEV']
[/onlyOneDOMElement/g, 'erOD']
[/emptyElList/g, 'erEL']
[/mixedElList/g, 'erMX']
]
files.forEach (filePath)->
fs.readFile filePath, {encoding:'utf8'}, (err, fileContent)-> if err then throw err else
output = fileContent
replacements.forEach (replacement)->
source = replacement[0]
dest = replacement[1]
output = output.replace(source, dest)
fs.writeFile filePath, output, (err)-> if err then throw err