mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
Merge pull request #5799 from RWander/node-config
Type definitions for node-config
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/// <reference path="config.d.ts" />
|
||||
|
||||
import config = require('config');
|
||||
|
||||
var value1: string = config.get<string>("");
|
||||
var value2: any = config.get("");
|
||||
|
||||
var has: boolean = config.has("");
|
||||
|
||||
// util tests:
|
||||
var extended1: any = config.util.extendDeep({}, {});
|
||||
var extended2: any = config.util.extendDeep({}, {}, 20);
|
||||
|
||||
var clone1: any = config.util.cloneDeep({});
|
||||
var clone2: any = config.util.cloneDeep({}, 20);
|
||||
|
||||
var equals1: boolean = config.util.equalsDeep({}, {});
|
||||
var equals2: boolean = config.util.equalsDeep({}, {}, 20);
|
||||
|
||||
var diff1: any = config.util.diffDeep({}, {});
|
||||
var diff2: any = config.util.diffDeep({}, {}, 20);
|
||||
|
||||
var immutable1: any = config.util.makeImmutable({});
|
||||
var immutable2: any = config.util.makeImmutable({}, "");
|
||||
var immutable3: any = config.util.makeImmutable({}, "", "");
|
||||
|
||||
var hidden1: any = config.util.makeHidden({}, "");
|
||||
var hidden2: any = config.util.makeHidden({}, "", "");
|
||||
|
||||
var env: string = config.util.getEnv("");
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for node-config
|
||||
// Project: https://github.com/lorenwest/node-config
|
||||
// Definitions by: Roman Korneev <https://github.com/RWander>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "config" {
|
||||
// see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities
|
||||
interface IUtil {
|
||||
// Extend an object (and any object it contains) with one or more objects (and objects contained in them).
|
||||
extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any;
|
||||
|
||||
// Return a deep copy of the specified object.
|
||||
cloneDeep(copyFrom: any, depth?: number): any;
|
||||
|
||||
// Return true if two objects have equal contents.
|
||||
equalsDeep(object1: any, object2: any, dept?: number): boolean;
|
||||
|
||||
// Returns an object containing all elements that differ between two objects.
|
||||
diffDeep(object1: any, object2: any, depth?: number): any;
|
||||
|
||||
// Make a javascript object property immutable (assuring it cannot be changed from the current value).
|
||||
makeImmutable(object: any, propertyName?: string, propertyValue?: string): any;
|
||||
|
||||
// Make an object property hidden so it doesn't appear when enumerating elements of the object.
|
||||
makeHidden(object: any, propertyName: string, propertyValue?: string): any;
|
||||
|
||||
// Get the current value of a config environment variable
|
||||
getEnv(varName: string): string;
|
||||
}
|
||||
|
||||
export function get<T>(setting: string): T;
|
||||
export function has(setting: string): boolean;
|
||||
export var util: IUtil;
|
||||
}
|
||||
Reference in New Issue
Block a user