UNPKG

4.18 kBPlain TextView Raw
1{"code":"function defineName$__(cls,name){\n\tObject.defineProperty(cls,\"name\",{value:name,configurable:true});\n};;\nfunction extend$__(target,ext){\n\t// @ts-ignore\n\tconst descriptors = Object.getOwnPropertyDescriptors(ext);\n\tdelete descriptors.constructor;\n\tif(target.extend__ instanceof Function){\n\t\ttarget.extend__(descriptors,ext);\n\t} else {\n\t\t// @ts-ignore\n\t\tObject.defineProperties(target,descriptors);\n\t}\n\treturn target;\n};\n\n/*body*/\nimport 'imba/colors';\nimport 'imba/std';\n\nglobalThis.LL = function() {\n\t\n\tif (process.env.DEBUG || process.env.CI) {\n\t\t\n\t\treturn console.log(...arguments);\n\t};\n};\n\nconst PluralRules = {};\n\n// @ts-ignore\nObject.isPlain = function(val) {\n\t\n\treturn typeof val == 'object' && val && Object.getPrototypeOf(val) == Object.prototype;\n};\n\nclass ΩString {\n\t\n\t\n\tpluralize(num = ''){\n\t\t\n\t\tlet str = PluralRules[this] ||= (this + 's').replace(/ss$/,'s').replace(/ys$/,'ies');\n\t\treturn str;\n\t}\n\t\n\ttableize(){\n\t\t\n\t\treturn this.pluralize().toLowerCase();\n\t}\n\t\n\thumanize(){\n\t\t\n\t\tlet str = this;\n\t\tstr = str.replace(/\\$/g,'').replace('___','...');\n\t\tstr = str.replace(/(_|^|Ξ)(\\w)/gu,function(m,s,l) { return (s ? ' ' : '') + l.toUpperCase(); });\n\t\tstr = str.replace(/\\s(in|to|for|is|and|or)\\s/gi,function(_0) { return _0.toLowerCase(); });\n\t\treturn str;\n\t}\n\tstatic {\n\t\tdefineName$__(this,'String');}\n};\nextend$__(String.prototype,ΩString.prototype);\n;\n\nclass ΩNumber {\n\t\n\t\n\trandomize(delta = this){\n\t\t\n\t\treturn this + (Math.random() * delta * 2 - delta).round();\n\t}\n\tstatic {\n\t\tdefineName$__(this,'Number');}\n};\nextend$__(Number.prototype,ΩNumber.prototype);\n;\n","map":{"version":3,"file":"std.js","sourceRoot":"","sources":["/Users/abdellah/workspace/scrimba/op/src/std.imba"],"sourcesContent":["import 'imba/colors'\nimport 'imba/std'\n\nglobal.LL = do\n\tif process.env.DEBUG or process.env.CI\n\t\tconsole.log(...$0)\n\nconst PluralRules = {}\n\n# @ts-ignore\nObject.isPlain = do(val)\n\ttypeof val == 'object' and val and Object.getPrototypeOf(val) == Object.prototype\n\nextend class String\n\n\tdef pluralize num = ''\n\t\tlet str = PluralRules[self] ||= (self + 's').replace(/ss$/,'s').replace(/ys$/,'ies')\n\t\treturn str\n\n\tdef tableize\n\t\tpluralize!.toLowerCase!\n\n\tdef humanize\n\t\tlet str = self\n\t\tstr = str.replace(/\\$/g,'').replace('___','...')\n\t\tstr = str.replace(/(_|^|Ξ)(\\w)/gu) do(m,s,l) (s ? ' ' : '') + l.toUpperCase!\n\t\tstr = str.replace(/\\s(in|to|for|is|and|or)\\s/gi) do $1.toLowerCase!\n\t\treturn str\n\nextend class Number\n\n\tdef randomize delta = this\n\t\tthis + (Math.random! * delta * 2 - delta).round!\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAM,CAAC,aAAa;AACpB,MAAM,CAAC,UAAU;;AAEjB,UAAM,CAAC,EAAE,GAAG,QAAE,GAAA;;CACb,EAAE,EAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAA;;EACrC,OAAA,OAAO,CAAC,GAAG,IAAI,SAAE,CAAC;EAAA;CAAA;;MAEd,WAAW,GAAG,EAAE;;;AAGtB,MAAM,CAAC,OAAO,GAAG,QAAE,CAAC,GAAG,EAAC;;CACvB,OAAA,OAAO,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAG,CAAC,GAAG,CAAC,EAAG,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS;CAAA;;AAE3E,KAAK,CAAC,OAAM,EAAA;;;CAEd,SAAS,CAAC,GAAG,GAA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