Coder Social home page Coder Social logo

js-kasen's Introduction

Kasen

npm version CircleCI codecov

Kasen is the library of collection methods which is inspired by Lodash, Immutable, Rambda, Scala and Elixir.

Note that Kasen is experimental state. APIs can be changed in the future.

What does Kasen mean?

"Kasen" means "underscore" in Japanese ๐Ÿ˜›

Installation

npm install kasen

Import

  • ES Modules: import Kasen from "kasen";
  • CommonJS: const Kasen = require("kasen");

Example

const result1 = Kasen.map({ a: 1, b: 2, c: 3 }, v => v + 1);
console.log(result1); // => { a: 2, b: 3, c: 4 }

const result2 = Kasen([1, 2, 3])
  .filter(v => v % 2 === 1)
  .map(v => v + 1)
  .toJS();
console.log(result2); // => [2, 4]

Feature

  1. Immutability: Methods do not mutate an input collection.

    const input = [1, 2, 3];
    const result = Kasen.push(input, 4);
    console.log(input); // => [1, 2, 3]
    console.log(result); // => [1, 2, 3, 4]
  2. Lazy Evaluation: Method chaining does not process unnecessary calculations.

    const result = Kasen([1, 2, 3])
      .map(v => {
        console.log(v);
        return v + 1;
      })
      .every(v => v % 2 === 0);
    // => 1
    // => 2
    console.log(result); // => false
  3. Great Selection of Methods: Kasen will have a lot of collection methods.

    • 96 methods for Array.
    • 57 methods for Object.
  4. Light Weight: Kasen will be light weight library.

    • Kasen is 68 KB now.

APIs

Note that documentation is under construction.

Contribution

TBD

License

Kasen is MIT-licensed.

js-kasen's People

Contributors

ttokutake avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

js-kasen's Issues

Use npm-run-all?

  • build sources before tests
  • should use NODE_ENV in webpack.config.js

memoize()

  • memoize() at Ramda
  • cacheResult() at Immutable

What does "kasen" mean ?

Hi, I'm really interested in your awesome library!! ๐ŸŽ‰
I would like to know the "kasen" mean. Would you update README.md, and write down the origin of it and your elegant thoughts ?

concat()

[].concat([1, 2, 3], 4) // => [1, 2, 3, 4]

Use Iterator

ใชใ‚“ใ‹ใ‚ใฃใกใ‚ƒๅ‹˜้•ใ„ใ—ใฆใ„ใŸใŒใ€Map็”จใฎIteratorใจใ‹ใƒกใ‚ฝใƒƒใƒ‰ๆฏŽใซ็”จๆ„ใ—ใฆใ‚„ใ‚‹ๆ„Ÿใ˜ใ ใฃใŸใฎใ‚’ๆ€ใ„ๅ‡บใ—ใŸ...
ไป–ใฎใƒฉใ‚คใƒ–ใƒฉใƒชใƒผๅ‚่€ƒใซใ—ใฆๅฎŸ่ฃ…ใ—ใฆใฟใ‚‹ใ€‚

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.