Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo
- constructor: (@dir) ->
- @files ?= [@dir...]
- @state = {}
- getfiles: (@dir) ->
- fs.readdir
- @files
- split: (char) ->
- k = []
- # l = []
- #console.log @files
- @files.map (file) ->
- k.push String.prototype.split.call(file,char)[0]
- #l.push String.prototype.split.call(file,char)[1]
- return
- @files = [k...]
- [this]
- unique: () ->
- @files = Array.from new Set(@files)
- this
- as: (variable) ->
- @state[variable] = @files
- this
- getsku:
- this
- merge: (variable) ->
- #fix array var
- [array1, array2]
- .reduce (a, b) ->
- a.map (c, i) ->
- Object.assign({}, c, b[i])
- # arr = []
- # @state[variable].map (val) ->
- # arr2 = []
- # arr2.push ''
- # arr2.push ''
- # @state['merged'] = [arr...]
- this
- value: () ->
- this
- console.log new Foo(['asdf_1.jpg','asdf','qwert.jpg','zxcv_2.jpg']).split('\.')[0].split('_')[0].unique().as('storis').value()
- # dir
- # .getfiles
- # .split('\.')[0]
- # .split('_')[0]
- # .unique.as('storis')
- # .then(getsku.prepend("#"))
- # .merge('storis')
- # .rename()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement