Socket
Socket
Sign inDemoInstall

vigour-util

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vigour-util - npm Package Compare versions

Comparing version 1.3.3 to 1.4.0

is/obj.js

5

define.js
'use strict'
/**
* @id define
* @function define
* helper for Object.defineProperty on base classes
* always sets configurable to true
* Defines new (or modifies existing) properties (using [`Object.defineProperty`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty)) on an object passed to `define` as `this`, setting `configurable: true` by default
* @param {object} props - Properties to set
*/

@@ -7,0 +8,0 @@ var define = Object.defineProperty

'use strict'
module.exports = function getAllPropertyDescriptors (obj) {
/**
* @id descriptors
* @function descriptors
* Like [`Object.getOwnPropertyDescriptor`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor), but goes along the prototype chain and gets the descriptors for all properties.
* @param {object} props - the properties to get the descriptors for
*/
module.exports = function getAllPropertyDescriptors (props) {
var definitions = {}
var arr
// loop trough protos
var proto = obj
var proto = props
while (proto) {

@@ -9,0 +15,0 @@ arr = Object.getOwnPropertyNames(proto)

2

flatten.js

@@ -5,3 +5,5 @@ 'use strict'

/**
* @id flatten
* @function Take a nested Javascript object and flatten it
* Transforms a deep object into an object of single depth where keys are a path and values are leafs of the original object.
* @param {object} subject - Object that needs to be flattened

@@ -8,0 +10,0 @@ * @param {string} [seperator] - Optional seperator sign

'use strict'
/**
* @id get.reference
* @function getReference
* Get's the referenced object
* Get's the referenced object (*Specific to `vigour-base`*)
* @param {object} obj - the reference we want to follow
* @returns {object} The referenced object or undefined
* @returns {object} ref - The referenced object or `undefined`
*/

@@ -8,0 +9,0 @@ module.exports = function (obj) {

'use strict'
// murmer hash implementation
/**
* @id hash
* @function hash
* Hashing utility optimized for speed, not collision avoidance. Produces alpha-numeric hashes between 5 and 7 characters long inclusively.
* @param {string} key - the string to hash
* @param {number} seed - a seed for hashing
* @returns {string} hashOfKey - The created hash
*/
exports = module.exports = function (key, seed) {

@@ -5,0 +12,0 @@ var remainder, bytes, h1, h1b, c1, c2, k1, i

@@ -5,6 +5,7 @@ 'use strict'

/**
* @id isEmail
* @function isEmail
* Checks whether provided parameter looks like a valid e-mail address
* @param {string} val - the string to check
* @returns {boolean} `true` if `val` is a valid e-mail address, `false` otherwise
* @returns {boolean} valid - `true` if `val` is a valid e-mail address, `false` otherwise
*/

@@ -11,0 +12,0 @@ module.exports = function (val) {

'use strict'
/**
* @id isEmpty
* @function isEmpty
* Checks if a `Base` object is empty
* Checks if a `Base` object is empty (*Specific to `vigour-base`*)
* @param {object} obj - the object to check for emptiness
* @returns {boolean} `true` if `obj` is considered empty, `false` otherwise
* @returns {boolean} emptyBase - `true` if `obj` is considered empty, `false` otherwise
*/

@@ -8,0 +9,0 @@ module.exports = function isEmpty (obj) {

@@ -5,7 +5,8 @@ 'use strict'

/**
* @id isHash
* @function isHash
* Checks is a string looks like a hash generated by the [`hash`](#hash) utility
* @param {string} val - the string to check
* @returns {boolean} `true` if `val` looks like a hash, `false` otherwise
* @returns {boolean} looksLikeHash - `true` if `val` looks like a hash, `false` otherwise
*/
module.exports = (val) => !isNumber(val) && isHash.test(val)
'use strict'
/**
* `true` if in node context, `false` otherwise
* @id isNode
* @function isNode
* @returns runningInNode - `true` if in node context, `false` otherwise
*/
module.exports = typeof window === 'undefined'
// || window.toString() === '[object global]'
'use strict'
var isNumber = require('lodash.isfinite')
/**
* @id isNumber
* @function isNumber
* This just calls `lodash.isfinite` internally. See [those docs](https://lodash.com/docs#isFinite)
* @param {any} value - The value to check
* @returns {boolean} finiteNumber - Returns `true` if *value* is a finite number, `false` otherwise
*/
module.exports = isNumber

@@ -5,6 +5,7 @@ 'use strict'

/**
* @id isNumberLike
* @function isNumberLike
* Checks whether provided parameter looks like a number
* @param {any} val - the value to check
* @returns {boolean} `true` if `val` looks like a number, `false` otherwise
* @returns {boolean} looksLikeNumber - `true` if `val` looks like a number, `false` otherwise
*/

@@ -11,0 +12,0 @@ module.exports = function isNumberLike (val) {

'use strict'
var isStream = require('./stream')
var isBuffer = require('is-buffer')
var isStream = require('is-stream')
/**
* @id isPlainObj
* @function isPlainObj
* Checks whether an object is a plain object
* Checks whether an object is a plain object (excludes streams, buffers, base and null) (*Compatible with `vigour-base`*)
* @param {object} obj - the object to check
* @returns {boolean} `true` if `obj` is a plain object, `false` otherwise
* @returns {boolean} plain - `true` if *obj* is a plain object, `false` otherwise
*/
module.exports = function isPlainObj (obj) {
return (
typeof obj === 'object' &&
obj !== null &&
obj && typeof obj === 'object' &&
!obj._base_version &&
!(obj instanceof Buffer) &&
!(isStream(obj))
!isBuffer(obj) &&
!isStream(obj)
)
}
'use strict'
/**
* @id isRemoved
* @function isRemoved
* Checks if a property has been removed
* Checks if a property has been removed (*Specific to `vigour-base`*)
* @param {Base} base - the property to check
* @returns {boolean} `true` if `base` has been removed, `false` otherwise
* @returns {boolean} removed - `true` if *base* property has been removed, `false` otherwise
*/

@@ -8,0 +9,0 @@ module.exports = function isRemoved (base) {

'use strict'
var stream = require('stream')
var Writable = stream.Writable
var Duplex = stream.Duplex
var Readable = stream.Readable
var isStream = require('is-stream')
/**
* @id isStream
* @function isStream
* Checks whether provided argument is a stream
* @param {object} val - the object to check
* @returns {boolean} `true` if `val` is a stream, `false` otherwise
* @returns {boolean} stream - `true` if `val` is a stream, `false` otherwise
*/
module.exports = exports = function (val) {
return val && typeof val === 'object' && (
exports.writable(val) ||
exports.readable(val)
)
}
module.exports = isStream
/**
* @id isStream.readable
* @function isStream.readable
* Checks whether provided argument is a readable stream
* @param {object} val - the object to check
* @returns {boolean} `true` if `val` is a readable stream, `false` otherwise
* @returns {boolean} readable - `true` if `val` is a readable stream, `false` otherwise
*/
exports.readable = function (val) {
return val && (
val instanceof Readable ||
val instanceof Duplex ||
(
val.readable === true &&
typeof val.push === 'function' &&
typeof val.on === 'function'
)
return isStream(val) && (
val.readable === true &&
typeof val.push === 'function' &&
typeof val.on === 'function'
)

@@ -39,17 +28,14 @@ }

/**
* @id isStream.writable
* @function isStream.writable
* Checks whether provided argument is a writable stream
* @param {object} val - the object to check
* @returns {boolean} `true` if `val` is a writable stream, `false` otherwise
* @returns {boolean} writable - `true` if `val` is a writable stream, `false` otherwise
*/
exports.writable = function (val) {
return val && (
(val instanceof Writable) ||
(val instanceof Duplex) ||
(
val.writable === true &&
typeof val.pipe === 'function' &&
typeof val.on === 'function'
)
return isStream(val) && (
val.writable === true &&
typeof val.pipe === 'function' &&
typeof val.on === 'function'
)
}
'use strict'
var isNode = require('./node')
/**
* @id isTouch
* @function isTouch
* Checks if we're running in a touch-enabled context
* @returns {boolean} `true` if we're in a touch-enabled context, `false` otherwise
* @returns {boolean} touch - `true` if we're in a touch-enabled context, `false` otherwise
*/

@@ -8,0 +9,0 @@ module.exports = isNode

'use strict'
var url = /^(((ws(s)?)|(http(s)?))\:\/\/)?[a-zA-Z0-9_-]+(\.|\:)([^\/\/])[a-zA-Z/0-9$-/:-?{#-~!"^_`\[\]]+$/
/**
* @id isUrl
* @function isUrl
* Checks if a string is a valid url
* @param {string} val - the string to check
* @returns {boolean} `true` if `val` is a valid url, `false` otherwise
* @returns {boolean} valid - `true` if *val* is a valid url, `false` otherwise
*/

@@ -9,0 +10,0 @@ module.exports = function (val) {

{
"name": "vigour-util",
"version": "1.3.3",
"version": "1.4.0",
"author": "Vigour.io <dev@vigour.io>",

@@ -21,3 +21,5 @@ "scripts": {

"lodash.isfinite": "^3.3.0",
"lodash.set": "^4.0.0"
"lodash.set": "^4.0.0",
"is-stream": "^1.0.1",
"is-buffer": "^1.1.3"
},

@@ -24,0 +26,0 @@ "main": "./",

'use strict'
/**
* @id path.contains
* @function pathContains

@@ -7,3 +8,3 @@ * Checks whether a key is part of an array, allowing for prefixed keys

* @param {string} key - the key to check for
* @returns {boolean} `true` if `key` is found in `array`, `false` otherwise
* @returns {boolean} found - `true` if *key* is found in *array*, `false` otherwise
*/

@@ -10,0 +11,0 @@ module.exports = function pathContains (path, key) {

@@ -0,5 +1,7 @@

<!-- VDOC.badges travis; standard; npm -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
[![Build Status](https://travis-ci.org/vigour-io/util.svg?branch=master)](https://travis-ci.org/vigour-io/util)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
[![npm version](https://badge.fury.io/js/vigour-util.svg)](https://badge.fury.io/js/vigour-util)
<!-- VDOC END -->
# vigour-util

@@ -13,40 +15,13 @@

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
### Contents
---
- [isEmail](#isemail)
- [isHash](#ishash)
- [isNode](#isnode)
- [isNumber](#isnumber)
- [isNumberlike](#isnumberlike)
- [isStream](#isstream)
- [isStream.readable](#isstreamreadable)
- [isStream.writable](#isstreamwritable)
- [isTouch](#istouch)
- [isUrl](#isurl)
- [isPlainobj](#isplainobj)
- [isRemoved](#isremoved)
- [isEmpty](#isempty)
- [pathContains](#pathcontains)
- [uuid.val](#uuidval)
- [uuid.generate](#uuidgenerate)
- [define](#define)
- [descriptors](#descriptors)
- [flatten](#flatten)
- [hash](#hash)
- [include](#include)
- [merge](#merge)
- [regenerator](#regenerator)
- [setwithpath](#setwithpath)
- [unflatten](#unflatten)
- [getReference](#getreference)
<!-- VDOC.jsdoc isEmail -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var valid = isEmail(val)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Checks whether provided parameter looks like a valid e-mail address
- **param** {*string*} val - the string to check
- **returns** {*boolean*} valid - `true` if `val` is a valid e-mail address, `false` otherwise
<!-- VDOC END -->
---
### [isEmail](is/email.js)
Checks whether provided parameter looks like a valid e-mail address
```javascript

@@ -58,4 +33,11 @@ var isEmail = require('vigour-util/is/email')

### [isHash](is/hash.js)
<!-- VDOC.jsdoc isHash -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var looksLikeHash = isHash(val)
Checks is a string looks like a hash generated by the [`hash`](#hash) utility
- **param** {*string*} val - the string to check
- **returns** {*boolean*} looksLikeHash - `true` if `val` looks like a hash, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -66,4 +48,8 @@ var isHash = require('vigour-util/is/hash')

### [isNode](is/node.js)
Check whether we're running in `node`
<!-- VDOC.jsdoc isNode -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var runningInNode = isNode()
- **returns** runningInNode - `true` if in node context, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -74,4 +60,11 @@ var isNode = require('vigour-util/is/node')

### [isNumber](is/number.js)
Alias for [`lodash.isfinite`](https://www.npmjs.com/package/lodash.isfinite)
<!-- VDOC.jsdoc isNumber -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var finiteNumber = isNumber(value)
This just calls `lodash.isfinite` internally. See [those docs](https://lodash.com/docs#isFinite)
- **param** {*any*} value - The value to check
- **returns** {*boolean*} finiteNumber - Returns `true` if *value* is a finite number, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -83,4 +76,11 @@ var isNumber = require('vigour-util/is/number')

### [isNumberlike](is/numberlike.js)
<!-- VDOC.jsdoc isNumberLike -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var looksLikeNumber = isNumberLike(val)
Checks whether provided parameter looks like a number
- **param** {*any*} val - the value to check
- **returns** {*boolean*} looksLikeNumber - `true` if `val` looks like a number, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -92,4 +92,11 @@ var isNumberLike = require('vigour-util/is/numberlike')

### [isStream](is/stream.js)
Checks whether provided argument implements the stream interface
<!-- VDOC.jsdoc isStream -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var stream = isStream(val)
Checks whether provided argument is a stream
- **param** {*object*} val - the object to check
- **returns** {*boolean*} stream - `true` if `val` is a stream, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -102,4 +109,11 @@ var stream = require('stream')

#### [isStream.readable](is/stream.js)
Checks whether provided argument implements the readable stream interface
<!-- VDOC.jsdoc isStream.readable -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var readable = isStream.readable(val)
Checks whether provided argument is a readable stream
- **param** {*object*} val - the object to check
- **returns** {*boolean*} readable - `true` if `val` is a readable stream, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -112,4 +126,11 @@ var stream = require('stream')

#### [isStream.writable](is/stream.js)
Checks whether provided argument implements the writable stream interface
<!-- VDOC.jsdoc isStream.writable -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var writable = isStream.writable(val)
Checks whether provided argument is a writable stream
- **param** {*object*} val - the object to check
- **returns** {*boolean*} writable - `true` if `val` is a writable stream, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -122,4 +143,10 @@ var stream = require('stream')

### [isTouch](is/touch.js)
<!-- VDOC.jsdoc isTouch -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var touch = isTouch()
Checks if we're running in a touch-enabled context
- **returns** {*boolean*} touch - `true` if we're in a touch-enabled context, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -130,4 +157,11 @@ var isTouch = require('vigour-util/is/touch')

### [isUrl](is/url.js)
<!-- VDOC.jsdoc isUrl -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var valid = isUrl(val)
Checks if a string is a valid url
- **param** {*string*} val - the string to check
- **returns** {*boolean*} valid - `true` if *val* is a valid url, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -139,5 +173,11 @@ var isUrl = require('vigour-util/is/url')

<!-- VDOC.jsdoc isPlainObj -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var plain = isPlainObj(obj)
### [isPlainobj](is/plainobj.js)
Checks whether an object is a plain object. (*Compatible with `vigour-base`*)
Checks whether an object is a plain object (*Compatible with `vigour-base`*)
- **param** {*object*} obj - the object to check
- **returns** {*boolean*} plain - `true` if *obj* is a plain object, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -149,4 +189,11 @@ var isPlainObj = require('vigour/util/is/plainobj')

### [isRemoved](is/removed.js)
(*Specific to `vigour-base`*) Checks if a property has been removed
<!-- VDOC.jsdoc isRemoved -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var removed = isRemoved(base)
Checks if a property has been removed (*Specific to `vigour-base`*)
- **param** {*Base*} base - the property to check
- **returns** {*boolean*} removed - `true` if *base* property has been removed, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -160,4 +207,11 @@ var isRemoved = require('vigour-util/is/removed')

### [isEmpty](is/empty.js)
(*Specific to `vigour-base`*) Checks if a `Base` object is empty
<!-- VDOC.jsdoc isEmpty -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var emptyBase = isEmpty(obj)
Checks if a `Base` object is empty (*Specific to `vigour-base`*)
- **param** {*object*} obj - the object to check for emptiness
- **returns** {*boolean*} emptyBase - `true` if `obj` is considered empty, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -170,4 +224,13 @@ var isEmpty = require('vigour-util/is/empty')

### [pathContains](path/contains.js)
Checks whether a key is part of an array, allowing for prefixed keys
<!-- VDOC.jsdoc path.contains -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var found = pathContains(path, key)
Checks whether a key is part of an array, allowing for prefixed keys
- **param** {*array*} path - the array to look in
- **param** {*string*} key - the key to check for
- **returns** {*boolean*} found - `true` if *key* is found in *array*, `false` otherwise
<!-- VDOC END -->
```javascript

@@ -178,4 +241,12 @@ var pathContains = require('vigour-util/path/contains')

### [uuid.val](uuid/index.js)
A process-specific unique ID (or device-specific on browser)
### uuid
<!-- VDOC.jsdoc uuid.val -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### .val
A process-specific unique ID, generated on `require`
<!-- VDOC END -->
```javascript

@@ -186,4 +257,10 @@ var uuid = require('vigour-util/uuid')

#### [uuid.generate](uuid/index.js)
Generates a process-specific unique ID (or device-specific on browser)
<!-- VDOC.jsdoc uuid.generate -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var id = uuid.generate()
Generates a unique ID
- **returns** {*string*} id - A unique ID
<!-- VDOC END -->
```javascript

@@ -194,4 +271,10 @@ var uuid = require('vigour-util/uuid')

### [define](define.js)
Defines new or modifies existing properties (using [`Object.defineProperty`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty)) on an object, setting `configurable: true` by default.
<!-- VDOC.jsdoc define -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### define(props)
Defines new (or modifies existing) properties (using [`Object.defineProperty`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty)) on an object passed to `define` as `this`, setting `configurable: true` by default
- **param** {*object*} props - Properties to set
<!-- VDOC END -->
```javascript

@@ -210,4 +293,10 @@ var define = require('vigour-util/define')

### [descriptors](descriptors.js)
Like [`Object.getOwnPropertyDescriptor`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor), but goes along the prototype chain and get's the descriptors for all properties.
<!-- VDOC.jsdoc descriptors -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### descriptors(props)
Like [`Object.getOwnPropertyDescriptor`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor), but goes along the prototype chain and gets the descriptors for all properties.
- **param** {*object*} props - the properties to get the descriptors for
<!-- VDOC END -->
```javascript

@@ -234,4 +323,12 @@ var descriptors = require('vigour-util/descriptors')

### [flatten](flatten.js)
Transforms a deep object into an object of single depth where keys are a path and values are leafs or the original object.
<!-- VDOC.jsdoc flatten -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var *object* = Take a nested Javascript object and flatten it(subject)
Transforms a deep object into an object of single depth where keys are a path and values are leafs of the original object.
- **param** {*object*} subject - Object that needs to be flattened
- **param** {*string*} [seperator] - Optional seperator sign
- **return** {*object*} - Object with delimited keys
<!-- VDOC END -->
```javascript

@@ -243,4 +340,12 @@ var flatten = require('vigour-util/flatten')

### [hash](hash.js)
<!-- VDOC.jsdoc hash -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var hashOfKey = hash(key, seed)
Hashing utility optimized for speed, not collision avoidance. Produces alpha-numeric hashes between 5 and 7 characters long inclusively.
- **param** {*string*} key - the string to hash
- **param** {*number*} seed - a seed for hashing
- **returns** {*string*} hashOfKey - The created hash
<!-- VDOC END -->
```javascript

@@ -251,23 +356,28 @@ var hash = require('vigour-util')

### [include](include.js)
### include
Docs coming soon
```javascript
### merge
***Deprecated***: consider using [`lodash.merge`](https://www.npmjs.com/package/lodash.merge)
```
<!-- VDOC.jsdoc regenerator -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### regenerator()
### [merge](merge.js)
***Deprecated***: consider using [`lodash.merge`](https://www.npmjs.com/package/lodash.merge)
```javascript
var merge = require('vigour-util/merge')
merge({ a: { b: 'b' } }, { a: { c: 'c' } }) // { a: { b: 'b', c: 'c' } }
```
Like Babel's regenerator, but much more compact. Brought to you by Facebook, but bundled in `vigour-util` for ease-of-use. See [the docs](https://github.com/facebook/regenerator)
<!-- VDOC END -->
### [regenerator](regenerator.js)
Like Babel's regenerator, but much more compact. Brought to you by Facebook, but bundled in `vigour-util` for ease-of-use.
### [setwithpath](setwithpath.js)
### setwithpath
***Deprecated***: consider using [`lodash.set`](https://www.npmjs.com/package/lodash.set)
### [unflatten](unflatten.js)
Opposite of [`flatten`](#flatten)
<!-- VDOC.jsdoc unflatten -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var obj = unflatten(subject)
Opposite of [`flatten`](#flatten). Unflattens an object with delimited keys
- **param** {*object*} subject - Object that needs to be unflattened
- **param** {*string*} [seperator] - Optional seperator sign
- **return** {*object*} obj - Nested Javascript object
<!-- VDOC END -->
```javascript

@@ -289,5 +399,11 @@ var unflatten = require('vigour-util')

### [getReference](get/reference.js)
<!-- VDOC.jsdoc get.reference -->
<!-- DON'T EDIT THIS SECTION (including comments), INSTEAD RE-RUN `vdoc` TO UPDATE -->
#### var ref = getReference(obj)
(*Specific to `vigour-base`*) Get's the referenced object
Get's the referenced object (*Specific to `vigour-base`*)
- **param** {*object*} obj - the reference we want to follow
- **returns** {*object*} ref - The referenced object or `undefined`
<!-- VDOC END -->
```javascript

@@ -294,0 +410,0 @@ var Base = require('vigour-base')

@@ -11,2 +11,7 @@ /**

/**
* @id regenerator
* @function regenerator
* Like Babel's regenerator, but much more compact. Brought to you by Facebook, but bundled in `vigour-util` for ease-of-use. See [the docs](https://github.com/facebook/regenerator)
*/
!(function(global) {

@@ -13,0 +18,0 @@ "use strict";

@@ -5,5 +5,5 @@ 'use strict'

var isPlainObj = require('../../is/plainobj')
var isObj = require('../../is/obj')
var testCases = [
// ['object', expectedResult]
[{}, true],

@@ -23,1 +23,9 @@ [{ a: 'a' }, true],

})
test('isObj', function (t) {
t.plan(testCases.length)
testCases.forEach(function (item) {
t.equals(isObj(item[0]), item[1], 'isObj(' + JSON.stringify(item[0]) + ') === ' + item[1])
})
})

@@ -56,3 +56,4 @@ 'use strict'

t.equals(isStream.readable(req), false, 'isStream.readable(http.ClientRequest) === false')
t.equals(isStream.writable(req), true, 'isStream.writable(http.ClientRequest) === true')
t.equals(isStream.writable(req), false, 'isStream.writable(http.ClientRequest) === false')
// --> not true! http://stackoverflow.com/questions/21101623/what-does-it-mean-in-node-js-by-http-clientrequest-implements-an-interface
req.end()

@@ -59,0 +60,0 @@ // from: https://nodejs.org/api/http.html#http_class_http_clientrequest

@@ -6,6 +6,8 @@ 'use strict'

/**
* @function Unflatten an object with delimited keys
* @id unflatten
* @function unflatten
* Opposite of [`flatten`](#flatten). Unflattens an object with delimited keys
* @param {object} subject - Object that needs to be unflattened
* @param {string} [seperator] - Optional seperator sign
* @return {object} - Nested Javascript object
* @return {object} obj - Nested Javascript object
*/

@@ -12,0 +14,0 @@

@@ -5,5 +5,6 @@ 'use strict'

/**
* @id uuid.generate_browser
* @function uuid.generate
* Generates a unique ID
* @returns {string} A unique ID
* @returns {string} id - A unique ID
*/

@@ -25,4 +26,6 @@ exports.generate = function () {

/**
* exports.val is a unique ID
* @id uuid.val_browser
* @property val
* a unique ID generated on `require`
*/
exports.val = exports.generate()

@@ -5,5 +5,6 @@ 'use strict'

/**
* @id uuid.generate
* @function uuid.generate
* Generates a unique ID
* @returns {string} A unique ID
* @returns {string} id - A unique ID
*/

@@ -16,4 +17,6 @@ exports.generate = function () {

/**
* exports.val is a unique ID
* @id uuid.val
* @property val
* A process-specific unique ID, generated on `require`
*/
exports.val = exports.generate()
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc