Advertisement
pharmokan

wip coffee

Apr 15th, 2020
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. class Foo
  2. constructor: (@dir) ->
  3. @files ?= [@dir...]
  4. @state = {}
  5. getfiles: (@dir) ->
  6. fs.readdir
  7. @files
  8. split: (char) ->
  9. k = []
  10. # l = []
  11. #console.log @files
  12. @files.map (file) ->
  13. k.push String.prototype.split.call(file,char)[0]
  14. #l.push String.prototype.split.call(file,char)[1]
  15. return
  16. @files = [k...]
  17. [this]
  18. unique: () ->
  19. @files = Array.from new Set(@files)
  20. this
  21. as: (variable) ->
  22. @state[variable] = @files
  23. this
  24. getsku:
  25. this
  26. merge: (variable) ->
  27. #fix array var
  28. [array1, array2]
  29. .reduce (a, b) ->
  30. a.map (c, i) ->
  31. Object.assign({}, c, b[i])
  32. # arr = []
  33. # @state[variable].map (val) ->
  34. # arr2 = []
  35. # arr2.push ''
  36. # arr2.push ''
  37. # @state['merged'] = [arr...]
  38. this
  39. value: () ->
  40. this
  41.  
  42. console.log new Foo(['asdf_1.jpg','asdf','qwert.jpg','zxcv_2.jpg']).split('\.')[0].split('_')[0].unique().as('storis').value()
  43.  
  44.  
  45. # dir
  46. # .getfiles
  47. # .split('\.')[0]
  48. # .split('_')[0]
  49. # .unique.as('storis')
  50. # .then(getsku.prepend("#"))
  51. # .merge('storis')
  52. # .rename()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement