{"id":17273553,"url":"https://github.com/markmandel/sesame","last_synced_at":"2026-02-18T07:31:43.445Z","repository":{"id":2827612,"uuid":"3829959","full_name":"markmandel/Sesame","owner":"markmandel","description":"Library of functions to be used with ColdFusion Closures.","archived":false,"fork":false,"pushed_at":"2012-07-04T22:51:36.000Z","size":157,"stargazers_count":36,"open_issues_count":1,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-23T23:46:39.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"ColdFusion","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markmandel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-26T05:33:52.000Z","updated_at":"2025-01-30T17:39:12.000Z","dependencies_parsed_at":"2022-08-26T07:50:18.214Z","dependency_job_id":null,"html_url":"https://github.com/markmandel/Sesame","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmandel%2FSesame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmandel%2FSesame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmandel%2FSesame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markmandel%2FSesame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markmandel","download_url":"https://codeload.github.com/markmandel/Sesame/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245659050,"owners_count":20651525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T08:51:35.369Z","updated_at":"2025-10-19T16:22:47.325Z","avatar_url":"https://github.com/markmandel.png","language":"ColdFusion","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003c!--\nCopyright 2012 Mark Mandel\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--\u003e\n\nSesame\n======\n\n\u003e *\"Then he thought within himself: \"I too will try the virtue of those magical words and see if at my bidding the door will open and close.\" So he called out aloud, \"Open, Sesame!\" And no sooner had he spoken than straightway the portal flew open and he entered within.\"*\u003cbr/\u003e\n\u003e\t- [Ali Baba and the Forty Thieves, translated by Sir Richard Burton, 1850][1].\n\n*Sesame* is a library of functions for use with closures.\n\nAll functions start with an underscore, so as to not collide with already existing ColdFusion or functions that you may have written in your page or component.\n\nIt currently has 4 sections:\n\n- Collections: for the use with arrays and structs\n- Functions: for the use with other functions and closures.\n- Numbers: for use with numbers and general looping\n- Concurrency: To make threading operations easier\n\n\n## Collections ##\n\nFunctions that allow you manipulate and use structs and arrays much easier\n\n### _collect(any data, function transform) : array ###\n\ncollect data from a array, structure or query into a whole new array. Transform closure should return the item that i to be added to the new array.\n\n* data - the array / struct / query to collect from\n* transform - closure to return the item for the new array\n\n### _collectEntries(any data, function transform) : struct ###\n\ncollect data from an array, struct or query into a new struct. The transform function can return either a Map, with a single key to be used as the key, and a 2nd level struct, or an array, where the 1st index in the key, and the 2nd is the value.\n\n* data - the array / struct / query to collect from\n* transform - the closure to create the map entry.\n\n### _groupBy(any data, function grouping) : struct ###\n\nTake an array/struct and group the data into a grouped struct. The closure should return the key that the data should be grouped by. For arrays, this will return a struct of arrays. For structs, this will return a struct of structures.\n\n* data - the array / struct\n* grouping - the closure to return the group key.\n\n### _queryEach(query data, [function func]) : any ###\n\nIterates over a query and executes the closure on each row.\n\n* data - the query\n* func - the closure\n\n### _unique(any data, [function comparator]) : any ###\n\nReturns an array with all the duplicates removed (i.e. unique). For structs, this iterates through all the values, and returns an array from that, with duplicates removed.\n\n* data - the array/struct\n* comparator - optional comparator closure that takes 2 arguments for comparing of objects, and returns 0 if they are the same. If not supplied, then natural comparison will be used.\n\n## Functions ##\n\nFunctions that allow you to manipulate other functions / closures\n\n### _curry(function func, array args) : function ###\n\nCurry a function from left to right. Currying is creating a wrapper function where you set a constant value for one or more of the arguments of the function being wrapped. If you curry the function: `function (a,b,c)` with values `[4,2]`, then your wrapper will accept one argument (`c`), and always pass 4 for `a` and 2 for `b`.\n\n* func - the function/closure you want to curry\n* args - the array of arguments you wish to curry with.\n\n## Numbers ##\n\nFunctions for working with numbers and general looping\n\n### _step(numeric numberFrom, numeric numberTo, numeric stepNumber, function closure) : void ###\n\nIterates from a given number, up to a given number, using a step increment. Each number is passed through to the closure.\n\n* numberFrom - the number to start at\n* numberTo - the number to go to\n* stepNumber - the step to take between iterations\n* closure - the closure to call with the current count.\n\n### _times(numeric number, function closure) : void ###\n\nExecutes the closure this many times, starting from zero. The current index is passed to the closure each time\n\n* number - the number of times to execute the given closure\n* closure - the closure to execute.\n\n### _upto(numeric numberFrom, numeric numberTo, function closure) : void ###\n\nIterates from this number up to the given number, inclusive, incrementing by one each time. Each number is passed through to the closure.\n\n* numberFrom - the number to start at\n* numberTo - the number to go to\n* closure - the closure to call with the current count.\n\n## IO ##\n\nFunctions for working with input/output\n\n### _fileLineEach(any file, function handler) : void ###\n\nRead a file and call the closure on each line. Works on either a file ob or path\n\n* file - the file to load\n* handler - closure to take the input\n\n## Concurrency ##\n\n\nFunctions for working with threads and concurrent programmings\n\n*Please Note*: To use this concurrency library, there will need to be a mapping to /sesame, or /sesame will need to be in the root of your project, as there are components\nthat need to be instantiated to interact with the Java concurrency libraries.\n\n\n### _eachParallel(any data, function closure, [numeric numberOfThreads=5]) : void ###\n\nDo each iteration in it's own thread, and then join it all back again at the end.\n\n* data - the array/struct to perform a closure on\n* closure - the closure to pass through the elements from data to.\n* numberOfThreads - number of threads to use in the thread pool for processing. (Only needed if you aren't using _withPool())\n\n### _thread(function closure) : any ###\n\nRun the closure in a thread. Must be run inside a _withPool() block to set up the ExecutorService, and close it off at the end. For example:\u003cbr/\u003e _withPool( 10, function() {\u003cbr/\u003e _thread(function() { ... });\u003cbr/\u003e _thread(function() { ... });\u003cbr/\u003e }); \u003cbr/\u003e Return an instance of java.util.concurrent.Future to give you control over the closure, and/or retrieve the value returned from the closure.\n\n* closure - the closure to call asynchronously\n\n### _withPool(numeric numberOfThreads, function closure) : void ###\n\nThis function allows you to share the underlying ExecutorService with multiple concurrent methods.\u003cbr/\u003e For example, this shares a threadpool of 10 threads across multiple _eachParrallel calls:\u003cbr/\u003e _withPool( 10, function() {\u003cbr/\u003e _eachParrallel(array, function() { ... });\u003cbr/\u003e _eachParrallel(array, function() { ... });\u003cbr/\u003e _eachParrallel(array, function() { ... });\u003cbr/\u003e });\n\n* numberOfThreads - the number of threads to use in the thread pool for processing.\n* closure - the closure that contains the calls to other concurrent library functions.\n\n\nContributions\n-------------\nPlease feel free to fork this project and contribute.\n\nDo note that the readme is generated by the `generate.cfm` file, which creates the documentation from the function hint meta data.\nSo if your functions are properly commented, the documentation can be updated automatically.\n\nTherefore, if you want to contribute to the documentation, please do so in the relevent functions comments, so that it ends up in the README.md on regeneration.\n\nThanks!!!\n\n[1]: http://classiclit.about.com/library/bl-etexts/arabian/bl-arabian-alibaba.htm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkmandel%2Fsesame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkmandel%2Fsesame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkmandel%2Fsesame/lists"}