File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -412,3 +412,19 @@ The maximum length for any semver component considered for coercion is 16 chara
412
412
longer components will be ignored (` 10000000000000000.4.7.4 ` becomes ` 4.7.4 ` ).
413
413
The maximum value for any semver component is ` Integer.MAX_SAFE_INTEGER || (2**53 - 1) ` ;
414
414
higher value components are invalid (` 9999999999999999.4.7.4 ` is likely invalid).
415
+
416
+ ### Clean
417
+
418
+ * ` clean(version) ` : Clean a string to be a valid semver if possible
419
+
420
+ This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges.
421
+
422
+ ex.
423
+ * ` s.clean(' = v 2.1.5foo') ` : ` null `
424
+ * ` s.clean(' = v 2.1.5foo', { loose: true }) ` : ` '2.1.5-foo' `
425
+ * ` s.clean(' = v 2.1.5-foo') ` : ` null `
426
+ * ` s.clean(' = v 2.1.5-foo', { loose: true }) ` : ` '2.1.5-foo' `
427
+ * ` s.clean('=v2.1.5') ` : ` '2.1.5' `
428
+ * ` s.clean(' =v2.1.5') ` : ` 2.1.5 `
429
+ * ` s.clean(' 2.1.5 ') ` : ` '2.1.5' `
430
+ * ` s.clean('~1.0.0') ` : ` null `
You can’t perform that action at this time.
0 commit comments