dedupe

Version, currently master branch1 version
  • master branchlatestAug 22, 2017

github.com/samueleaton/dedupe-app

Service that removes duplicates from array of strings

1 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  dedupe:
    github: samueleaton/dedupe-app
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.23.1
License
MIT
Author
Sam Eaton
Target
  • dedupe from src/dedupe.cr

Dependencies

Runtime Dependencies

  • raze*github: samueleaton/raze

README

dedupe

Removes Duplicates from Array of Strings

Usage

Building the Docker Image

docker build -f Dockerfile -t dedupe .

Running the Docker Container

docker run --name dedupe -p 7777:7777 -d dedupe

Dedupe Core Algorithm

module Dedupe
  def self.remove_duplicates(list : Array(String))
    temp_hash = {} of String => Int32
    result = [] of String

    list.each do |str|
      unless temp_hash[str]?
        temp_hash[str] = 1
      end
    end

    temp_hash.each do |k, v|
      result << k
    end

    result
  end
end

Dedupe.remove_duplicates(["sameaton11@gmail.com", "sameaton11@gmail.com"])

Running Specs

# install crystal deps
shards install
# run specs
crystal spec --release

Contributors