UNPKG

@danielkalen/simplybind

Version:

Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.

135 lines (129 loc) 3.46 kB
fs = require 'fs' files = ['dist/simplybind.js', 'dist/simplybind.node.ugly.js'] replacements = [ [/optionsPassed/g, 'oP'] [/optionsDefault/g, 'oD'] [/saveOptions/g, 'so'] [/\.default/g, '.de'] [/deOptions/g, 'defaultOptions'] [/interface/g, 'In'] [/selector/g, 'se'] [/property/g, 'pr'] [/descriptor/g, 'de'] [/origFn/g, 'oR'] # [/this.placeholder/g, 'PH'] [/pholderValues/g, 'pVL'] [/pholderContexts/g, 'pCT'] [/pholderIndexMap/g, 'pIM'] [/pholder/g, 'Ph'] [/myPholder/g, 'mP'] # [/this\[\"new"\]/g, 'this.new'] [/valueSource/g, 'vs'] [/valuePassed/g, 'ps'] [/valueRef/g, 'VR'] # [/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'] [/isArray/g, 'iA'] [/isString/g, 'iS'] [/isNumber/g, 'iN'] [/isFunction/g, 'iF'] # [/isSimpleObject/g, 'iSO'] [/isSibling/g, 'iSi'] [/isProxy/g, 'iP'] [/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'] [/interfaces/g, 'nF'] [/arrayBinding/g, 'aBI'] [/trackedChildren/g, 'tC'] [/eventName/g, 'evN'] [/isEmitter/g, 'iE'] [/eventHandler/g, 'evH'] [/eventObject/g, 'evO'] [/pollInterval/g, 'PI'] # [/subsPholders/g, 'sP'] [/subsMeta/g, 'sM'] [/pubsMap/g, 'pM'] [/transformFn/g, 'tF'] [/conditionFn/g, 'cN'] [/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'] [/groupBinding/g, 'gB'] [/parentBinding/g, 'pB'] [/BindingInterface/g, 'BPi'] [/GroupBinding/g, 'GB'] [/Binding/g, 'BP'] [/selfClone/g, 'sC'] [/setObject/g, 'sS'] [/addToPublisher/g, 'aP'] [/defineMainProps/g, 'dM'] [/createBinding/g, 'sOB'] [/patchCachedBinding/g, 'paC'] [/addModifierFn/g, 'aM'] # [/setModifierFn/g, 'SM'] [/setSelfTransform/g, 'ss'] [/destroy/g, 'DES'] [/scanForPholders/g, 'sPH'] [/addUpdateListener/g, 'aUV'] [/attachEvents/g, 'aEV'] [/attachedEvents/g, 'atEV'] [/fetchDirectValue/g, 'fDV'] [/setValue/g, 'sV'] [/updateAllSubs/g, 'uAS'] [/updateSub/g, 'uS'] [/uSsOnEvent/g, 'updateSubsOnEvent'] [/updateSelf/g, 'uSL'] [/updateOnce/g, 'uO'] [/applyPlaceholders/g, 'apP'] [/convertToLive/g, 'cL'] [/invokeEventMethod/g, 'iEM'] [/emitEvent/g, 'eE'] [/emitChangeEvent/g, 'eCE'] [/addBinding/g, 'aB'] [/addSub/g, 'aS'] [/removeSub/g, 'rS'] [/removeAllSubs/g, 'rAS'] [/publisherInterface/g, 'pI'] [/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