Coder Social home page Coder Social logo

collectionutils's Introduction

CollectionUtils

language language-top code-size release license discord

Utility methods for collections.

Usage

collection_flatten

Flattenize a collection.

collection_ify

Transform any input into collection. If already a collection return it.

collection_entries

Transform any collection into a collection of entries ie. object with key and value like OB Entries. Key is index, and value is the value at this index.

collection formula

Use Formula with collection functions like map, reduce, etc..

Method Name Formula Parameters Result Examples
c_formula $1, $2, $3, ... $0 ie. direct formula result test_c_formula
c_formula_this This.value, $1, $2, ... $0 ie. direct formula result test_c_formula_this
c_formula_raw This.value, $1, $2, ... This.result or This.accumulator must be modifyed test_c_formula_raw
$col:=New collection:C1472(1;2;3;4)
$result:=$col.map("c_formula";Formula:C1597($1+1))  // ++

Some reducers exemple using Formula

Code Description Examples
bifurcate Splits values into two groups using boolean bitmap test_bifurcate
bifurcateBy Splits values into two groups according to a predicate formula test_bifurcateBy
countBy Groups the elements based on the given formula and returns the count by group test_countBy
groupBy Groups the elements based on the given formula test_groupBy
indexBy Like groupBy, but for when you know your keys are unique. test_indexBy
mostFrequent Returns the most frequent element test_mostFrequent
zipObject Associate collections of keys and values and return an object test_zipObject

Installing

On Unix system open a terminal in your database root folder.

Using latest release

Download the latest release and put it into the Components/ folder

On unix system you could do it using this command

mkdir -p Components && curl -L https://github.com/mesopelagique/CollectionUtils/releases/latest/download/CollectionUtils.4DZ --output Components/CollectionUtils.4dz

Using git submodule

to use source code

git submodule add https://github.com/mesopelagique/CollectionUtils.git Components/CollectionUtils.4dbase

to use binary

git submodule add https://github.com/mesopelagique/CollectionUtils.git Components/CollectionUtils

Open the project, for instance in unix system

open Components/CollectionUtils/Project/CollectionUtils.4DProject

Compile it to Components/ folder. A CollectionUtils.4dbase will be created with inside a CollectionUtils.4dz

Unit tests

Execute allTests, which execute all method prefixed by test_

Result page

collectionutils's People

Contributors

e-marchand avatar mesopelagique avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

collectionutils's Issues

c_formula declaration

With these lines:

C_OBJECT ($ 1)
C_OBJECT ($ 2) // Formula
C_VARIANT ($ {1})

You said:
line 1: $1 is an object
line 2: $2 is an object
line 3: All variables since the first are Variant's type. This line hide the 2 precedents & later you use $1 assuming it is an object without testing the value type.

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.