Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fromfrom

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fromfrom

LINQ inspired library to transform sequences of data

  • 1.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
348
decreased by-16.35%
Maintainers
1
Weekly downloads
 
Created
Source

fromfrom

Greenkeeper badge Build Status Coveralls Dev Dependencies Sponsored All Contributors

fromfrom is a LINQ inspired library to transform sequences of data.

Installation

npm install --save fromfrom

Documentation

Find it here.

Usage

The library exports only a single function, from. from wraps the given source data into a Sequence. Sequence has a wide range of chainable methods to operate and transform the sequence. The sequence can then be converted into a JS type.

For example

import { from } from "fromfrom";

// Transform an array of users
const users = [
  { id: 1, name: "John", age: 31, active: true },
  { id: 2, name: "Jane", age: 32, active: false },
  { id: 3, name: "Luke", age: 33, active: false },
  { id: 4, name: "Mary", age: 34, active: true },
];

from(users)
  .filter(user => user.active)
  .sortByDescending(user => user.age)
  .toArray();
// Returns
// [
//   { id: 4, name: "Mary", age: 34, active: true },
//   { id: 1, name: "John", age: 31, active: true }
// ]

Features

  • Familiar method names - Even though it's LINQ inspired, uses familiar method names from JS.
  • Supports all main JS types - Works with arrays, objects, maps, sets, and objects that implement the iterable protocol.
  • No dependencies - Guarantees small size.
  • Type safe - Written in TypeScript. Type definitions included.
  • Deferred execution - The execution of the sequence is deferred until you begin consuming the sequence.
  • Fully tested - 100% test coverage.

How does it work

See "how does it work" section from the initial release blog post.

Development

NPM scripts

  • npm t: Run test suite
  • npm start: Run npm run build in watch mode
  • npm run test:watch: Run test suite in interactive watch mode
  • npm run test:prod: Run linting and generate coverage
  • npm run build: Generate bundles and typings, create docs
  • npm run lint: Lints code
  • npm run commit: Commit using conventional commit style (husky will tell you to use it if you haven't :wink:)

Acknowledgement

Made with :heart: by @TomiTurtiainen.

This project is a grateful recipient of the Futurice Open Source sponsorship program. :heart:

Forked from TypeScript library starter

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Tomi Turtiainen

💻 📖 🚇 ⚠️

jtenner

💻 ⚠️ 📖

Ville Vaarala

🚧

Theo

💻

Rudolf Poels

📖

Andrew Ross

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Package last updated on 13 Mar 2022

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