/
home
/
infinitibizsol
/
.trash
/
node_modules.3
/
class-validator
/
esm5
/
decorator
/
array
/
File Upload :
llllll
Current File: /home/infinitibizsol/.trash/node_modules.3/class-validator/esm5/decorator/array/ArrayUnique.js.map
{"version":3,"file":"ArrayUnique.js","sourceRoot":"","sources":["../../../../src/decorator/array/ArrayUnique.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,CAAC,IAAM,YAAY,GAAG,aAAa,CAAC;AAG1C;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB,EAAE,UAAkC;IAC9E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAA/B,CAA+B,CAAC,CAAC;IAC1D,CAAC;IAED,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,UAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAlB,CAAkB,CAAC,CAAC;IAClE,OAAO,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,mBAAkE,EAClE,iBAAqC;IAErC,IAAM,UAAU,GAAG,OAAO,mBAAmB,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/F,IAAM,OAAO,GAAG,OAAO,mBAAmB,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEpG,OAAO,UAAU,CACf;QACE,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE;YACT,QAAQ,EAAE,UAAC,KAAK,EAAE,IAAI,IAAc,OAAA,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,EAA9B,CAA8B;YAClE,cAAc,EAAE,YAAY,CAAC,UAAA,UAAU,IAAI,OAAA,UAAU,GAAG,yCAAyC,EAAtD,CAAsD,EAAE,OAAO,CAAC;SAC5G;KACF,EACD,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { ValidationOptions } from '../ValidationOptions';\nimport { buildMessage, ValidateBy } from '../common/ValidateBy';\n\nexport const ARRAY_UNIQUE = 'arrayUnique';\nexport type ArrayUniqueIdentifier<T = any> = (o: T) => any;\n\n/**\n * Checks if all array's values are unique. Comparison for objects is reference-based.\n * If null or undefined is given then this function returns false.\n */\nexport function arrayUnique(array: unknown[], identifier?: ArrayUniqueIdentifier): boolean {\n if (!Array.isArray(array)) return false;\n\n if (identifier) {\n array = array.map(o => (o != null ? identifier(o) : o));\n }\n\n const uniqueItems = array.filter((a, b, c) => c.indexOf(a) === b);\n return array.length === uniqueItems.length;\n}\n\n/**\n * Checks if all array's values are unique. Comparison for objects is reference-based.\n * If null or undefined is given then this function returns false.\n */\nexport function ArrayUnique<T = any>(\n identifierOrOptions?: ArrayUniqueIdentifier<T> | ValidationOptions,\n validationOptions?: ValidationOptions\n): PropertyDecorator {\n const identifier = typeof identifierOrOptions === 'function' ? identifierOrOptions : undefined;\n const options = typeof identifierOrOptions !== 'function' ? identifierOrOptions : validationOptions;\n\n return ValidateBy(\n {\n name: ARRAY_UNIQUE,\n validator: {\n validate: (value, args): boolean => arrayUnique(value, identifier),\n defaultMessage: buildMessage(eachPrefix => eachPrefix + \"All $property's elements must be unique\", options),\n },\n },\n options\n );\n}\n"]}
Copyright ©2k19 -
Hexid
|
Tex7ure