mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add type definitions for gulp-json-editor
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/// <reference path="gulp-json-editor.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import * as gulp from 'gulp';
|
||||
import * as jeditor from 'gulp-json-editor';
|
||||
|
||||
// Samples taken from https://www.npmjs.com/package/gulp-json-editor
|
||||
|
||||
/*
|
||||
edit JSON object by merging with user specific object
|
||||
*/
|
||||
gulp.src("./manifest.json")
|
||||
.pipe(jeditor({
|
||||
'version': '1.2.3'
|
||||
}))
|
||||
.pipe(gulp.dest("./dest"));
|
||||
|
||||
/*
|
||||
edit JSON object by using user specific function
|
||||
*/
|
||||
gulp.src("./manifest.json")
|
||||
.pipe(jeditor(function(json : any) {
|
||||
json.version = "1.2.3";
|
||||
return json; // must return JSON object.
|
||||
}))
|
||||
.pipe(gulp.dest("./dest"));
|
||||
|
||||
/*
|
||||
specify js-beautify option
|
||||
*/
|
||||
gulp.src("./manifest.json")
|
||||
.pipe(jeditor({
|
||||
'version': '1.2.3'
|
||||
},
|
||||
// the second argument is passed to js-beautify as its option
|
||||
{
|
||||
'indent_char': '\t',
|
||||
'indent_size': 1
|
||||
}))
|
||||
.pipe(gulp.dest("./dest"));
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for gulp-json-editor v2.2.1
|
||||
// Project: https://www.npmjs.com/package/gulp-json-editor
|
||||
// Definitions by: Peter Juras <https://github.com/peterjuras>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../js-beautify/js-beautify.d.ts" />
|
||||
|
||||
declare module "gulp-json-editor" {
|
||||
|
||||
interface JEditor {
|
||||
(mergeWith: any | ((json : any) => any ),
|
||||
jsBeautifyOptions? : JsBeautifyOptions ) : NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
const jeditor : JEditor;
|
||||
export = jeditor;
|
||||
}
|
||||
Reference in New Issue
Block a user