ms/packages/ployfill/src/es5-ext.ts
MiaoWoo d1b6a4d4b2 feat: add core-js
Signed-off-by: MiaoWoo <admin@yumc.pw>
2020-02-09 22:06:45 +08:00

27 lines
771 B
TypeScript

// ES2015 String ployfill must force overwrite to js method
Object.defineProperty(String.prototype, 'contains', {
value: require(`es5-ext/string/#/contains/shim`),
configurable: true,
enumerable: false,
writable: true
})
Object.defineProperty(String.prototype, 'repeat', {
value: require(`es5-ext/string/#/repeat/shim`),
configurable: true,
enumerable: false,
writable: true
})
Object.defineProperty(String.prototype, 'startsWith', {
value: require(`es5-ext/string/#/starts-with/shim`),
configurable: true,
enumerable: false,
writable: true
})
Object.defineProperty(String.prototype, 'endsWith', {
value: require(`es5-ext/string/#/ends-with/shim`),
configurable: true,
enumerable: false,
writable: true
})