prototyped.js
Advanced tools
Comparing version 0.3.0 to 0.3.1
/** | ||
* @namespace Array | ||
*/ | ||
interface ArrayConstructor { | ||
isInstance(arg: any): boolean; | ||
range(end: number, start?: number, step?: number): Array<number>; | ||
repeat(n: number, value?: any): Array<any>; | ||
export { }; | ||
declare global { | ||
interface ArrayConstructor { | ||
isInstance(arg: any): arg is Array<any>; | ||
range(end: number, start?: number, step?: number): Array<number>; | ||
repeat(n: number, value?: any): Array<any>; | ||
} | ||
interface Array<T> { | ||
first(): T; | ||
last(): T; | ||
chunk(size: number): Array<Array<T>>; | ||
compact(): Array<T>; | ||
count(value?: T): number; | ||
countBy(fn: string | (() => any)): { | ||
[key: string]: any; | ||
}; | ||
flatten(depth?: number): Array<T>; | ||
deepFlatten(): Array<T>; | ||
diff(array: Array<T>, comp?: (a: T, b: T) => boolean): Array<T>; | ||
distinct(): Array<T>; | ||
everyNth(nth: number): Array<T>; | ||
groupBy(fn: string | (() => any)): { | ||
[key: string]: Array<T>; | ||
}; | ||
indexOfAll(value: T): Array<number>; | ||
intersect(array: Array<T>): Array<T>; | ||
partition(fn: (value: T, index: number, array: Array<T>) => boolean): Array<T>; | ||
pull(...args: Array<T>): void; | ||
sample(): T; | ||
shuffle(): Array<T>; | ||
union(array: Array<T>): Array<T>; | ||
zip(...arrays: Array<Array<any>>): Array<Array<any>>; | ||
zipObject(array: Array<T>): object; | ||
pluck(key: String): Array<T>; | ||
sum(key?: String): number; | ||
average(key?: String): number; | ||
avg(key?: String): number; | ||
max(key?: String): number; | ||
min(key?: String): number; | ||
contains(value: T): boolean; | ||
crossJoin(array: Array<any>): Array<[T, any]>; | ||
get(index: number, def?: T | any): T | any; | ||
implode(key: string, separator?: string): string; | ||
clone(): Array<T>; | ||
median(key?: string): number; | ||
pad(size: number, value?: any): Array<any>; | ||
prepend(value?: any): void; | ||
} | ||
} | ||
interface Array<T> { | ||
first(): T; | ||
last(): T; | ||
chunk(size: number): Array<Array<T>>; | ||
compact(): Array<T>; | ||
count(value?: T): number; | ||
countBy(fn: string | (() => any)): { | ||
[key: string]: Array<T>; | ||
}; | ||
flatten(depth?: number): Array<T>; | ||
deepFlatten(): Array<T>; | ||
diff(array: Array<T>, comp?: (a: T, b: T) => boolean): Array<T>; | ||
distinct(): Array<T>; | ||
everyNth(nth: number): Array<T>; | ||
groupBy(fn: string | (() => any)): { | ||
[key: string]: Array<T>; | ||
}; | ||
indexOfAll(value: T): Array<number>; | ||
intersect(array: Array<T>): Array<T>; | ||
partition(fn: (value: T, index: number, array: Array<T>) => boolean): Array<T>; | ||
pull(...args: Array<T>): void; | ||
sample(): T; | ||
shuffle(): Array<T>; | ||
union(array: Array<T>): Array<T>; | ||
zip(...arrays: Array<Array<T>>): Array<T>; | ||
zipObject(array: Array<T>): object; | ||
pluck(key: String): Array<T>; | ||
sum(key?: String): number; | ||
average(key?: String): number; | ||
avg(key?: String): number; | ||
max(key?: String): number; | ||
min(key?: String): number; | ||
contains(value: T): boolean; | ||
crossJoin(array: Array<any>): Array<Array<any>>; | ||
get(index: number, def?: T | any): T | any; | ||
implode(key: string, separator?: string): String; | ||
clone(): Array<T>; | ||
median(key?: string): number; | ||
pad(size: number, value?: any): Array<any>; | ||
prepend(value?: any): void; | ||
} | ||
export {}; |
/** | ||
* @namespace Boolean | ||
*/ | ||
interface BooleanConstructor { | ||
isInstance(arg: any): boolean; | ||
export { }; | ||
declare global { | ||
interface BooleanConstructor { | ||
isInstance(arg: any): arg is boolean; | ||
} | ||
} | ||
export {}; |
/** | ||
* @namespace Date | ||
*/ | ||
interface DateConstructor { | ||
isInstance(arg: any): boolean; | ||
export { }; | ||
declare global { | ||
interface DateConstructor { | ||
isInstance(arg: any): arg is Date; | ||
} | ||
} | ||
export {}; |
/** | ||
* @namespace Function | ||
*/ | ||
interface FunctionConstructor { | ||
isInstance(arg: any): boolean; | ||
export { }; | ||
declare global { | ||
interface FunctionConstructor { | ||
isInstance(arg: any): arg is Function; | ||
} | ||
interface Function { | ||
called?: boolean; | ||
once(...args: Array<any>): any; | ||
defer(...args: Array<any>): any; | ||
cached?: Array<{ | ||
key: string; | ||
result: any; | ||
}>; | ||
cache(...args: Array<any>): any; | ||
} | ||
} | ||
interface Function { | ||
called?: boolean; | ||
once(...args: Array<any>): any; | ||
defer(...args: Array<any>): any; | ||
cached?: Array<{ | ||
key: string; | ||
result: any; | ||
}>; | ||
cache(...args: Array<any>): any; | ||
} | ||
export {}; |
@@ -9,1 +9,2 @@ import './math'; | ||
import './function'; | ||
export { }; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("./math"),require("./date"),require("./boolean"),require("./number"),require("./string"),require("./array"),require("./object"),require("./function"); | ||
"use strict";require("./math"),require("./date"),require("./boolean"),require("./number"),require("./string"),require("./array"),require("./object"),require("./function"); |
/** | ||
* @namespace Math | ||
*/ | ||
interface Math { | ||
average(...nums: Array<number>): number; | ||
avg(...nums: Array<number>): number; | ||
factorial(n: number): number; | ||
fibonacci(nth: number): Array<number>; | ||
gcd(...nums: Array<number>): number; | ||
lcm(...nums: Array<number>): number; | ||
isEven(num: number): boolean; | ||
isPrime(num: number): boolean; | ||
export { }; | ||
declare global { | ||
interface Math { | ||
average(...nums: Array<number>): number; | ||
avg(...nums: Array<number>): number; | ||
factorial(n: number): number; | ||
fibonacci(nth: number): Array<number>; | ||
gcd(...nums: Array<number>): number; | ||
lcm(...nums: Array<number>): number; | ||
isEven(num: number): boolean; | ||
isPrime(num: number): boolean; | ||
} | ||
} | ||
export {}; |
/** | ||
* @namespace Number | ||
*/ | ||
interface NumberConstructor { | ||
isInstance(arg: any): boolean; | ||
export { }; | ||
declare global { | ||
interface NumberConstructor { | ||
isInstance(arg: any): arg is Number; | ||
} | ||
} | ||
export {}; |
/** | ||
* @namespace Object | ||
*/ | ||
interface ObjectConstructor { | ||
isInstance(arg: any): boolean; | ||
export { }; | ||
declare global { | ||
interface ObjectConstructor { | ||
isInstance(arg: any): arg is object; | ||
} | ||
interface Object { | ||
invert(): object; | ||
lowerCaseKeys(): object; | ||
map(fn: (value: any, key: string | number, object: object) => any): object; | ||
mapKeys(fn: (value: any, key: string | number, object: object) => any): object; | ||
merge(...objects: Array<object>): object; | ||
size(): number; | ||
} | ||
} | ||
interface Object { | ||
invert(): object; | ||
lowerCaseKeys(): object; | ||
map(fn: (value: any, key: string | number, object: object) => any): object; | ||
mapKeys(fn: (value: any, key: string | number, object: object) => any): object; | ||
merge(...objects: Array<object>): object; | ||
size(): number; | ||
} | ||
declare let prototypes: { | ||
[key: string]: any; | ||
}; | ||
declare const addPrototypes: (extension: { | ||
[key: string]: any; | ||
}) => void; | ||
export {}; |
/** | ||
* @namespace String | ||
*/ | ||
interface StringConstructor { | ||
isInstance(arg: any): boolean; | ||
export { }; | ||
declare global { | ||
interface StringConstructor { | ||
isInstance(arg: any): arg is string; | ||
} | ||
interface String { | ||
capitalize(allWords?: boolean): string; | ||
decapitalize(allWords?: boolean): string; | ||
mask(num?: number, mask?: string): string; | ||
pluralize(value: number, plural?: string): String; | ||
reverse(): string; | ||
lines(): Array<string>; | ||
camelCase(): string; | ||
kebabCase(): string; | ||
snakeCase(): string; | ||
truncate(num: number): String; | ||
words(pattern?: RegExp): Array<string>; | ||
} | ||
} | ||
interface String { | ||
capitalize(allWords?: boolean): string; | ||
decapitalize(allWords?: boolean): string; | ||
mask(num?: number, mask?: string): string; | ||
pluralize(value: number, plural?: string): String; | ||
reverse(): string; | ||
lines(): Array<string>; | ||
camelCase(): string; | ||
kebabCase(): string; | ||
snakeCase(): string; | ||
truncate(num: number): String; | ||
words(pattern?: RegExp): Array<string>; | ||
} | ||
export {}; |
104
package.json
{ | ||
"name": "prototyped.js", | ||
"version": "0.3.0", | ||
"description": "Some common prototypes", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"doc": "tsc && jsdoc2md dist/*.js --example-lang javascript > API.md", | ||
"build": "node ./scripts/build.js", | ||
"prepare": "npm run build && npm test", | ||
"test": "jest" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"version": "0.3.1", | ||
"description": "Some common typescript ready prototypes available in both es6 and es5", | ||
"author": "Ardalan Amini <ardalanamini22@gmail.com>", | ||
"license": "MIT", | ||
"homepage": "https://github.com/ardalanamini/prototyped.js#readme", | ||
"repository": { | ||
@@ -19,20 +12,84 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ardalanamini/prototyped.js/issues" | ||
}, | ||
"keywords": [ | ||
"server", | ||
"client", | ||
"side", | ||
"server-side", | ||
"client-side", | ||
"common", | ||
"prototype", | ||
"array", | ||
"isInstance", | ||
"range", | ||
"repeat", | ||
"avg", | ||
"first", | ||
"last", | ||
"chunk", | ||
"compact", | ||
"count", | ||
"countBy", | ||
"flatten", | ||
"deepFlatten", | ||
"diff", | ||
"distinct", | ||
"everyNth", | ||
"groupBy", | ||
"indexOfAll", | ||
"intersect", | ||
"partition", | ||
"pull", | ||
"sample", | ||
"shuffle", | ||
"union", | ||
"zip", | ||
"zipObject", | ||
"pluck", | ||
"sum", | ||
"average", | ||
"max", | ||
"min", | ||
"contains", | ||
"crossJoin", | ||
"get", | ||
"implode", | ||
"clone", | ||
"median", | ||
"pad", | ||
"prepend", | ||
"boolean", | ||
"date", | ||
"function", | ||
"once", | ||
"defer", | ||
"cache", | ||
"string", | ||
"object" | ||
"math", | ||
"factorial", | ||
"fibonacci", | ||
"gcd", | ||
"lcm", | ||
"isEven", | ||
"isPrime", | ||
"number", | ||
"object", | ||
"invert", | ||
"lowerCaseKeys", | ||
"map", | ||
"mapKeys", | ||
"mergeKeys", | ||
"merge", | ||
"size" | ||
], | ||
"author": "Ardalan Amini <ardalanamini22@gmail.com>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/ardalanamini/prototyped.js/issues" | ||
"main": "dist/index.js", | ||
"files": [ | ||
"dist", | ||
"es6" | ||
], | ||
"scripts": { | ||
"doc": "tsc && jsdoc2md es6/*.js --example-lang javascript > API.md", | ||
"build": "node scripts/build.js", | ||
"prepare": "npm run build && npm test", | ||
"test": "jest" | ||
}, | ||
"homepage": "https://github.com/ardalanamini/prototyped.js#readme", | ||
"devDependencies": { | ||
@@ -43,8 +100,9 @@ "@types/node": "^9.3.0", | ||
"fs-readdir-recursive": "^1.1.0", | ||
"jest": "^22.1.1", | ||
"jest": "^22.1.4", | ||
"jsdoc-to-markdown": "^3.0.4", | ||
"rimraf": "^2.6.2", | ||
"typescript": "^2.6.2", | ||
"uglify-js": "^3.3.7" | ||
"uglify-es": "^3.3.8", | ||
"uglify-js": "^3.3.8" | ||
} | ||
} |
# prototyped.js | ||
Some common **Typescript ready** prototypes | ||
Some common **Typescript ready** prototypes available in both es6 and es5 | ||
@@ -20,6 +20,11 @@ [![npm](https://img.shields.io/npm/v/prototyped.js.svg)](https://www.npmjs.com/package/prototyped.js) | ||
```javascript | ||
// es5 (default) | ||
require('prototyped.js'); | ||
import 'prototyped.js'; | ||
// es6 | ||
require('prototyped.js/es6'); | ||
import 'prototyped.js/es6'; | ||
``` | ||
All documents are available at [API.md](https://github.com/ardalanamini/prototyped.js/blob/master/API.md) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
36528
40
340
30
10
3
1