@snaplet/copycat
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -100,2 +100,14 @@ var import__ = require("."); | ||
], | ||
"digit": Array [ | ||
"9", | ||
"1", | ||
"3", | ||
"6", | ||
"1", | ||
"7", | ||
"0", | ||
"9", | ||
"1", | ||
"9", | ||
], | ||
"email": Array [ | ||
@@ -149,2 +161,14 @@ "Dewayne_Yost801@yahoo.com", | ||
], | ||
"hex": Array [ | ||
"1", | ||
"7", | ||
"9", | ||
"0", | ||
"f", | ||
"1", | ||
"8", | ||
"f", | ||
"d", | ||
"9", | ||
], | ||
"int": Array [ | ||
@@ -294,2 +318,68 @@ 3112761889, | ||
], | ||
"times": Array [ | ||
Array [ | ||
"Chihy", | ||
"Chime", | ||
"Miraekochi", | ||
"Raemia", | ||
], | ||
Array [ | ||
"Ceamemo", | ||
"Mahykona", | ||
"Mamimoki", | ||
"Shinoma", | ||
], | ||
Array [ | ||
"Kinakiha", | ||
"Hykaika", | ||
"Vinoraehy", | ||
"Hykinmo", | ||
"Mahy", | ||
], | ||
Array [ | ||
"Kakinyukai", | ||
"Ravimume", | ||
"Kaiaceako", | ||
"Mehy", | ||
], | ||
Array [ | ||
"Keshikai", | ||
"Vavichia", | ||
"Chisokichi", | ||
"Kira", | ||
], | ||
Array [ | ||
"Raki", | ||
"Mimea", | ||
"Namiyoha", | ||
"Shimoki", | ||
], | ||
Array [ | ||
"Vikeno", | ||
"Vayo", | ||
"Nakema", | ||
"Mahyno", | ||
], | ||
Array [ | ||
"Chiyota", | ||
"Raekiaki", | ||
"Kakera", | ||
"Hya", | ||
"Nonaceayo", | ||
], | ||
Array [ | ||
"Mayo", | ||
"Rakinshi", | ||
"Tamunashi", | ||
"Mivayoni", | ||
"Tamerashi", | ||
], | ||
Array [ | ||
"Kaitashiyu", | ||
"Namu", | ||
"Kinki", | ||
"Vikovi", | ||
"Makehy", | ||
], | ||
], | ||
"timezone": Array [ | ||
@@ -296,0 +386,0 @@ "Asia/Kuwait", |
@@ -1,4 +0,4 @@ | ||
export * as faker from '@faker-js/faker'; | ||
export { faker } from '@faker-js/faker'; | ||
export * as copycat from './copycat'; | ||
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -25,6 +25,6 @@ var __create = Object.create; | ||
copycat: () => copycat, | ||
faker: () => faker | ||
faker: () => import_faker.faker | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var faker = __toESM(require("@faker-js/faker")); | ||
var import_faker = require("@faker-js/faker"); | ||
var copycat = __toESM(require("./copycat")); | ||
@@ -31,0 +31,0 @@ __reExport(src_exports, require("./types"), module.exports); |
@@ -24,7 +24,4 @@ var __defProp = Object.defineProperty; | ||
var import_fictional = require("fictional"); | ||
const hex = (input) => (0, import_fictional.int)(input, { | ||
min: 0, | ||
max: 15 | ||
}).toString(16); | ||
const maker = (0, import_fictional.join)(":", [(0, import_fictional.times)(6, (0, import_fictional.join)("", [(0, import_fictional.times)(2, hex)]))]); | ||
var import_primitives = require("./primitives"); | ||
const maker = (0, import_fictional.join)(":", [(0, import_fictional.times)(6, (0, import_fictional.join)("", [(0, import_fictional.times)(2, import_primitives.hex)]))]); | ||
const mac = (input) => maker(input); | ||
@@ -31,0 +28,0 @@ // Annotate the CommonJS export names for ESM import in node: |
import fictional from 'fictional'; | ||
import { Input } from './types'; | ||
export declare const int: fictional.Int; | ||
@@ -7,2 +8,3 @@ export declare const bool: typeof fictional.bool; | ||
export declare const char: fictional.Char; | ||
export declare const digit: fictional.CharFn; | ||
export declare const word: fictional.Word; | ||
@@ -13,2 +15,4 @@ export declare const words: fictional.Words; | ||
export declare const oneOf: fictional.OneOf; | ||
export declare const times: fictional.Times; | ||
export declare const hex: (input: Input) => string; | ||
//# sourceMappingURL=primitives.d.ts.map |
@@ -26,3 +26,5 @@ var __create = Object.create; | ||
dateString: () => dateString, | ||
digit: () => digit, | ||
float: () => float, | ||
hex: () => hex, | ||
int: () => int, | ||
@@ -32,2 +34,3 @@ oneOf: () => oneOf, | ||
sentence: () => sentence, | ||
times: () => times, | ||
word: () => word, | ||
@@ -43,2 +46,3 @@ words: () => words | ||
const char = import_fictional.default.char; | ||
const digit = import_fictional.default.char.digit; | ||
const word = import_fictional.default.word.options({ unicode: false }); | ||
@@ -52,2 +56,7 @@ const words = import_fictional.default.words.options({ | ||
const oneOf = import_fictional.default.oneOf; | ||
const times = import_fictional.default.times; | ||
const hex = (input) => int(input, { | ||
min: 0, | ||
max: 15 | ||
}).toString(16); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -58,3 +67,5 @@ 0 && (module.exports = { | ||
dateString, | ||
digit, | ||
float, | ||
hex, | ||
int, | ||
@@ -64,4 +75,5 @@ oneOf, | ||
sentence, | ||
times, | ||
word, | ||
words | ||
}); |
@@ -41,2 +41,3 @@ var __defProp = Object.defineProperty; | ||
const TRANSFORMATIONS = __spreadValues(__spreadValues({}, import__.copycat), { | ||
times: (input) => import__.copycat.times(input, [4, 5], import__.copycat.word), | ||
oneOf: (input) => import__.copycat.oneOf(input, ["red", "green", "blue"]) | ||
@@ -43,0 +44,0 @@ }); |
{ | ||
"name": "@snaplet/copycat", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -1,2 +0,2 @@ | ||
# copycat | ||
# ![copycat](https://user-images.githubusercontent.com/1731223/167850970-584e6953-6543-4085-af5a-f9d8b7ffe988.png) | ||
@@ -74,3 +74,3 @@ ```js | ||
A re-export of the exports of [`@faker-js/faker`](https://github.com/faker-js/faker) as an object. We do not alter faker in any way, and do not seed it. | ||
A re-export of `faker` from [`@faker-js/faker`](https://github.com/faker-js/faker). We do not alter faker in any way, and do not seed it. | ||
@@ -86,2 +86,18 @@ ### `copycat.oneOf(input, values)` | ||
### `times(input, range, fn)` | ||
Takes in an [`input`](#input) value and a function `fn`, calls that function repeatedly (each time with a unique input) for a number of times within the given `range`, and returns the results as an array: | ||
```js | ||
copycat.times('foo', [4, 5], copycat.word) | ||
// => [ 'Raeko', 'Vame', 'Kiyumo', 'Koviva', 'Kiyovami' ] | ||
``` | ||
As shown above, `range` can be a tuple array of the minimum and maximum possible number of times the maker should be called. It can also be given as a number, in which case `fn` will be called exactly that number of times: | ||
```js | ||
copycat.times('foo', 2, copycat.word) | ||
// => [ 'Raeko', 'Vame' ] | ||
``` | ||
### `copycat.int(input[, options])` | ||
@@ -129,2 +145,20 @@ | ||
### `copycat.hex(input)` | ||
Takes in an [`input`](#input) value and returns a string with a single digit value. | ||
```js | ||
copycat.digit('foo') | ||
// => '2' | ||
``` | ||
### `copycat.hex(input)` | ||
Takes in an [`input`](#input) value and returns a string with a single hex value. | ||
```js | ||
copycat.hex('foo') | ||
// => '2' | ||
``` | ||
#### `options` | ||
@@ -295,2 +329,17 @@ | ||
#### `options` | ||
- **`capitalize=true`:** whether or not the word should start with an upper case letter | ||
- **`minSyllables=2` and `maxSyllables=4`:** the minimum and maximum possible number of syllables that returned words will contain | ||
```js | ||
word('id-2', { | ||
minSyllables: 1, | ||
maxSyllables: 6, | ||
unicode: 0.382 | ||
}) | ||
// => | ||
'Rayuashira' | ||
``` | ||
### `copycat.words(input)` | ||
@@ -305,2 +354,9 @@ | ||
#### `options` | ||
- **`min=2` and `max=3`:** the minimum and maximum possible number of words that returned strings will contain. | ||
- **`capitalize='first'`:** whether or not the words should start with upper | ||
case letters. If `true` or `'all'` is given, each string returned will start with an upper case letter in each word. If `'first'` is given, for each string returned, only the first word will start with an upper case letter. If `false` is given, each string returned will always contain only lower case letters. | ||
- **`minSyllables=1` and `maxSyllables=4`:** the minimum and maximum possible number of syllables that returned words will contain | ||
### `copycat.sentence(input)` | ||
@@ -315,2 +371,8 @@ | ||
#### `options` | ||
- **`minClauses=1` and `maxClauses=2`:** the minimum and maximum possible number of clauses that a returned sentence will contain. | ||
- **`minWords=5` and `maxWords=8`:** the minimum and maximum possible number of words that each clause will contain. | ||
- **`minSyllables=1` and `maxSyllables=4`:** the minimum and maximum possible number of syllables that returned words will contain | ||
### `copycat.paragraph(input)` | ||
@@ -325,2 +387,9 @@ | ||
#### `options` | ||
- **`minSentences=3` and `minSentences=7`:** the minimum and maximum possible number of sentences that a returned paragraph will contain. | ||
- **`minClauses=1` and `maxClauses=2`:** the minimum and maximum possible number of clauses that each sentence will contain. | ||
- **`minWords=5` and `maxWords=8`:** the minimum and maximum possible number of words that each clause will contain. | ||
- **`minSyllables=1` and `maxSyllables=4`:** the minimum and maximum possible number of syllables that returned words will contain | ||
### `copycat.ipv4(input)` | ||
@@ -327,0 +396,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
136862
87
2043
417