weapon-regex
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "weapon-regex", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "weapon-regex", | ||
@@ -5,0 +5,0 @@ "main": "core/target/js-2.13/weapon-regex-opt.js", |
# Weapon regeX | ||
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FNhaajt%2FWeapon-regeX%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/Nhaajt/Weapon-regeX/main) | ||
[![Build Status](https://github.com/Nhaajt/Weapon-regeX/workflows/Scala%20CI/badge.svg)](https://github.com/Nhaajt/Weapon-regeX/actions?query=workflow%3AScala%20CI+branch%3Amain) | ||
[<img src="https://img.shields.io/badge/GitHub Pages-🌐-blue" alt="GitHub Pages">](https://nhaajt.github.io/Weapon-regeX/) | ||
@@ -11,3 +12,3 @@ <img src="images/WeaponRegeX_logo.svg" width="50%" alt="Weapon regeX Logo"> | ||
The current supported versions for Scala are: 2.12.12 and 2.13.3. | ||
The current supported versions for Scala are: `2.12.12` and `2.13.3`. | ||
@@ -18,3 +19,3 @@ # Getting started | ||
Add Weapon regeX to your ```build.sbt```. | ||
```Scala | ||
```scala | ||
"io.stryker-mutator" %% "weapon-regex" % "0.1.2" | ||
@@ -25,8 +26,10 @@ ``` | ||
```Scala | ||
```scala | ||
import weaponregex.WeaponRegeX | ||
import scala.util.{Success, Failure} | ||
val mutants = WeaponRegeX.mutate("^abc(d+|[xyz])$") | ||
mutants.map(mutant => println(mutant.pattern)) | ||
WeaponRegeX.mutate("^abc(d+|[xyz])$") match { | ||
case Success(mutants) => mutants map (_.pattern) map println | ||
case Failure(e) => print(e.getMessage) | ||
} | ||
``` | ||
@@ -36,3 +39,3 @@ | ||
Install Weapon regeX with npm. | ||
Install Weapon regeX with `npm`. | ||
@@ -45,6 +48,6 @@ ```bash | ||
```Javascript | ||
```javascript | ||
const wrx = require('weapon-regex'); | ||
var mutants = wrx.mutate("^abc(d+|[xyz])$"); | ||
let mutants = wrx.mutate("^abc(d+|[xyz])$"); | ||
@@ -55,2 +58,3 @@ mutants.forEach(mutant => { | ||
``` | ||
[Try it!](https://npm.runkit.com/weapon-regex) | ||
@@ -63,2 +67,4 @@ # API | ||
```scala | ||
//import scala.util.{Try, Success, Failure} | ||
def mutate( | ||
@@ -68,3 +74,3 @@ pattern: String, | ||
mutationLevels: Seq[Int] = null | ||
): Seq[Mutant] | ||
): Try[Seq[Mutant]] | ||
``` | ||
@@ -78,2 +84,4 @@ With the ```mutators``` argument you can give a select list of mutators that should be used in | ||
This function will return a `Success` of of a sequence of `Mutant` if can be parsed, a `Failure` otherwise. | ||
## Javascript | ||
@@ -87,3 +95,3 @@ | ||
val mutants = wrx.mutate("^abc(d+|[xyz])$",{ | ||
let mutants = wrx.mutate("^abc(d+|[xyz])$",{ | ||
mutators: Array.from(wrx.mutators.values()), | ||
@@ -98,2 +106,4 @@ mutationLevels: [1, 2, 3] | ||
This function will return a JavaScript Array of `Mutant` if can be parsed, or throw an exception otherwise. | ||
# Supported mutators | ||
@@ -100,0 +110,0 @@ All the supported mutators and at which mutation level they appear are shown in the table below. |
Sorry, the diff of this file is too big to display
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
387
405634
1746