@scaleway/random-name
Advanced tools
Comparing version 5.0.1 to 5.0.2
# Change Log | ||
## 5.0.2 | ||
### Patch Changes | ||
- [#1953](https://github.com/scaleway/scaleway-lib/pull/1953) [`1fddf05`](https://github.com/scaleway/scaleway-lib/commit/1fddf0515851908b094f983b05b3d87af8eef433) Thanks [@philibea](https://github.com/philibea)! - add cjs build | ||
## 5.0.1 | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
const i = [ | ||
const ADJECTIVES = [ | ||
"admiring", | ||
@@ -110,3 +110,4 @@ "adoring", | ||
"zen" | ||
], r = [ | ||
]; | ||
const NAMES = [ | ||
// Muhammad ibn Jābir al-Ḥarrānī al-Battānī was a founding father of astronomy. https://en.wikipedia.org/wiki/Mu%E1%B8%A5ammad_ibn_J%C4%81bir_al-%E1%B8%A4arr%C4%81n%C4%AB_al-Batt%C4%81n%C4%AB | ||
@@ -590,8 +591,12 @@ "albattani", | ||
"zhukovsky" | ||
], l = (a = "", e = "-") => { | ||
const n = `${i[Math.floor(Math.random() * i.length)] ?? ""}${e}${r[Math.floor(Math.random() * r.length)] ?? ""}`; | ||
return n === `boring${e}wozniak` ? l(a, e) : a.length > 0 ? `${a}${e}${n}` : n; | ||
]; | ||
const randomName = (prefix = "", separator = "-") => { | ||
const name = `${ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)] ?? ""}${separator}${NAMES[Math.floor(Math.random() * NAMES.length)] ?? ""}`; | ||
if (name === `boring${separator}wozniak`) { | ||
return randomName(prefix, separator); | ||
} | ||
return prefix.length > 0 ? `${prefix}${separator}${name}` : name; | ||
}; | ||
export { | ||
l as default | ||
randomName as default | ||
}; |
{ | ||
"name": "@scaleway/random-name", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "A small utility to generate a random name", | ||
@@ -33,4 +33,6 @@ "engines": { | ||
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts", | ||
"lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." | ||
"lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", | ||
"test:unit": "vitest --run --config vite.config.ts", | ||
"test:unit:coverage": "pnpm test:unit --coverage" | ||
} | ||
} |
@@ -1,3 +0,1 @@ | ||
/* eslint-disable eslint-comments/disable-enable-pair */ | ||
/* eslint-disable import/no-relative-packages */ | ||
import { defineConfig, mergeConfig } from 'vite' | ||
@@ -4,0 +2,0 @@ import { defaultConfig } from '../../vite.config' |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
109134
1264
0