File: utils.js

package info (click to toggle)
node-cache-base 0.8.4-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 168 kB
  • sloc: sh: 11; makefile: 6
file content (38 lines) | stat: -rw-r--r-- 675 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';

/**
 * Module dependencies
 */

var utils = require('lazy-cache')(require);
var fn = require;
require = utils;

/**
 * Lazily required module dependencies
 */

require('component-emitter', 'Emitter');
require('collection-visit', 'visit');
require('isobject', 'isObject');
require('unset-value', 'del');
require('get-value', 'get');
require('has-value', 'has');
require('set-value', 'set');
require('union-value', 'union');
require('to-object-path', 'toPath');
require = fn;

/**
 * Cast val to an array
 */

utils.arrayify = function(val) {
  return val ? (Array.isArray(val) ? val : [val]) : [];
};

/**
 * Expose `utils` modules
 */

module.exports = utils;