Guest User

Untitled

a guest
Jul 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. _.mixin
  2. array_shift: (inputArr) ->
  3. props = false
  4. shift = undefined
  5. pr = ''
  6. allDigits = /^\d$/
  7. int_ct = -1
  8. _checkToUpIndices = (arr, ct, key) ->
  9. #Deal with situation, e.g., if encounter index 4 and try to set it to 0, but 0 exists later in loop (need to
  10. #increment all subsequent (skipping current key, since we need its value below) until find unused)
  11. if arr[ct] isnt undefined
  12. tmp= ct
  13. ct += 1
  14. if ct is key then ct += 1
  15. ct= _checkToUpIndices(arr, ct, key)
  16. arr[ct]= arr[tmp]
  17. delete arr[tmp]
  18. return ct
  19. if inputArr.length is 0 then null
  20. if inputArr.length > 0 then _.array_shift(inputArr)
Add Comment
Please, Sign In to add comment