|
1 | 1 | import { FakerError } from '../../errors/faker-error';
|
2 |
| -import { deprecated } from '../../internal/deprecated'; |
3 | 2 | import { ModuleBase } from '../../internal/module-base';
|
4 | 3 | import type { BitcoinAddressFamilyType, BitcoinNetworkType } from './bitcoin';
|
5 | 4 | import {
|
@@ -206,171 +205,6 @@ export class FinanceModule extends ModuleBase {
|
206 | 205 | return `${routingNumber}${Math.ceil(sum / 10) * 10 - sum}`;
|
207 | 206 | }
|
208 | 207 |
|
209 |
| - /** |
210 |
| - * Generates a random masked number. |
211 |
| - * |
212 |
| - * @param length The length of the unmasked number. Defaults to `4`. |
213 |
| - * |
214 |
| - * @example |
215 |
| - * faker.finance.maskedNumber() // '(...9711)' |
216 |
| - * faker.finance.maskedNumber(3) // '(...342)' |
217 |
| - * |
218 |
| - * @since 8.0.0 |
219 |
| - * |
220 |
| - * @deprecated Use `faker.finance.iban().replace(/(?<=.{4})\w(?=.{2})/g, '*')` or a similar approach instead. |
221 |
| - */ |
222 |
| - maskedNumber(length?: number): string; |
223 |
| - /** |
224 |
| - * Generates a random masked number. |
225 |
| - * |
226 |
| - * @param options An options object. |
227 |
| - * @param options.length The length of the unmasked number. Defaults to `4`. |
228 |
| - * @param options.parens Whether to use surrounding parenthesis. Defaults to `true`. |
229 |
| - * @param options.ellipsis Whether to prefix the numbers with an ellipsis. Defaults to `true`. |
230 |
| - * |
231 |
| - * @example |
232 |
| - * faker.finance.maskedNumber() // '(...9711)' |
233 |
| - * faker.finance.maskedNumber({ length: 3 }) // '(...342)' |
234 |
| - * faker.finance.maskedNumber({ length: 3, parens: false }) // '...236' |
235 |
| - * faker.finance.maskedNumber({ length: 3, parens: false, ellipsis: false }) // '298' |
236 |
| - * |
237 |
| - * @since 8.0.0 |
238 |
| - * |
239 |
| - * @deprecated Use `faker.finance.iban().replace(/(?<=.{4})\w(?=.{2})/g, '*')` or a similar approach instead. |
240 |
| - */ |
241 |
| - maskedNumber(options?: { |
242 |
| - /** |
243 |
| - * The length of the unmasked number. |
244 |
| - * |
245 |
| - * @default 4 |
246 |
| - */ |
247 |
| - length?: number; |
248 |
| - /** |
249 |
| - * Whether to use surrounding parenthesis. |
250 |
| - * |
251 |
| - * @default true |
252 |
| - */ |
253 |
| - parens?: boolean; |
254 |
| - /** |
255 |
| - * Whether to prefix the numbers with an ellipsis. |
256 |
| - * |
257 |
| - * @default true |
258 |
| - */ |
259 |
| - ellipsis?: boolean; |
260 |
| - }): string; |
261 |
| - /** |
262 |
| - * Generates a random masked number. |
263 |
| - * |
264 |
| - * @param optionsOrLength An options object or the length of the unmask number. |
265 |
| - * @param optionsOrLength.length The length of the unmasked number. Defaults to `4`. |
266 |
| - * @param optionsOrLength.parens Whether to use surrounding parenthesis. Defaults to `true`. |
267 |
| - * @param optionsOrLength.ellipsis Whether to prefix the numbers with an ellipsis. Defaults to `true`. |
268 |
| - * |
269 |
| - * @example |
270 |
| - * faker.finance.maskedNumber() // '(...9711)' |
271 |
| - * faker.finance.maskedNumber(3) // '(...342)' |
272 |
| - * faker.finance.maskedNumber({ length: 3 }) // '(...342)' |
273 |
| - * faker.finance.maskedNumber({ length: 3, parens: false }) // '...236' |
274 |
| - * faker.finance.maskedNumber({ length: 3, parens: false, ellipsis: false }) // '298' |
275 |
| - * |
276 |
| - * @since 8.0.0 |
277 |
| - * |
278 |
| - * @deprecated Use `faker.finance.iban().replace(/(?<=.{4})\w(?=.{2})/g, '*')` or a similar approach instead. |
279 |
| - */ |
280 |
| - maskedNumber( |
281 |
| - optionsOrLength?: |
282 |
| - | number |
283 |
| - | { |
284 |
| - /** |
285 |
| - * The length of the unmasked number. |
286 |
| - * |
287 |
| - * @default 4 |
288 |
| - */ |
289 |
| - length?: number; |
290 |
| - /** |
291 |
| - * Whether to use surrounding parenthesis. |
292 |
| - * |
293 |
| - * @default true |
294 |
| - */ |
295 |
| - parens?: boolean; |
296 |
| - /** |
297 |
| - * Whether to prefix the numbers with an ellipsis. |
298 |
| - * |
299 |
| - * @default true |
300 |
| - */ |
301 |
| - ellipsis?: boolean; |
302 |
| - } |
303 |
| - ): string; |
304 |
| - /** |
305 |
| - * Generates a random masked number. |
306 |
| - * |
307 |
| - * @param options An options object. |
308 |
| - * @param options.length The length of the unmasked number. Defaults to `4`. |
309 |
| - * @param options.parens Whether to use surrounding parenthesis. Defaults to `true`. |
310 |
| - * @param options.ellipsis Whether to prefix the numbers with an ellipsis. Defaults to `true`. |
311 |
| - * |
312 |
| - * @example |
313 |
| - * faker.finance.maskedNumber() // '(...9711)' |
314 |
| - * faker.finance.maskedNumber(3) // '(...342)' |
315 |
| - * faker.finance.maskedNumber({ length: 3 }) // '(...342)' |
316 |
| - * faker.finance.maskedNumber({ length: 3, parens: false }) // '...236' |
317 |
| - * faker.finance.maskedNumber({ length: 3, parens: false, ellipsis: false }) // '298' |
318 |
| - * |
319 |
| - * @since 8.0.0 |
320 |
| - * |
321 |
| - * @deprecated Use `faker.finance.iban().replace(/(?<=.{4})\w(?=.{2})/g, '*')` or a similar approach instead. |
322 |
| - */ |
323 |
| - maskedNumber( |
324 |
| - options: |
325 |
| - | number |
326 |
| - | { |
327 |
| - /** |
328 |
| - * The length of the unmasked number. |
329 |
| - * |
330 |
| - * @default 4 |
331 |
| - */ |
332 |
| - length?: number; |
333 |
| - /** |
334 |
| - * Whether to use surrounding parenthesis. |
335 |
| - * |
336 |
| - * @default true |
337 |
| - */ |
338 |
| - parens?: boolean; |
339 |
| - /** |
340 |
| - * Whether to prefix the numbers with an ellipsis. |
341 |
| - * |
342 |
| - * @default true |
343 |
| - */ |
344 |
| - ellipsis?: boolean; |
345 |
| - } = {} |
346 |
| - ): string { |
347 |
| - deprecated({ |
348 |
| - deprecated: 'faker.finance.maskedNumber()', |
349 |
| - proposed: |
350 |
| - "faker.finance.iban().replace(/(?<=.{4})\\w(?=.{2})/g, '*') or a similar approach", |
351 |
| - since: '9.3.0', |
352 |
| - until: '10.0.0', |
353 |
| - }); |
354 |
| - |
355 |
| - if (typeof options === 'number') { |
356 |
| - options = { length: options }; |
357 |
| - } |
358 |
| - |
359 |
| - const { ellipsis = true, length = 4, parens = true } = options; |
360 |
| - |
361 |
| - let template = this.faker.string.numeric({ length }); |
362 |
| - |
363 |
| - if (ellipsis) { |
364 |
| - template = `...${template}`; |
365 |
| - } |
366 |
| - |
367 |
| - if (parens) { |
368 |
| - template = `(${template})`; |
369 |
| - } |
370 |
| - |
371 |
| - return template; |
372 |
| - } |
373 |
| - |
374 | 208 | /**
|
375 | 209 | * Generates a random amount between the given bounds (inclusive).
|
376 | 210 | *
|
|
0 commit comments