Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/mustache

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/mustache - npm Package Compare versions

Comparing version 0.8.30 to 0.8.31

244

mustache/index.d.ts

@@ -1,8 +0,109 @@

// Type definitions for Mustache 0.8.2
// Type definitions for Mustache 0.8.3
// Project: https://github.com/janl/mustache.js
// Definitions by: Mark Ashley Bell <https://github.com/markashleybell>
// Definitions by: Mark Ashley Bell <https://github.com/markashleybell>, Manuel Thalmann <https://github.com/manuth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Provides the functionality to render templates with `{{mustaches}}`.
*/
interface MustacheStatic {
/**
* The name of the module.
*/
name: string;
interface MustacheScanner {
/**
* The version of the module.
*/
version: string;
/**
* The opening and closing tags to parse.
*/
tags: string;
/**
* A simple string scanner that is used by the template parser to find tokens in template strings.
*/
Scanner: typeof MustacheScanner
/**
* Represents a rendering context by wrapping a view object and maintaining a reference to the parent context.
*/
Context: typeof MustacheContext;
/**
* A Writer knows how to take a stream of tokens and render them to a `string`, given a context.
*
* It also maintains a cache of templates to avoid the need to parse the same template twice.
*/
Writer: typeof MustacheWriter;
/**
* Escapes HTML-characters.
*
* @param value
* The string to escape.
*/
escape: (value: string) => string;
/**
* Clears all cached templates in this writer.
*/
clearCache(): void;
/**
* Parses and caches the given template in the default writer and returns the array of tokens it contains.
*
* Doing this ahead of time avoids the need to parse templates on the fly as they are rendered.
*
* @param template
* The template to parse.
*
* @param tags
* The tags to use.
*/
parse(template: string, tags?: string[]): any;
/**
* Renders the `template` with the given `view` and `partials` using the default writer.
*
* @param template
* The template to render.
*
* @param view
* The view to render the template with.
*
* @param partials
* Either an object that contains the names and templates of partials that are used in a template
*
* -- or --
*
* A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
*/
render(template: string, view: any | MustacheContext, partials?: any): string;
/**
* Renders the `template` with the given `view` and `partials` using the default writer.
*
* @param template
* The template to render.
*
* @param view
* The view to render the template with.
*
* @param partials
* Either an object that contains the names and templates of partials that are used in a template
*
* -- or --
*
* A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
*/
to_html(template: string, view: any | MustacheContext, partials?: any, send?: any): any;
}
/**
* A simple string scanner that is used by the template parser to find tokens in template strings.
*/
declare class MustacheScanner {
string: string;

@@ -12,43 +113,136 @@ tail: string;

/**
* Initializes a new instance of the `MustacheScanner` class.
*/
constructor(string: string);
/**
* Returns `true` if the tail is empty (end of string).
*/
eos(): boolean;
/**
* Tries to match the given regular expression at the current position.
*
* @param re
* The regex-pattern to match.
*
* @returns
* The matched text if it can match, the empty string otherwise.
*/
scan(re: RegExp): string;
/**
* Skips all text until the given regular expression can be matched.
*
* @param re
* The regex-pattern to match.
*
* @returns
* Returns the skipped string, which is the entire tail if no match can be made.
*/
scanUntil(re: RegExp): string;
}
interface MustacheContext {
/**
* Represents a rendering context by wrapping a view object and maintaining a reference to the parent context.
*/
declare class MustacheContext {
view: any;
parentContext: MustacheContext;
/**
* Initializes a new instance of the `MustacheContenxt` class.
*/
constructor(view: any, parentContext: MustacheContext);
/**
* Initializes a new instance of the `MustacheContenxt` class.
*/
constructor(view: any);
/**
* Creates a new context using the given view with this context as the parent.
*
* @param view
* The view to create the new context with.
*/
push(view: any): MustacheContext;
/**
* Returns the value of the given name in this context, traversing up the context hierarchy if the value is absent in this context's view.
*
* @param name
* The name to look up.
*/
lookup(name: string): any;
}
interface MustacheWriter {
(view: any): string;
/**
* A Writer knows how to take a stream of tokens and render them to a `string`, given a context.
*
* It also maintains a cache of templates to avoid the need to parse the same template twice.
*/
declare class MustacheWriter {
/**
* Initializes a new instance of the `MustacheWriter` class.
*/
constructor();
/**
* Clears all cached templates in this writer.
*/
clearCache(): void;
/**
* Parses and caches the given `template` and returns the array of tokens that is generated from the parse.
*
* @param template
* The template to parse.
*/
parse(template: string, tags?: any): any;
render(template: string, view: any, partials: any): string;
renderTokens(tokens: string[], context: MustacheContext, partials: any, originalTemplate: any): string;
}
interface MustacheStatic {
name: string;
version: string;
tags: string;
Scanner: MustacheScanner;
Context: MustacheContext;
Writer: MustacheWriter;
escape: any;
/**
* High-level method that is used to render the given `template` with the given `view`.
*
* @param template
* The template to render.
*
* @param view
* The view to render the template with.
*
* @param partials
* Either an object that contains the names and templates of partials that are used in a template
*
* -- or --
*
* A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
*/
render(template: string, view: any | MustacheContext, partials: any): string;
clearCache(): MustacheWriter;
parse(template: string, tags?: any): any;
render(template: string, view: any, partials?: any): string;
to_html(template: string, view: any, partials?: any, send?: any): any;
/**
* Low-level method that renders the given array of `tokens` using the given `context` and `partials`.
*
* @param tokens
* The tokens to render.
*
* @param context
* The context to use for rendering the tokens.
*
* @param partials
* The partials to use for rendering the tokens.
*
* @param originalTemplate
* An object used to extract the portion of the original template that was contained in a higher-order section.
*
* If the template doesn't use higher-order sections, this argument may be omitted.
*/
renderTokens(tokens: string[], context: MustacheContext, partials: any, originalTemplate: any): string;
}
/**
* Provides the functionality to render templates with `{{mustaches}}`.
*/
declare var Mustache: MustacheStatic;
declare module 'mustache' {
export = Mustache;
}
export = Mustache;
export as namespace Mustache;

14

mustache/package.json
{
"name": "@types/mustache",
"version": "0.8.30",
"version": "0.8.31",
"description": "TypeScript definitions for Mustache",

@@ -9,3 +9,9 @@ "license": "MIT",

"name": "Mark Ashley Bell",
"url": "https://github.com/markashleybell"
"url": "https://github.com/markashleybell",
"githubUsername": "markashleybell"
},
{
"name": "Manuel Thalmann",
"url": "https://github.com/manuth",
"githubUsername": "manuth"
}

@@ -16,8 +22,8 @@ ],

"type": "git",
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "8945e8ff7dc466dd9505e272f90d0db8c6004e5c117e71c0eeb39cfbb90c94de",
"typesPublisherContentHash": "ac809a5b8101ba89930633a7838f8b35cc73078c905f915b016bb436bc4af267",
"typeScriptVersion": "2.0"
}

@@ -8,6 +8,6 @@ # Installation

# Details
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mustache
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mustache
Additional Details
* Last updated: Mon, 21 Aug 2017 21:59:27 GMT
* Last updated: Thu, 21 Jun 2018 00:15:28 GMT
* Dependencies: none

@@ -17,2 +17,2 @@ * Global values: Mustache

# Credits
These definitions were written by Mark Ashley Bell <https://github.com/markashleybell>.
These definitions were written by Mark Ashley Bell <https://github.com/markashleybell>, Manuel Thalmann <https://github.com/manuth>.
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