Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vandium-io/vandium-utils
Vandium Utility Functions
https://github.com/vandium-io/vandium-utils
Last synced: 3 days ago
JSON representation
Vandium Utility Functions
- Host: GitHub
- URL: https://github.com/vandium-io/vandium-utils
- Owner: vandium-io
- License: bsd-3-clause
- Created: 2016-05-30T16:50:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T19:14:54.000Z (about 2 years ago)
- Last Synced: 2024-12-09T00:37:35.971Z (about 1 month ago)
- Language: JavaScript
- Size: 178 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/vandium-io/vandium-utils.svg?branch=master)](https://travis-ci.org/vandium-io/vandium-utils)
[![npm version](https://badge.fury.io/js/vandium-utils.svg)](https://badge.fury.io/js/vandium-utils)# vandium-utils
Common utility functions used throughout the vandium projects.
## Installation
Install via npm.
npm install vandium-utils --save
## APIs
### `clone( obj )`
Clones an object. If the value is not an object or `null` then the existing value
is returned.### `dateToISOString( data, milliseconds = false )`
Creates an ISO string for a given date.
### `isArray( value )`
Determines if a values is an array. This implementation uses `Array.isArray()`.
### `isFunction( value )`
Determines if a value is a function.
### `isNullOrUndefined( value )`
Determines if a value is `null` or `undefined`.
### `isObject( value )`
Determines if a value is an `Object`.
### `isObjectEmpty( obj )`
Determines if the object is empty
## `isPromise( value )`
Determines if a value is a `Promise`
### `isString( value )`
Determines if a value is a string
### `parseBoolean( value )`
Parses a value to a boolean result. Values can be:
* "on" "yes", "true", "off", "no", "false" (case insensitive)
* `true`, `false`### `templateString( template, obj )`
Creates a string from a `template` and substitutes values from `obj`.
```js
const { templateString } = require( 'vandium-utils' );// str1 = "Hello Fred"
let str1 = templateString( 'Hello ${name}', { name: 'Fred' } );// str2 = "Hello Fred, I see you live in Toronto"
let str = templateString( 'Hello ${name}, I see you live in ${place.city}', {
name: 'Fred',
place: {city: 'Toronto'
}
});
```## Feedback
We'd love to get feedback on how to make this tool better. Feel free to contact us at `[email protected]`
## License
[BSD-3-Clause](https://en.wikipedia.org/wiki/BSD_licenses)