{"id":19009148,"url":"https://github.com/gamtiq/adam","last_synced_at":"2025-10-07T15:46:22.439Z","repository":{"id":51506118,"uuid":"23767698","full_name":"gamtiq/adam","owner":"gamtiq","description":"Functions to create, process and test objects, maps, arrays, sets","archived":false,"fork":false,"pushed_at":"2021-05-11T14:25:45.000Z","size":2731,"stargazers_count":11,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T06:15:53.738Z","etag":null,"topics":["change","check","copy","create","field","filter","find","kind","map","object","process","property","reverse","select","size","split","test","transform","type","utility"],"latest_commit_sha":null,"homepage":"https://gamtiq.github.io/adam/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gamtiq.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-07T18:44:02.000Z","updated_at":"2024-12-20T21:55:30.000Z","dependencies_parsed_at":"2022-08-24T13:31:05.945Z","dependency_job_id":null,"html_url":"https://github.com/gamtiq/adam","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fadam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fadam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fadam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gamtiq%2Fadam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gamtiq","download_url":"https://codeload.github.com/gamtiq/adam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337908,"owners_count":21414102,"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":["change","check","copy","create","field","filter","find","kind","map","object","process","property","reverse","select","size","split","test","transform","type","utility"],"created_at":"2024-11-08T19:06:46.243Z","updated_at":"2025-10-07T15:46:17.422Z","avatar_url":"https://github.com/gamtiq.png","language":"JavaScript","readme":"# adam \u003ca name=\"start\"\u003e\u003c/a\u003e\n\nFunctions to create, process and test objects/maps/arrays/sets.\n\n[![NPM version](https://badge.fury.io/js/adam.png)](http://badge.fury.io/js/adam)\n[![Build Status](https://secure.travis-ci.org/gamtiq/adam.png?branch=master)](http://travis-ci.org/gamtiq/adam)\n[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)\n\n* [Usage](#usage)\n* [Examples](#examples)\n* [API](#api)\n* [Related projects](#related)\n\n## Installation\n\n### Node\n\n    npm install adam\n\n### [Bower](https://bower.io)\n\n    bower install adam\n\n### AMD, \u0026lt;script\u0026gt;\n\nUse `dist/adam.js` or `dist/adam.min.js` (minified version).\n\n## Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n### Node\n\n```js\nvar adam = require(\"adam\");\n```\n\n### AMD\n\n```js\ndefine([\"path/to/dist/adam.js\"], function(adam) {\n    ...\n});\n```\n\n### Bower, \u0026lt;script\u0026gt;\n\n```html\n\n\u003c!-- Use bower_components/adam/dist/adam.js if the library was installed by Bower --\u003e\n\n\u003cscript type=\"text/javascript\" src=\"path/to/dist/adam.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003e\n    // adam is available via adam field of window object\n    \n    ...\n\u003c/script\u003e\n```\n\n### Examples \u003ca name=\"examples\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n```js\nfunction inc(data) {\n    return ++data.value;\n}\n\nvar obj = {a: 1, b: 2, c: 3, d: 4, e: 5},\n    s1 = Symbol(\"s1\"),\n    s2 = Symbol(\"s2\"),\n    proto = {a: 1},\n    obj2 = Object.create(proto);\n\nproto[s1] = \"s1\";\nobj2.b = 2;\nobj2[s2] = null;\nobj2.c = \"str\";\nobj2.d = 0;\n\nadam.getPropertySymbols(obj2);   // [s2, s1]\n\nadam.getClass([8]);   // \"Array\"\nadam.getType(null);   // \"null\"\nadam.isKindOf(17, \"integer\");   // true\nadam.isKindOf(NaN, \"!number\");   // true\nadam.isKindOf(\".321e+2\", \"numeric\");   // true\n\nadam.checkField(obj, \"c\", [\"positive\", \"odd\"]);   // true\nadam.checkField(obj, \"b\", [\"real\", /^7/], {filterConnect: \"or\"});   // false\n\nadam.checkValue(-15, [\"negative\", /5/, {inside: [2, -7, -15, 12, 9]}]);   // true\nadam.checkValue(\"73\", [/^\\d+$/, {inside: {a: 1, b: \"43\", c: null}}]);   // false\nadam.checkValue(\"73\", [/^\\d+$/, {inside: {a: 1, b: \"43\", c: null}}], {filterConnect: \"or\"});   // true\n\nadam.getFreeField({a5: 5, a2: 2, a7: 7, a3: 3}, {prefix: \"a\", startNum: 2});   // \"a4\"\nadam.getFreeField(new Map([[\"a\", 3], [\"key\", 9], [\"key-1\", true]]), {prefix: \"key-\"});   // \"key-0\"\nadam.getFreeField(new Map([[\"a\", 3], [\"key\", 9], [\"key-1\", true]]), {prefix: \"key-\", startNum: 1});   // \"key-2\"\n\nadam.getSize(obj);   // 5\nadam.getSize(obj, {filter: \"even\"});   // 2\nadam.getSize(obj2, {filter: [\"string\", \"null\"], filterConnect: \"or\"});   // 3\nadam.isSizeMore(obj, 5);   // false\nadam.isSizeMore(obj2, 1, {filter: \"string\"});   // true\nadam.isEmpty({});   // true\n\nadam.getFields(obj);   // [\"a\", \"b\", \"c\", \"d\", \"e\"]\nadam.getFields(obj, {filter: function(value) {return value \u003c 4;}});   // [\"a\", \"b\", \"c\"]\nadam.getFields(obj, {filter: {field: /^[d-h]/}});   // [\"d\", \"e\"]\nadam.getFields(obj2);   // [\"b\", \"c\", \"d\", s2, \"a\", s1]\nadam.getFields(obj2, {filter: [\"string\", \"false\"], filterConnect: \"or\"});   // [\"c\", \"d\", s2, s1]\nadam.getFields(obj2, {filter: \"number\", limit: 2});   // [\"b\", \"d\"]\nadam.getFields(obj2, {filter: {field: \"symbol\"}})   // [s2, s1]\nadam.getFields(obj2, {filter: \"number\", limit: 7, pairs: true});   // [{key: \"b\", value: 2}, {key: \"d\", value: 0}, {key: \"a\", value: 1}]\nadam.getFields(obj2, {filter: \"number\", pairs: \"list\"});   // [[\"b\", 2], [\"d\", 0], [\"a\", 1]]\nadam.getFields(new Map([[obj, 1], [obj2, false], [\"c\", 5]]), {filter: {field: \"object\"}});   // [obj, obj2]\nadam.getFields(new Map([[\"a\", 1], [\"b\", false], [\"c\", 5]]), {filter: \"number\", pairs: \"obj\"});   // [{key: \"a\", value: 1}, {key: \"c\", value: 5}]\n\nadam.getValues(obj);   // [1, 2, 3, 4, 5]\nadam.getValues(obj, {filter: {field: /a|c/}});   // [1, 3]\nadam.getValues(new Map([[obj, \"a\"], [obj2, 2], [\"obj3\", 3]]), {filter: {field: \"object\"}});   // [\"a\", 2]\nadam.getValueKey(obj, 3);   // \"c\"\n\nadam.fromArray([{id: \"a\", value: 11}, {id: \"b\", value: 7}, {id: \"c\", value: 10}], \"id\");   // {a: {id: \"a\", value: 11}, b: {id: \"b\", value: 7}, c: {id: \"c\", value: 10}}\n\nadam.select([\"negative\", \"odd\"], [null, 4, NaN, 7, false, -2, \"\", 0, -5, 3, null, -9]);   // -5\nadam.select([\"negative\", \"odd\"], [null, 4, NaN, 8, false, 2, \"\", 0, 30, 4, false], {filterConnect: \"or\"});   // false\nadam.select([\"negative\", \"odd\"], [null, 4, NaN, 8, false, 2, \"\", 0, 30, 4, false], {filterConnect: \"or\", defaultValue: -3});   // -3\nadam.select([{field: /[c-g]/}, \"odd\"], {a: [3, 5, 2], b: 1, c: 0, d: \"-7\", e: 4, f: -2, g: -1, h: null, i: -7, j: true, k: -5});   // -1\nadam.select([\"negative\", \"even\"], new Set([null, 4, NaN, 8, -1, false, -2, \"\", 0, \"beta\", -30, 4, true]));   // -2\n\nadam.split(obj, [\"a\", \"d\"]);   // [{a: 1, d: 4}, {b: 2, c: 3, e: 5}]\nadam.split(obj, null, {filter: \"odd\"});   // [{a: 1, c: 3, e: 5}, {b: 2, d: 4}]\nadam.split(obj, null, {filter: [\"even\", /3/], filterConnect: \"or\"});   // [{b: 2, c: 3, d: 4}, {a: 1, e: 5}]\nadam.split(new Map([[\"a\", false], [obj, 2], [false, obj2], [true, null]]), null, {filter: \"true\"});   // [Map{obj -\u003e 2, false -\u003e obj2}, Map{\"a\" -\u003e false, true -\u003e null}]\n\nadam.remove({a: 1, b: \"2\", c: 3}, \"string\");   // {a: 1, c: 3}\nadam.remove([1, 2, 3, 4, 5], \"even\");   // [1, 3, 5]\nadam.remove(new Set([1, 2, 3, 4, 5]), \"odd\");   // Set[2, 4]\n\nadam.empty({x: -1, y: 9});   // {}\n\nadam.reverse({a: \"x\", b: \"files\"});   // {x: \"a\", files: \"b\"}\nadam.reverse(\"eval\");   // \"lave\"\nadam.reverse(new Map([[obj, 1], [obj2, 2]]));   // Map{1 -\u003e obj, 2 -\u003e obj2}\n\nadam.transform(\"7.381\", \"integer\");   // 7\n\nadam.copy(obj, {b: \"no\", z: \"a\"});   // {a: 1, b: 2, c: 3, d: 4, e: 5, z: \"a\"}\nadam.copy(obj, {b: \"no\", z: \"a\"}, {filter: \"odd\"});   // {a: 1, b: \"no\", c: 3, e: 5, z: \"a\"}\nadam.copy(obj, {b: \"no\", z: \"a\"}, {filter: \"even\", transform: inc});   // {b: 3, d: 5, z: \"a\"}\n\nadam.change({a: 1, b: 2, c: 3}, \"reverse\");   // {a: -1, b: -2, c: -3}\nadam.change({a: 10, b: 28, c: -3, d: null, e: \"zero = 0\"}, \"empty\", {filter: /0/});   // {a: 0, b: 28, c: -3, d: null, e: \"\"}\nadam.change([1, 2, 3, 4, 5], \"reverse\", {filter: \"even\"});   // [1, -2, 3, -4, 5]\n\nadam.map(obj, \"reverse\", {filter: \"odd\"});   // {a: -1, c: -3, e: -5}\nadam.map([\"1\", \"2\", \"3\"], \"number\");   // [1, 2, 3]\n```\n\nSee `test/adam.js` for additional examples.\n\n## API \u003ca name=\"api\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\nSee [`docs`](https://gamtiq.github.io/adam/module-adam.html).\n\n## Related projects \u003ca name=\"related\"\u003e\u003c/a\u003e [\u0026#x2191;](#start)\n\n* [eva](https://github.com/gamtiq/eva)\n* [mixing](https://github.com/gamtiq/mixing)\n* [teo](https://github.com/gamtiq/teo)\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style.\nAdd unit tests for any new or changed functionality.\nLint and test your code using [Grunt](http://gruntjs.com/).\n\n## License\nCopyright (c) 2014-2020 Denis Sikuler  \nLicensed under the MIT license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamtiq%2Fadam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgamtiq%2Fadam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgamtiq%2Fadam/lists"}