Created
          June 30, 2021 06:32 
        
      - 
      
- 
        Save mayankchoubey/4e8f73d1b4a80750e7e2c38c504d2a96 to your computer and use it in GitHub Desktop. 
    URL shortener - service.ts
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import {getId} from "./utils.ts"; | |
| export function add(target:string) { | |
| const id=getId(); | |
| localStorage.setItem(id, target); | |
| return id; | |
| } | |
| export function get(id:string) { | |
| return localStorage.getItem(id.startsWith('/')?id.slice(1): id); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment