{"id":13670128,"url":"https://github.com/ginkgoch/godash","last_synced_at":"2025-04-27T09:31:46.133Z","repository":{"id":43941726,"uuid":"225820143","full_name":"ginkgoch/godash","owner":"ginkgoch","description":"This is lodash in golang version. A modern Golang utility library delivering modularity, performance \u0026 extras.","archived":false,"fork":false,"pushed_at":"2024-06-25T12:28:35.000Z","size":257,"stargazers_count":68,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2024-08-03T09:07:04.060Z","etag":null,"topics":["go-lodash"],"latest_commit_sha":null,"homepage":"https://ginkgoch.com","language":"Go","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/ginkgoch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://paypal.me/ginkgoch101"]}},"created_at":"2019-12-04T08:45:34.000Z","updated_at":"2024-06-25T12:27:45.000Z","dependencies_parsed_at":"2024-01-14T16:14:36.461Z","dependency_job_id":null,"html_url":"https://github.com/ginkgoch/godash","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginkgoch%2Fgodash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginkgoch%2Fgodash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginkgoch%2Fgodash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginkgoch%2Fgodash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ginkgoch","download_url":"https://codeload.github.com/ginkgoch/godash/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224067017,"owners_count":17250098,"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":["go-lodash"],"created_at":"2024-08-02T09:00:33.309Z","updated_at":"2024-11-11T07:31:10.914Z","avatar_url":"https://github.com/ginkgoch.png","language":"Go","funding_links":["https://paypal.me/ginkgoch101"],"categories":["Go"],"sub_categories":[],"readme":"[![PkgGoDev](https://pkg.go.dev/badge/github.com/ginkgoch/godash)](https://pkg.go.dev/github.com/ginkgoch/godash/pkg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ginkgoch/godash)](https://goreportcard.com/report/github.com/ginkgoch/godash)\n\n[![forthebadge](https://forthebadge.com/images/badges/gluten-free.svg)](https://forthebadge.com)\n\n# Lodash in Golang Version V2\nThis is lodash in golang version v2. A modern Golang utility library delivering modularity, performance \u0026 extras. Compare to [v1](./README_V1.md), all APIs are refactored with generic types support. [API Reference](https://pkg.go.dev/github.com/ginkgoch/godash/v2).\n\n\n## Install \u0026 Import\n```bash\ngo get -u \"github.com/ginkgoch/godash/v2\"\n```\n\n```go\nimport \"github.com/ginkgoch/godash/v2\"\n```\n\n\n## Usage\n\n#### func  CamelCase\n\n```go\nfunc CamelCase(str string) (string, error)\n```\nConverts string to camel case. First char is lower case.\n\n#### func  CamelCaseWithInit\n\n```go\nfunc CamelCaseWithInit(str string, upperCase InitCamelCase) (string, error)\n```\nConverts string to camel case. First char is lower case by default.\n\n#### func  Capitalize\n\n```go\nfunc Capitalize(str string) string\n```\nConverts the first character of string to upper case and the remaining to lower\ncase.\n\n#### func  Chunk\n\n```go\nfunc Chunk[E any](items []E, size int) [][]E\n```\nCreates an array of elements split into groups the length of size. If array\ncan't be split evenly, the final chunk will be the remaining elements.\n\n#### func  Compact\n\n```go\nfunc Compact[E any](items []E) []E\n```\nCreates an array with all falsy values removed. The values false, 0, \"\", nil are\nfalsy.\n\n#### func  Concat\n\n```go\nfunc Concat[E any](items []E, newItems []E) []E\n```\nCreates a new array concatenating array with any additional arrays and/or\nvalues.\n\n#### func  ConcatSlices\n\n```go\nfunc ConcatSlices[E any](slices ...[]E) []E\n```\nCreates a new array concatenating array with any additional DashSlices.\n\n#### func  Difference\n\n```go\nfunc Difference[E any](items []E, itemsToCompare []E) []E\n```\nCreates an array of array values not included in the other given arrays using\nSameValueZero for equality comparisons. The order and references of result\nvalues are determined by the first array.\n\n#### func  DifferenceBy\n\n```go\nfunc DifferenceBy[E any](items []E, itemsToCompare []E, iteratee Iteratee[E, E]) []E\n```\nThis method is like _.difference except that it accepts iteratee which is\ninvoked for each element of array and values to generate the criterion by which\nthey're compared. The order and references of result values are determined by\nthe first array. The iteratee is invoked with one argument: (value).\n\n#### func  DifferenceWith\n\n```go\nfunc DifferenceWith[E any](items []E, itemsToCompare []E,\n\tcomparison Comparison[E]) []E\n```\nThis method is like _.difference except that it accepts comparator which is\ninvoked to compare elements of array to values. The order and references of\nresult values are determined by the first array. The comparator is invoked with\ntwo arguments: (arrVal, othVal).\n\n#### func  Drop\n\n```go\nfunc Drop[E any](items []E, count int) []E\n```\nCreates a slice of array with n elements dropped from the beginning.\n\n#### func  DropRight\n\n```go\nfunc DropRight[E any](items []E, count int) []E\n```\nCreates a slice of array with n elements dropped from the end.\n\n#### func  DropWhile\n\n```go\nfunc DropWhile[E any](items []E, predicate Predicate[E]) []E\n```\nCreates a slice of array excluding elements dropped from the beginning. Elements\nare dropped until predicate returns falsy. The predicate is invoked with two\narguments: (value, index).\n\n#### func  EndsWith\n\n```go\nfunc EndsWith(str string, target string) bool\n```\nChecks if string ends with the given target string.\n\n#### func  EndsWithFrom\n\n```go\nfunc EndsWithFrom(str string, target string, position int) bool\n```\nChecks if string ends with the given target string with the position to search\nup to.\n\n#### func  Escape\n\n```go\nfunc Escape(str string) string\n```\nConverts the characters \"\u0026\", \"\u003c\", \"\u003e\", '\"', and \"'\" in string to their\ncorresponding HTML entities.\n\n#### func  EscapeRegExp\n\n```go\nfunc EscapeRegExp(str string) string\n```\nEscapes the RegExp special characters \"^\", \"$\", \"\", \".\", \"*\", \"+\", \"?\", \"(\",\n\")\", \"[\", \"]\", \"{\", \"}\", and \"|\" in string.\n\n#### func  Fill\n\n```go\nfunc Fill[E any](items []E, fillValue E)\n```\nFills elements of array with value.\n\n#### func  FillInRange\n\n```go\nfunc FillInRange[E any](items []E, value E, start int, end int)\n```\nFills elements of array with value from start up to, but not including end.\n\n#### func  Filter\n\n```go\nfunc Filter[E any](slice []E, predicate Predicate[E]) []E\n```\n\n#### func  FindIndex\n\n```go\nfunc FindIndex[E any](items []E, predicate Predicate[E]) (int, bool)\n```\nThis method is like Find except that it returns the index of the first element\npredicate returns truthy for instead of the element itself.\n\n#### func  FindIndexWith\n\n```go\nfunc FindIndexWith[E any](items []E, element E, comparison Comparison[E]) (index int, ok bool)\n```\nSame to IndexOf. The difference is that, this method provides a comparison\nfunction to compare programmatically.\n\n#### func  FindLastIndex\n\n```go\nfunc FindLastIndex[E any](items []E, predicate Predicate[E]) (int, bool)\n```\nThis method is like Find except that it returns the index of the first element\npredicate returns truthy for instead of the element itself.\n\n#### func  FindLastIndexWith\n\n```go\nfunc FindLastIndexWith[E any](items []E, element E, comparison Comparison[E]) (int, bool)\n```\nThis method is like FindIndex except that it iterates over elements of\ncollection from right to left.\n\n#### func  First\n\n```go\nfunc First[E any](items []E) *E\n```\nGets the first element of array.\n\n#### func  FromPairs\n\n```go\nfunc FromPairs[K comparable, V any](pairs []KeyValuePair[K, V]) map[K]V\n```\nThis method returns an object composed from key-value pairs.\n\n#### func  FromPairsAny\n\n```go\nfunc FromPairsAny(pairs [][]any) map[any]any\n```\nThis method returns an object composed from key-value pairs.\n\n#### func  Head\n\n```go\nfunc Head[E any](items []E) *E\n```\nGets the first element of slice.\n\n#### func  IndexOf\n\n```go\nfunc IndexOf[E any](items []E, element E) (int, bool)\n```\nThis method is like _.find except that it returns the index of the first element\npredicate returns truthy for instead of the element itself.\n\n#### func  Initial\n\n```go\nfunc Initial[E any](slice []E) []E\n```\nGets all but the last element of array.\n\n#### func  Intersection\n\n```go\nfunc Intersection[E any](items1 []E, items2 []E) (intersectedItems []E)\n```\nCreates an array of unique values that are included in all given arrays using\nSameValueZero for equality comparisons. The order and references of result\nvalues are determined by the first array.\n\n#### func  IntersectionBy\n\n```go\nfunc IntersectionBy[E, T any](items1 []E, items2 []E, iteratee Iteratee[E, T]) (intersectedItems []E)\n```\nThis method is like Intersection except that it accepts iteratee which is\ninvoked for each element of each arrays to generate the criterion by which\nthey're compared. The order and references of result values are determined by\nthe first array. The iteratee is invoked with one argument: (value).\n\n#### func  IntersectionWith\n\n```go\nfunc IntersectionWith[E any](items1 []E, items2 []E, comparison Comparison[E]) (intersectedItems []E)\n```\nThis method is like _.intersection except that it accepts comparator which is\ninvoked to compare elements of arrays. The order and references of result values\nare determined by the first array. The comparator is invoked with two arguments:\n(arrVal, othVal).\n\n#### func  Join\n\n```go\nfunc Join[E any](items []E, separator string) string\n```\nConverts all elements in array into a string separated by separator.\n\n#### func  Last\n\n```go\nfunc Last[E any](items []E) (exists bool, lastItem E)\n```\nGets the last element of array.\n\n#### func  LastIndexOf\n\n```go\nfunc LastIndexOf[E any](items []E, element E) (int, bool)\n```\nThis method is like IndexOf except that it iterates over elements of array from\nright to left.\n\n#### func  LowerFirst\n\n```go\nfunc LowerFirst(str string) string\n```\n\n#### func  Map\n\n```go\nfunc Map[E, V any](slice []E, iteratee func(E) V) []V\n```\n\n#### func  Nth\n\n```go\nfunc Nth[E any](items []E, n int) (exists bool, item E)\n```\nGets the element at index n of array. If n is negative, the nth element from the\nend is returned.\n\n#### func  Pad\n\n```go\nfunc Pad(str string, length int) string\n```\nPads string on the left and right sides if it's shorter than length. Padding\ncharacters are truncated if they can't be evenly divided by length.\n\n#### func  PadLeft\n\n```go\nfunc PadLeft(str string, length int) string\n```\nPads string on the left sides if it's shorter than length.\n\n#### func  PadLeftWith\n\n```go\nfunc PadLeftWith(str string, length int, padChars string) string\n```\nPads string on the left sides if it's shorter than length.\n\n#### func  PadRight\n\n```go\nfunc PadRight(str string, length int) string\n```\nPads string on the right sides if it's shorter than length.\n\n#### func  PadRightWith\n\n```go\nfunc PadRightWith(str string, length int, padChars string) string\n```\nPads string on the right sides if it's shorter than length.\n\n#### func  PadWith\n\n```go\nfunc PadWith(str string, length int, padChars string) string\n```\nPads string on the left and right sides if it's shorter than length. Padding\ncharacters are truncated if they can't be evenly divided by length.\n\n#### func  Pull\n\n```go\nfunc Pull[E comparable](items *[]E, values ...E) []E\n```\nRemoves all given values from array using SameValueZero for equality\ncomparisons.\n\n#### func  PullAll\n\n```go\nfunc PullAll[E comparable](items *[]E, values []E) []E\n```\nThis method is like Pull except that it accepts an array of values to remove.\n\n#### func  PullAllWith\n\n```go\nfunc PullAllWith[E any](items *[]E, values []E, comparison Comparison[E]) []E\n```\nThis method is like PullAll except that it accepts comparator which is invoked\nto compare elements of array to values. The comparator is invoked with two\narguments: (arrVal, othVal).\n\n#### func  PullAt\n\n```go\nfunc PullAt[E any](items *[]E, indices ...int) (pulled []E)\n```\nRemoves elements from array corresponding to indexes and returns an array of\nremoved elements.\n\n#### func  Remove\n\n```go\nfunc Remove[E any](items *[]E, predicate Predicate[E]) (removed []E)\n```\nRemoves all elements from array that predicate returns truthy for and returns an\narray of the removed elements. The predicate is invoked with two arguments:\n(value, index).\n\n#### func  Repeat\n\n```go\nfunc Repeat(str string, count int) string\n```\nRepeats the given string n times.\n\n#### func  Replace\n\n```go\nfunc Replace(source string, target string, newStr string) string\n```\nReplaces string with replacement.\n\n#### func  ReplaceRegx\n\n```go\nfunc ReplaceRegx(source string, pattern string, newStr string) (string, error)\n```\nReplaces matches for pattern in string with replacement.\n\n#### func  Reverse\n\n```go\nfunc Reverse[E any](items []E) []E\n```\nReverses array so that the first element becomes the last, the second element\nbecomes the second to last, and so on.\n\n#### func  Slice\n\n```go\nfunc Slice[E any](items []E, start int, end int) []E\n```\nCreates a slice of array from start up to, but not including, end.\n\n#### func  Split\n\n```go\nfunc Split(str string, separator string) []string\n```\nSplits string by separator.\n\n#### func  SplitWithCountLimit\n\n```go\nfunc SplitWithCountLimit(str string, separator string, n int) []string\n```\nSplits string by separator and return limit count items.\n\n#### func  StartsWith\n\n```go\nfunc StartsWith(str string, target string) bool\n```\nChecks if string starts with the given target string.\n\n#### func  StartsWithFrom\n\n```go\nfunc StartsWithFrom(str string, target string, position int) bool\n```\nChecks if string starts with the given target string from a specific position.\n\n#### func  Tail\n\n```go\nfunc Tail[E any](items []E) (result []E)\n```\nGets all but the first element of array.\n\n#### func  Take\n\n```go\nfunc Take[E any](items []E, n int) (results []E)\n```\nCreates a slice of array with n elements taken from the beginning.\n\n#### func  TakeRight\n\n```go\nfunc TakeRight[E any](items []E, n int) []E\n```\nCreates a slice of array with n elements taken from the end.\n\n#### func  TakeRightWhile\n\n```go\nfunc TakeRightWhile[E any](items []E, predicate Predicate[E]) []E\n```\nCreates a slice of array with elements taken from the end. Elements are taken\nuntil predicate returns falsy. The predicate is invoked with one argument:\n(value).\n\n#### func  TakeWhile\n\n```go\nfunc TakeWhile[E any](items []E, predicate Predicate[E]) []E\n```\nCreates a slice of array with elements taken from the beginning. Elements are\ntaken until predicate returns falsy. The predicate is invoked with one argument:\n(value).\n\n#### func  Ternary\n\n```go\nfunc Ternary(satisfy bool, truthyValue interface{}, falsyValue interface{}) interface{}\n```\n\n#### func  ToLower\n\n```go\nfunc ToLower(str string) string\n```\nConverts string, as a whole, to lower case.\n\n#### func  ToUpper\n\n```go\nfunc ToUpper(str string) string\n```\nConverts string, as a whole, to upper case\n\n#### func  Trim\n\n```go\nfunc Trim(str string) string\n```\nRemoves leading and trailing whitespace from string.\n\n#### func  TrimEnd\n\n```go\nfunc TrimEnd(str string) string\n```\nRemoves tailing whitespace from string.\n\n#### func  TrimEndWith\n\n```go\nfunc TrimEndWith(str string, trimChars string) string\n```\nRemoves tailing whitespace or specified characters from string.\n\n#### func  TrimStart\n\n```go\nfunc TrimStart(str string) string\n```\nRemoves leading whitespace from string.\n\n#### func  TrimStartWith\n\n```go\nfunc TrimStartWith(str string, trimChars string) string\n```\nRemoves leading whitespace or specified characters from string.\n\n#### func  TrimWith\n\n```go\nfunc TrimWith(str string, trimChars string) string\n```\nRemoves leading and trailing whitespace or specified characters from string.\n\n#### func  Unescape\n\n```go\nfunc Unescape(str string) string\n```\nThe inverse of Escape func; this method converts the HTML entities \u0026amp;, \u0026lt;,\n\u0026gt;, \u0026quot;, and \u0026#39; in string to their corresponding characters.\n\n#### func  Union\n\n```go\nfunc Union[E comparable](slices ...[]E) []E\n```\nCreates an array of unique values, in order, from all given arrays using\nSameValueZero for equality comparisons.\n\n#### func  UnionBy\n\n```go\nfunc UnionBy[I any, O comparable](iteratee Iteratee[I, O], slices ...[]I) []I\n```\nThis method is like Uniq except that it accepts iteratee which is invoked for\neach element in array to generate the criterion by which uniqueness is computed.\nThe order of result values is determined by the order they occur in the array.\nThe iteratee is invoked with one argument: (value).\n\n#### func  UnionWith\n\n```go\nfunc UnionWith[E any](comparison Comparison[E], slices ...[]E) []E\n```\nThis method is like Uniq except that it accepts comparator which is invoked to\ncompare elements of array. The order of result values is determined by the order\nthey occur in the array. The comparator is invoked with two arguments: (arrVal,\nothVal).\n\n#### func  Uniq\n\n```go\nfunc Uniq[E comparable](items []E) []E\n```\nCreates a duplicate-free version of an array, using SameValueZero for equality\ncomparisons, in which only the first occurrence of each element is kept. The\norder of result values is determined by the order they occur in the array.\n\n#### func  UniqBy\n\n```go\nfunc UniqBy[I any, O comparable](items []I, iteratee Iteratee[I, O]) []I\n```\nThis method is like Union except that it accepts iteratee which is invoked for\neach element of each arrays to generate the criterion by which uniqueness is\ncomputed. Result values are chosen from the first array in which the value\noccurs. The iteratee is invoked with one argument: (value).\n\n#### func  UniqWith\n\n```go\nfunc UniqWith[E any](items []E, comparison Comparison[E]) []E\n```\nThis method is like Uniq except that it accepts comparator which is invoked to\ncompare elements of array. The order of result values is determined by the order\nthey occur in the array. The comparator is invoked with two arguments: (arrVal,\nothVal).\n\n#### func  UpperFirst\n\n```go\nfunc UpperFirst(str string) string\n```\nConverts the first character of string to upper case.\n\n#### func  Without\n\n```go\nfunc Without[E comparable](items []E, values ...E) []E\n```\nCreates an array excluding all given values using SameValueZero for equality\ncomparisons.\n\n#### func  Xor\n\n```go\nfunc Xor[E comparable](items ...[]E) []E\n```\nCreates an array of unique values that is the symmetric difference of the given\narrays. The order of result values is determined by the order they occur in the\narrays.\n\n#### func  Zip\n\n```go\nfunc Zip[E any](slices ...[]E) [][]E\n```\nCreates an array of grouped elements, the first of which contains the first\nelements of the given arrays, the second of which contains the second elements\nof the given arrays, and so on.\n\n#### func  ZipWith\n\n```go\nfunc ZipWith[E any, V any](iteratee Iteratee[[]E, V], slices ...[]E) []V\n```\nThis method is like Zip except that it accepts iteratee to specify how grouped\nvalues should be combined. The iteratee is invoked with the elements of each\ngroup: (...group).\n\n#### type Comparison\n\n```go\ntype Comparison[E any] func(E, E) bool\n```\n\n\n#### type InitCamelCase\n\n```go\ntype InitCamelCase bool\n```\n\n\n#### type Iteratee\n\n```go\ntype Iteratee[E any, V any] func(E) V\n```\n\n\n#### type KeyValuePair\n\n```go\ntype KeyValuePair[K comparable, V any] struct {\n}\n```\n\n\n#### type Number\n\n```go\ntype Number interface {\n\tint | int16 | int32 | int64 | int8 | float32 | float64 | uint | uint16 | uint32 | uint64 | uint8\n}\n```\n\n\n#### type Predicate\n\n```go\ntype Predicate[E any] func(E) bool\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fginkgoch%2Fgodash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fginkgoch%2Fgodash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fginkgoch%2Fgodash/lists"}