Skip to content

Commit 5e46798

Browse files
author
Marco Solazzi
committed
build
1 parent 665a759 commit 5e46798

File tree

8 files changed

+108
-130
lines changed

8 files changed

+108
-130
lines changed

dist/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ var _lodash = require('lodash.isplainobject');
66

77
var _lodash2 = _interopRequireDefault(_lodash);
88

9-
var _objectAssign = require('object-assign');
10-
11-
var _objectAssign2 = _interopRequireDefault(_objectAssign);
12-
139
var _utils = require('./utils');
1410

1511
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -245,10 +241,9 @@ var VuePropTypes = {
245241

246242
Object.defineProperty(type, 'loose', {
247243
get: function get() {
248-
var t = (0, _objectAssign2.default)({ isLoose: true }, this);
249-
(0, _utils.withRequired)(t);
250-
(0, _utils.withDefault)(t);
251-
return t;
244+
this.isLoose = true;
245+
this.validator = this.validator.bind(this);
246+
return this;
252247
},
253248

254249
enumerable: false

dist/utils.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ var withRequired = exports.withRequired = function withRequired(type) {
132132
var toType = exports.toType = function toType(obj) {
133133
withRequired(obj);
134134
withDefault(obj);
135-
if (obj.validator && isFunction(obj.validator)) {
136-
obj.validator = obj.validator.bind(obj);
137-
}
138135
return obj;
139136
};
140137

es/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import isPlainObject from 'lodash.isplainobject';
2-
import objectAssign from 'object-assign';
3-
import { noop, toType, getType, withDefault, withRequired, isFunction, validateType, isInteger, isArray, warn } from './utils';
2+
import { noop, toType, getType, isFunction, validateType, isInteger, isArray, warn } from './utils';
43

54
var VuePropTypes = {
65

@@ -233,10 +232,9 @@ var VuePropTypes = {
233232

234233
Object.defineProperty(type, 'loose', {
235234
get: function get() {
236-
var t = objectAssign({ isLoose: true }, this);
237-
withRequired(t);
238-
withDefault(t);
239-
return t;
235+
this.isLoose = true;
236+
this.validator = this.validator.bind(this);
237+
return this;
240238
},
241239

242240
enumerable: false

es/utils.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ export var withRequired = function withRequired(type) {
120120
export var toType = function toType(obj) {
121121
withRequired(obj);
122122
withDefault(obj);
123-
if (obj.validator && isFunction(obj.validator)) {
124-
obj.validator = obj.validator.bind(obj);
125-
}
126123
return obj;
127124
};
128125

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"umd"
1515
],
1616
"scripts": {
17-
"prepublishOnly": "build",
17+
"prepublishOnly": "npm run build",
1818
"build": "npm run lint && npm test && npm run build:cjs && npm run build:es && npm run build:umd && npm run build:min",
1919
"build:cjs": "rimraf dist && cross-env BABEL_ENV=cjs babel ./src -d dist",
2020
"build:es": "rimraf es && cross-env BABEL_ENV=es babel ./src -d es",

src/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import isPlainObject from 'lodash.isplainobject'
2-
import objectAssign from 'object-assign'
3-
import { noop, toType, getType, withDefault, withRequired, isFunction, validateType, isInteger, isArray, warn } from './utils'
2+
import { noop, toType, getType, isFunction, validateType, isInteger, isArray, warn } from './utils'
43

54
const VuePropTypes = {
65

umd/vue-types.js

Lines changed: 98 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-types v0.6.2
2+
* vue-types v0.6.4
33
* Copyright (c) 2016 Marco Solazzi
44
* MIT License
55
*/
@@ -227,96 +227,6 @@ module.exports = isPlainObject;
227227

228228
/***/ },
229229
/* 1 */
230-
/***/ function(module, exports) {
231-
232-
"use strict";
233-
'use strict';
234-
/* eslint-disable no-unused-vars */
235-
var hasOwnProperty = Object.prototype.hasOwnProperty;
236-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
237-
238-
function toObject(val) {
239-
if (val === null || val === undefined) {
240-
throw new TypeError('Object.assign cannot be called with null or undefined');
241-
}
242-
243-
return Object(val);
244-
}
245-
246-
function shouldUseNative() {
247-
try {
248-
if (!Object.assign) {
249-
return false;
250-
}
251-
252-
// Detect buggy property enumeration order in older V8 versions.
253-
254-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
255-
var test1 = new String('abc'); // eslint-disable-line
256-
test1[5] = 'de';
257-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
258-
return false;
259-
}
260-
261-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
262-
var test2 = {};
263-
for (var i = 0; i < 10; i++) {
264-
test2['_' + String.fromCharCode(i)] = i;
265-
}
266-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
267-
return test2[n];
268-
});
269-
if (order2.join('') !== '0123456789') {
270-
return false;
271-
}
272-
273-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
274-
var test3 = {};
275-
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
276-
test3[letter] = letter;
277-
});
278-
if (Object.keys(Object.assign({}, test3)).join('') !==
279-
'abcdefghijklmnopqrst') {
280-
return false;
281-
}
282-
283-
return true;
284-
} catch (e) {
285-
// We don't expect any of the above to throw, but better to be safe.
286-
return false;
287-
}
288-
}
289-
290-
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
291-
var from;
292-
var to = toObject(target);
293-
var symbols;
294-
295-
for (var s = 1; s < arguments.length; s++) {
296-
from = Object(arguments[s]);
297-
298-
for (var key in from) {
299-
if (hasOwnProperty.call(from, key)) {
300-
to[key] = from[key];
301-
}
302-
}
303-
304-
if (Object.getOwnPropertySymbols) {
305-
symbols = Object.getOwnPropertySymbols(from);
306-
for (var i = 0; i < symbols.length; i++) {
307-
if (propIsEnumerable.call(from, symbols[i])) {
308-
to[symbols[i]] = from[symbols[i]];
309-
}
310-
}
311-
}
312-
}
313-
314-
return to;
315-
};
316-
317-
318-
/***/ },
319-
/* 2 */
320230
/***/ function(module, exports, __webpack_require__) {
321231

322232
"use strict";
@@ -328,11 +238,7 @@ var _lodash = __webpack_require__(0);
328238

329239
var _lodash2 = _interopRequireDefault(_lodash);
330240

331-
var _objectAssign = __webpack_require__(1);
332-
333-
var _objectAssign2 = _interopRequireDefault(_objectAssign);
334-
335-
var _utils = __webpack_require__(3);
241+
var _utils = __webpack_require__(2);
336242

337243
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
338244

@@ -567,10 +473,9 @@ var VuePropTypes = {
567473

568474
Object.defineProperty(type, 'loose', {
569475
get: function get() {
570-
var t = (0, _objectAssign2.default)({ isLoose: true }, this);
571-
(0, _utils.withRequired)(t);
572-
(0, _utils.withDefault)(t);
573-
return t;
476+
this.isLoose = true;
477+
this.validator = this.validator.bind(this);
478+
return this;
574479
},
575480

576481
enumerable: false
@@ -584,7 +489,7 @@ exports.default = VuePropTypes;
584489
module.exports = exports['default'];
585490

586491
/***/ },
587-
/* 3 */
492+
/* 2 */
588493
/***/ function(module, exports, __webpack_require__) {
589494

590495
"use strict";
@@ -597,7 +502,7 @@ var _lodash = __webpack_require__(0);
597502

598503
var _lodash2 = _interopRequireDefault(_lodash);
599504

600-
var _objectAssign = __webpack_require__(1);
505+
var _objectAssign = __webpack_require__(3);
601506

602507
var _objectAssign2 = _interopRequireDefault(_objectAssign);
603508

@@ -722,9 +627,6 @@ var withRequired = exports.withRequired = function withRequired(type) {
722627
var toType = exports.toType = function toType(obj) {
723628
withRequired(obj);
724629
withDefault(obj);
725-
if (obj.validator && isFunction(obj.validator)) {
726-
obj.validator = obj.validator.bind(obj);
727-
}
728630
return obj;
729631
};
730632

@@ -797,11 +699,101 @@ if (true) {
797699

798700
exports.warn = warn;
799701

702+
/***/ },
703+
/* 3 */
704+
/***/ function(module, exports) {
705+
706+
"use strict";
707+
'use strict';
708+
/* eslint-disable no-unused-vars */
709+
var hasOwnProperty = Object.prototype.hasOwnProperty;
710+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
711+
712+
function toObject(val) {
713+
if (val === null || val === undefined) {
714+
throw new TypeError('Object.assign cannot be called with null or undefined');
715+
}
716+
717+
return Object(val);
718+
}
719+
720+
function shouldUseNative() {
721+
try {
722+
if (!Object.assign) {
723+
return false;
724+
}
725+
726+
// Detect buggy property enumeration order in older V8 versions.
727+
728+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
729+
var test1 = new String('abc'); // eslint-disable-line
730+
test1[5] = 'de';
731+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
732+
return false;
733+
}
734+
735+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
736+
var test2 = {};
737+
for (var i = 0; i < 10; i++) {
738+
test2['_' + String.fromCharCode(i)] = i;
739+
}
740+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
741+
return test2[n];
742+
});
743+
if (order2.join('') !== '0123456789') {
744+
return false;
745+
}
746+
747+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
748+
var test3 = {};
749+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
750+
test3[letter] = letter;
751+
});
752+
if (Object.keys(Object.assign({}, test3)).join('') !==
753+
'abcdefghijklmnopqrst') {
754+
return false;
755+
}
756+
757+
return true;
758+
} catch (e) {
759+
// We don't expect any of the above to throw, but better to be safe.
760+
return false;
761+
}
762+
}
763+
764+
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
765+
var from;
766+
var to = toObject(target);
767+
var symbols;
768+
769+
for (var s = 1; s < arguments.length; s++) {
770+
from = Object(arguments[s]);
771+
772+
for (var key in from) {
773+
if (hasOwnProperty.call(from, key)) {
774+
to[key] = from[key];
775+
}
776+
}
777+
778+
if (Object.getOwnPropertySymbols) {
779+
symbols = Object.getOwnPropertySymbols(from);
780+
for (var i = 0; i < symbols.length; i++) {
781+
if (propIsEnumerable.call(from, symbols[i])) {
782+
to[symbols[i]] = from[symbols[i]];
783+
}
784+
}
785+
}
786+
}
787+
788+
return to;
789+
};
790+
791+
800792
/***/ },
801793
/* 4 */
802794
/***/ function(module, exports, __webpack_require__) {
803795

804-
module.exports = __webpack_require__(2);
796+
module.exports = __webpack_require__(1);
805797

806798

807799
/***/ }

0 commit comments

Comments
 (0)