All Projects → winterbe → Sequency

winterbe / Sequency

Licence: mit
⚡️ Type-safe functional sequences for processing iterable data

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Sequency

Period
PHP's time range API
Stars: ✭ 616 (+109.52%)
Mutual labels:  sequence, collection
Moses
Utility library for functional programming in Lua
Stars: ✭ 541 (+84.01%)
Mutual labels:  collection, functional
Easysequence
EasySequence is a powerful fundamental library to process sequcence type, such as array, set, dictionary. All type object which conforms to NSFastEnumeration protocol can be initialzed to an EZSequence instance, then you can operation with them. Finally, you can transfer them back to the original type.
Stars: ✭ 150 (-48.98%)
Mutual labels:  sequence, collection
Fromfrom
A JS library written in TS to transform sequences of data from format to another
Stars: ✭ 462 (+57.14%)
Mutual labels:  sequence, collection
dart-more
More Dart — Literally.
Stars: ✭ 81 (-72.45%)
Mutual labels:  functional, collection
konsumers
Advanced work with Kotlin sequences
Stars: ✭ 21 (-92.86%)
Mutual labels:  sequence
Wmzbanner
最好用的轻量级轮播图+卡片样式+自定义样式,链式编程语法(可实现各种样式的轮播图,大多需要的功能都有)(The best lightweight carousel + card style + custom style, chain programming syntax)
Stars: ✭ 266 (-9.52%)
Mutual labels:  collection
FrontEnd-Note
FrontEnd Knowledge Package 📦
Stars: ✭ 14 (-95.24%)
Mutual labels:  functional
demos
Demonstrative scripts
Stars: ✭ 37 (-87.41%)
Mutual labels:  collection
Function2
Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more
Stars: ✭ 290 (-1.36%)
Mutual labels:  functional
Rex
Your RegEx companion.
Stars: ✭ 283 (-3.74%)
Mutual labels:  functional
Typed Immutable
Immutable and structurally typed data
Stars: ✭ 263 (-10.54%)
Mutual labels:  functional
basicode
A collection of BASICODE programs by various authors
Stars: ✭ 29 (-90.14%)
Mutual labels:  collection
Vue Demo Collection
A collection of Vue.js demos
Stars: ✭ 274 (-6.8%)
Mutual labels:  collection
finger-tree
🌵 Finger tree data structure for JavaScript
Stars: ✭ 20 (-93.2%)
Mutual labels:  functional
Zheng
基于Spring+SpringMVC+Mybatis分布式敏捷开发系统架构,提供整套公共微服务服务模块:集中权限管理(单点登录)、内容管理、支付中心、用户管理(支持第三方登录)、微信平台、存储系统、配置中心、日志分析、任务和通知等,支持服务治理、监控和追踪,努力为中小型企业打造全方位J2EE企业级开发解决方案。
Stars: ✭ 16,163 (+5397.62%)
Mutual labels:  sequence
fib-anyon
An implementation of Fibonacci Anyons in Haskell
Stars: ✭ 18 (-93.88%)
Mutual labels:  functional
Switzerland
🇨🇭Switzerland takes a functional approach to Web Components by applying middleware to your components. Supports Redux, attribute mutations, CSS variables, React-esque setState/state, etc… out-of-the-box, along with Shadow DOM for style encapsulation and Custom Elements for interoperability.
Stars: ✭ 261 (-11.22%)
Mutual labels:  functional
Fpp
Functional PHP Preprocessor - Generate Immutable Data Types
Stars: ✭ 282 (-4.08%)
Mutual labels:  functional
Vaporschool
Learn how to build vapor applications from rookie to champion in a constructive way!
Stars: ✭ 259 (-11.9%)
Mutual labels:  collection

Sequencey Travic CI

Type-safe functional sequences for processing iterable data in TypeScript and JavaScript.

Sequencey


★★★ Like this project? Leave a star, follow on Twitter or donate to support my work! Thanks. ★★★

About Sequency

Sequency is a lightweight (5 KB minified), intensely tested (200+ tests, 99% coverage), type-safe functional programming library for processing iterable data such as arrays, sets and maps. It's written in TypeScript, compiles to ES5-compatible JavaScript and works in all current browsers and Node applications. The API is inspired by Sequences from the programming language Kotlin.

Not convinced? Try Sequency right in your browser.

Getting started

Download the latest release from GitHub or install Sequency from NPM:

npm install --save sequency

Alternatively use Sequency from CDN by adding this to your HTML:

<script src="https://unpkg.com/sequency"></script>

How Sequency works

Sequency is centered around a single class called Sequence to process any kind of iterable data such as arrays, sets or maps. The API is inspired by Kotlin Sequences.

Sequences can be created by utilizing one of the following functions:

import {
    asSequence,
    sequenceOf, 
    emptySequence, 
    range,
    generateSequence,
    extendSequence
} from 'sequency';
  • sequenceOf accepts one or many values and returns a new sequence.
  • asSequence accepts an iterable (e.g. an array, set or map) and returns a new sequence.
  • emptySequence returns a new empty sequence.
  • range returns as number sequence consisting of all numbers between startInclusive and endExclusive.
  • generateSequence returns a sequence generated from the given generator function.
  • extendSequence allows extending sequences with user-defined operations (see example).

Each Sequence provides a fluent functional API consisting of intermediate and terminal operations. Intermediate functions (e.g. filter, map, sorted) return a new sequence, thus enabling method chaining. Terminal functions (e.g. toArray, groupBy, findLast) return an arbitrary result. Detailed descriptions of all operations are available in the API docs.

Sequences are lazily evaluated to avoid examining all of the input data when it's not necessary. Sequences always perform the minimal amount of operations to gain results. E.g. in a filter - map - find sequence both map and find are executed just one time before returning the single result.

API documentation

Sequency is fully documented via inline JSDoc comments. The docs are also available online. When using an IDE like Intellij IDEA or Webstorm the docs are available inline right inside your editor.

Why Sequency?

I've built Sequency because I'm using Kotlin for server-side code but for some reasons still use TypeScript and JavaScript for client-side browser code. I find that using the same APIs for collection processing both on client and server is a huge gain in productivity for me.

License

MIT © Benjamin Winterberg

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].