Comparing version 2.0.0 to 2.1.0
@@ -41,2 +41,3 @@ 'use strict'; | ||
refract.register = register; | ||
refract.registered = registered; | ||
@@ -84,2 +85,10 @@ /* Register bundled grammars. */ | ||
function registered(language) { | ||
if (typeof language !== 'string') { | ||
throw new Error('Expected `string` for `language`, got `' + language + '`'); | ||
} | ||
return own.call(refract.languages, language); | ||
} | ||
function stringify(value, language, parent) { | ||
@@ -86,0 +95,0 @@ var env; |
{ | ||
"name": "refractor", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Lightweight, robust, elegant virtual syntax highlighting using Prism", | ||
@@ -21,2 +21,3 @@ "license": "MIT", | ||
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
"Conor Hastings <hastings.conorm@gmail.com>", | ||
"Daniel Stefanovic <daniel.stefanovic@gmail.com>", | ||
@@ -23,0 +24,0 @@ "Mike Kruk <tamagokun@gmail.com>" |
@@ -24,2 +24,3 @@ # refractor [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
* [refractor.highlight(value, language)](#refractorhighlightvalue-language) | ||
* [refractor.registered(language)](#refractorregisteredlanguage) | ||
* [Browser](#browser) | ||
@@ -139,2 +140,25 @@ * [Plugins](#plugins) | ||
### `refractor.registered(language)` | ||
Check if a `language` ([name or alias][syntax]) is registered. | ||
###### Example | ||
```js | ||
var refractor = require('refractor/core.js'); | ||
console.log(refractor.registered('markdown')); | ||
refractor.register(require('refractor/lang/markdown.js')); | ||
console.log(refractor.registered('markdown')); | ||
``` | ||
Yields: | ||
```js | ||
false | ||
true | ||
``` | ||
## Browser | ||
@@ -141,0 +165,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
368793
7553
415