cafe-utility 1.30.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +10 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -750,8 +750,14 @@ const splitOnce = (string, separator) =>
750
750
 
751
751
  const getExtension = string => {
752
752
  const name = last(string.split(/\\|\//g))
753
- const lastIndexOf = name.lastIndexOf('.')
754
- return lastIndexOf <= 0 ? '' : name.slice(lastIndexOf + 1)
753
+ const lastIndex = name.lastIndexOf('.')
754
+ return lastIndex <= 0 ? '' : name.slice(lastIndex + 1)
755
+ }
756
+
757
+ const getBasename = string => {
758
+ const name = last(string.split(/\\|\//g))
759
+ const index = name.indexOf('.', 1)
760
+ return index <= 0 ? string : name.slice(0, index)
755
761
  }
756
762
 
757
763
  const randomize = string => string.replace(/\{(.+?)\}/g, (_, group) => pick(group.split('|')))
@@ -1421,7 +1427,8 @@ module.exports = {
1421
1427
  csvEscape,
1422
1428
  parseCsv,
1423
1429
  surroundInOut,
1424
- getExtension
1430
+ getExtension,
1431
+ getBasename
1425
1432
  },
1426
1433
  Assertions: {
1427
1434
  asTrue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {