mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
imported 25 definitions from typescript-node-definitions
first batch: the easy pickings - as per https://github.com/borisyankov/DefinitelyTyped/issues/115 - added DT headers (scraped creators from git history) - added tests - some modifications - added CONTRIBUTORS.md for the substantial defs (>50 LOC)
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
/// <reference path="nconf.d.ts" />
|
||||
|
||||
import nconf = require('nconf');
|
||||
|
||||
var value: any;
|
||||
var num: number;
|
||||
var bool: boolean;
|
||||
var valueArr: any[];
|
||||
var str: string;
|
||||
var strArr: string[];
|
||||
var p: nconf.Provider;
|
||||
var opts: nconf.IOptions;
|
||||
var fopts: nconf.IFileOptions;
|
||||
var store: nconf.IStore;
|
||||
var callback: (err: Error) => void;
|
||||
|
||||
value = nconf.clear(str, callback);
|
||||
value = nconf.get (str, callback);
|
||||
value = nconf.merge(str, value, callback);
|
||||
value = nconf.set (str, value, callback);
|
||||
value = nconf.reset(callback);
|
||||
|
||||
value = nconf.load(callback);
|
||||
nconf.mergeSources(value);
|
||||
value = nconf.loadSources();
|
||||
value = nconf.save(value, callback);
|
||||
|
||||
p = nconf.add(str);
|
||||
p = nconf.add(str, opts);;
|
||||
|
||||
p = nconf.argv();
|
||||
p = nconf.argv(opts);
|
||||
|
||||
p = nconf.env();
|
||||
p = nconf.env(opts);
|
||||
|
||||
p = nconf.file(str);
|
||||
p = nconf.file(str, fopts);
|
||||
p = nconf.file(fopts);
|
||||
|
||||
p = nconf.use(str);
|
||||
p = nconf.use(str, opts);
|
||||
|
||||
p = nconf.defaults();
|
||||
p = nconf.defaults(opts);
|
||||
|
||||
nconf.init();
|
||||
nconf.init(opts);
|
||||
|
||||
p = nconf.overrides();
|
||||
p = nconf.overrides(opts);
|
||||
nconf.remove(str);
|
||||
store = nconf.create(str, opts);
|
||||
|
||||
str = nconf.key(value, value);
|
||||
valueArr = nconf.path(value);
|
||||
nconf.loadFiles(value, callback);
|
||||
nconf.loadFilesSync(value, callback);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
str = store.type;
|
||||
value = store.get(str);
|
||||
bool = store.set(str, value);
|
||||
bool = store.clear(str);
|
||||
bool = store.merge(str, value);
|
||||
bool = store.reset(callback);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
p = new nconf.Provider(opts);
|
||||
value = p.stores;
|
||||
valueArr = p.sources;
|
||||
|
||||
value = p.clear(str, callback);
|
||||
value = p.get(str, callback);
|
||||
value = p.merge(str,value,callback);
|
||||
value = p.set(str,value,callback);
|
||||
value = p.reset(callback);
|
||||
|
||||
value = p.load(callback);
|
||||
p.mergeSources(value);
|
||||
value = p.loadSources();
|
||||
value = p.save(value, callback);
|
||||
|
||||
p = p.add(str);
|
||||
p = p.add(str, opts);
|
||||
p = p.argv();
|
||||
p = p.argv(opts);
|
||||
p = p.env();
|
||||
p = p.env(opts);
|
||||
p = p.file(str);
|
||||
p = p.file(str, fopts);
|
||||
p = p.file(fopts);
|
||||
p = p.use(str, opts);
|
||||
|
||||
p = p.defaults(opts);
|
||||
p.init(opts);
|
||||
p = p.overrides(opts);
|
||||
p.remove(str);
|
||||
store = p.create(str, opts);
|
||||
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
// Type definitions for nconf
|
||||
// Project: https://github.com/flatiron/nconf
|
||||
// Definitions by: Jeff Goddard <https://github.com/jedigo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/nconf.d.ts
|
||||
|
||||
declare module "nconf" {
|
||||
export var version: number;
|
||||
export var stores: any;
|
||||
export var sources: any[];
|
||||
|
||||
export function clear(key: string, callback?: ICallbackFunction): any;
|
||||
export function get (key: string, callback?: ICallbackFunction): any;
|
||||
export function merge(key: string, value: any, callback?: ICallbackFunction): any;
|
||||
export function set (key: string, value: any, callback?: ICallbackFunction): any;
|
||||
export function reset(callback?: ICallbackFunction): any;
|
||||
|
||||
export function load(callback?: ICallbackFunction): any;
|
||||
export function mergeSources(data: any): void;
|
||||
export function loadSources(): any;
|
||||
export function save(value: any, callback?: ICallbackFunction): any;
|
||||
|
||||
export function add(name: string, options?: IOptions): Provider;
|
||||
export function argv(options?: IOptions): Provider;
|
||||
export function env(options?: IOptions): Provider;
|
||||
export function file(name: string, options?: IFileOptions): Provider;
|
||||
export function file(options: IFileOptions): Provider;
|
||||
export function use(name: string, options?: IOptions): Provider;
|
||||
export function defaults(options?: IOptions): Provider;
|
||||
export function init(options?: IOptions): void;
|
||||
export function overrides(options?: IOptions): Provider;
|
||||
export function remove(name: string): void;
|
||||
export function create(name: string, options: IOptions): IStore;
|
||||
|
||||
export function key(...values: any[]): string;
|
||||
export function path(key: any): any[];
|
||||
export function loadFiles(files: any, callback?: ICallbackFunction): void;
|
||||
export function loadFilesSync(files: any, callback?: ICallbackFunction): void;
|
||||
|
||||
export enum formats {
|
||||
json,
|
||||
ini
|
||||
}
|
||||
|
||||
export interface IOptions {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface IFileOptions extends IOptions {
|
||||
file?: string;
|
||||
dir?: string;
|
||||
search?: boolean;
|
||||
json_spacing?: number;
|
||||
}
|
||||
|
||||
export interface ICallbackFunction {
|
||||
(err: Error): void;
|
||||
}
|
||||
|
||||
export class Provider {
|
||||
constructor(options: IOptions);
|
||||
|
||||
stores: any;
|
||||
sources: any[];
|
||||
|
||||
clear(key: string, callback?: ICallbackFunction): any;
|
||||
get (key: string, callback?: ICallbackFunction): any;
|
||||
merge(key: string, value: any, callback?: ICallbackFunction): any;
|
||||
set (key: string, value: any, callback?: ICallbackFunction): any;
|
||||
reset(callback?: ICallbackFunction): any;
|
||||
|
||||
load(callback?: ICallbackFunction): any;
|
||||
mergeSources(data: any): void;
|
||||
loadSources(): any;
|
||||
save(value: any, callback?: ICallbackFunction): any;
|
||||
|
||||
add(name: string, options?: IOptions): Provider;
|
||||
argv(options?: IOptions): Provider;
|
||||
env(options?: IOptions): Provider;
|
||||
file(name: string, options?: IFileOptions): Provider;
|
||||
file(options: IFileOptions): Provider;
|
||||
use(name: string, options?: IOptions): Provider;
|
||||
|
||||
defaults(options?: IOptions): Provider;
|
||||
init(options?: IOptions): void;
|
||||
overrides(options?: IOptions): Provider;
|
||||
remove(name: string): void;
|
||||
create(name: string, options: IOptions): IStore;
|
||||
}
|
||||
|
||||
export interface IStore {
|
||||
type: string;
|
||||
get (key: string): any;
|
||||
set (key: string, value: any): boolean;
|
||||
clear(key: string): boolean;
|
||||
merge(key: string, value: any): boolean;
|
||||
reset(callback?: ICallbackFunction): boolean;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user