加载中
正在获取最新内容,请稍候...
正在获取最新内容,请稍候...
A modern, Lodash-style Go library leveraging Go 1.18+ Generics to provide common utility functions for collections (map, filter, contains, find, etc.), simplifying data manipulation.
lo is a Go library offering a comprehensive suite of utility functions for common data manipulation tasks on slices and other collections, heavily inspired by JavaScript's Lodash. It utilizes Go's generics feature (Go 1.18+) to provide type-safe operations.
Go's standard library often requires manual looping for common collection operations. This library provides concise, functional-style helpers using generics, reducing boilerplate and improving code readability compared to traditional imperative loops.
Apply a function to each element in a slice, returning a new slice with the results.
Create a new slice containing only elements that satisfy a testing function.
Check if a slice contains a specific value.
Find the first element in a slice that satisfies a testing function.
Remove duplicate values from a slice.
lo is useful in any Go project where you need to perform common operations on slices or arrays in a more declarative, less verbose way.
Transforming a slice of user structs into a slice of their names.
Write transformation logic concisely using `lo.Map` instead of a traditional for loop.
Filtering a slice of products to find only those currently in stock.
Easily select elements based on a condition using `lo.Filter`.
Checking if a specific permission string exists within a slice of user permissions.
Quickly determine if an element is present using `lo.Contains` or `lo.Some`.
You might be interested in these projects
Streamlit is an open-source Python library that makes it easy to create and share beautiful, custom web apps for machine learning and data science. In just a few lines of code, you can build powerful data apps and deploy them quickly.
Cognee is an open-source framework providing advanced memory capabilities for AI agents, enabling persistent knowledge, contextual understanding, and sophisticated reasoning.
A REST API wrapper for the whatsapp-web.js library, providing developers with an easy-to-integrate interface for automating interactions with the WhatsApp Web platform.