Skip to content

Commit 38c58f1

Browse files
committed
some updates
1 parent 065629c commit 38c58f1

File tree

7 files changed

+13
-16
lines changed

7 files changed

+13
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-spec",
3-
"version": "0.1.74",
3+
"version": "0.1.76",
44
"license": "LGPL-3.0",
55
"homepage": "https://github.com/js-works/js-spec",
66
"main": "index.js",

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function createConfig(pkg, moduleFormat, productive) {
4343
file,
4444
format: moduleFormat,
4545
name: pkg === 'core' ? 'jsSpec' : 'jsSpec.validators',
46-
sourcemap: productive ? false : 'inline',
46+
sourcemap: false,
4747

4848
globals: {
4949
'js-spec': 'jsSpec',

src/main/api/validators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export function instanceOf(type: Function): SpecValidator {
317317
: 'Must be instance of ' + type.name)
318318
}
319319

320-
export function extending(type: Function): SpecValidator {
320+
export function subclassOf(type: Function): SpecValidator {
321321
if (typeof type !== 'function') {
322322
throw new Error(
323323
"[extends] First paramter 'type' must be a function")

src/main/js-spec.validators.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './api/validators'

src/test/api/validators.test.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ describe('Validator: string', () => {
177177
})
178178
})
179179

180-
describe('Validator: function', () => {
180+
describe('Validator: func', () => {
181181
runSimpleSpecTest({
182182
spec: Spec.func,
183183
validValues: [() => {}, Object, Array, Date],
@@ -370,23 +370,17 @@ describe('Validator: instanceOf', () => {
370370
})
371371
})
372372

373-
describe('Validator: extends', () => {
373+
describe('Validator: subclassOf', () => {
374374
const
375375
A = class {},
376376
B = class extends A {},
377377
C = class {}
378378

379379
runSimpleSpecTest({
380-
spec: Spec.extending(A),
380+
spec: Spec.subclassOf(A),
381381
validValues: [A, B],
382382
invalidValues: [true, 42, '', C]
383383
})
384-
385-
runSimpleSpecTest({
386-
spec: Spec.instanceOf(Date),
387-
validValues: [new Date, new Date('1945-05-08')],
388-
invalidValues: [true, 42, '', '0', 'some text']
389-
})
390384
})
391385

392386
describe('Validator: arrayOf', () => {
@@ -596,15 +590,15 @@ describe('Validator: when (using SpecValidator as first argument)', () => {
596590
})
597591
})
598592

599-
describe('Validator: in', () => {
593+
describe('Validator: isIn', () => {
600594
runSimpleSpecTest({
601595
spec: Spec.isIn(new Set([1, 2, 3, 4, 5])),
602596
validValues: [1, 2, 3, 4, 5],
603597
invalidValues: [undefined, null, true, false, '1', '2', [], {}]
604598
})
605599
})
606600

607-
describe('Validator: notIn', () => {
601+
describe('Validator: isNotIn', () => {
608602
runSimpleSpecTest({
609603
spec: Spec.isNotIn(new Set([1, 2, 3, 4, 5])),
610604
validValues: [undefined, null, true, false, '1', '2', [], {}],

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
]
1616
},
1717
"files": [
18-
"src/main/js-spec.ts"
18+
"src/main/js-spec.ts",
19+
"src/main/js-spec.validators.ts"
1920
]
2021
}

validators/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "js-spec_validators",
33
"main": "./index.js",
4-
"types": "../dist/types/js-spec.d.ts"
4+
"module": "../dist/js-spec.esm.production.js",
5+
"types": "../dist/types/api/js-spec.validators.d.ts"
56
}

0 commit comments

Comments
 (0)