Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ngnjs/libdata
A library of data management functions.
https://github.com/ngnjs/libdata
browser coalesce data deno guid javascript nanoid ngn nodejs uuid web
Last synced: 3 months ago
JSON representation
A library of data management functions.
- Host: GitHub
- URL: https://github.com/ngnjs/libdata
- Owner: ngnjs
- License: mit
- Created: 2020-07-27T19:06:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-18T22:03:15.000Z (over 2 years ago)
- Last Synced: 2024-10-05T06:59:18.615Z (4 months ago)
- Topics: browser, coalesce, data, deno, guid, javascript, nanoid, ngn, nodejs, uuid, web
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
@ngnjs/libdata
![]()
While this JavaScript library is maintained primarily by and for NGN, it is a standalone "cross-runtime" library (will work without NGN).
The library consists of common functions for managing primitive and low level elements of JavaScript (objects, arrays, booleans, etc).
## Usage
See the [working examples](https://codepen.io/coreybutler/pen/OJNoPJX) on Codepen.
### Via CDN (Browser/Deno)
```javascript
import * as DATA from 'https://cdn.skypack.dev/@ngnjs/libdata'console.log(DATA)
```_Also available on JSDelivr._
### Node
`npm i @ngnjs/libdata -S`
```javascript
import * as DATA from '@ngnjs/libdata'
console.log(DATA)
```# Features
The NGN libdata library is a standalone library containing common data manipulation functions. This is significantly more primitive than the NGN Data module. This library contains methods for performing operations to a single data item, whereas the NGN Data module focuses on data modeling, bulk storage, and querying (amongst others).Constants
NameDescription
dedupeDeduplicate an array.
forceArrayForce a value into an array.
forceBooleanForce a value into a boolean.
forceNumberForce a value into a number.
forceStringForce a value into a string.
objectA collection of object management methods, includingall
,any
,exactly
,require
,extraneous
,missing
,mixin
,serialize
typeOfReturns the data type of a value. This is more specific than the native `typeof` operator.
nullIfReturnsnull
if the source value matches the provided value.
coalesceReturns the first non-null/defined value in a list of arguments.
coalescebSame ascoalesce
, but ignores blank/empty strings.
getPrimitiveReturns the primitive object/function of the specified type.
AdvancedSetThis is a Set, augmented with additonal methods:isSuperSet
,concat
,intersection
,except
,diff
, andequal
GUIDGenerate a globally unique identifier.
UUIDGenerate a universally unique identifier.
NANOIDA very fast/efficient unique ID generator.
checksumCalculate the checksum of an object.