New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

iwrap

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iwrap

A wrapper around Iterable to bring access to powerful methods like `filter`, `map`, etc ...

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Iterable Wrapper

Version License: MIT

A wrapper around Iterable to bring access to powerful methods like filter, map, etc ...

Install

Install by running this command:

npm i iwrap

How to use

import { IWrap } from "iwrap";

const scores = new Map([
    ["Alice", 500],
    ["Bob", 356],
    ["Charles", 42],
    ["David", 999],
]);

// Output wanted:
// Alice.........................500
// Bob...........................356
// Charles.......................42
// David.........................999

// Without IWrap
const display1 = Array.from(scores) //from: scores is iterated and a array is created.
    // map: previous array is iterated and a new array is created.
    .map(([name, score]) => `${name}${".".repeat(30 - name.length)}${score}`)
    // join: previous array is iterated and return a string.
    .join("\n");
// Result: 3 iterations
console.log(display1);

// With IWrap
const display2 = IWrap.from(scores) // from: creates a wrapper around scores.
    // map: a new wrapper is created around the prevous one.
    .map(([name, score]) => `${name}${".".repeat(30 - name.length)}${score}`)
    // join: iterate the previous wrapper and return a string.
    .join("\n");
// Result: 1 iteration
console.log(display2);

Author

👤 Tristan Guichaoua

  • Github: @tguichaoua

📝 License

Copyright © 2021 Tristan Guichaoua.
This project is MIT licensed.

Keywords

FAQs

Package last updated on 12 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc