Supercharge your Javascript!



full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/average.js#L13
# average ≥ 0.1.0

Return the average of all the number elements.


Returns

Number

No options available.
[1, 2, 3].average() // 6
{a: 1, b: 2, c: 3}.average() // 6
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/ellipsis.js#L17
# ellipsis ≥ 0.1.0

Cap a string by a max character length and an ellipsis character.


Returns

String

Type Name Default Description
Integer options.max 0 maximum of character until it should append an ellipsis
String otpions.end "..." ellipsis character to display if the max character is reached
"hello world".ellipsis({ max: 5 }) // "hello.."
"hello universe".ellipsis({ max: 5, end: '!' }) // "hello!"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/empty.js#L17
# empty ≥ 0.1.0

Returns true if the element is empty, else returns false.


Returns

Boolean

No options available.
{}.empty() // true
[].empty() // true
''.empty() // true
(0).empty() // true
new Regexp('').empty() // true
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/flatten.js#L14
# flatten ≥ 0.1.0

Returns a one dimensional array containing all the values of the element.


Returns

Array

No options available.
{a: 1, b: 2, c: 3}.flatten() // [1, 2, 3]
[1, {a: 2, b: 3}].flatten() // [1, 2, 3]
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/format.js#L13
# format ≥ 0.1.0

Return the formated element.


Returns

String

No options available.
"Hi {name}".format({ name: "John" }) // "Hi John"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/has-letter.js#L14
# hasLetter ≥ 0.1.0

Returns true if the element contains letters.


Returns

Boolean

No options available.
'hello world'.hasLetters() // true
'42 - 7 = ??'.hasLetter() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/has-lowercase.js#L14
# hasLowercase ≥ 0.1.0

Returns true if the element contains a lowercase.


Returns

Boolean

No options available.
'Hello'.hasLowercase() // true
'HELLO'.hasLowercase() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/has-math-sign.js#L14
# hasMathSign ≥ 0.1.0

Returns true if the element contains mathematical signs.


Returns

Boolean

No options available.
'42 + 7'.hasMathSign() // true
'hello world'.hasMathSign() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/has-number.js#L14
# hasNumber ≥ 0.1.0

Returns true if the element has a number.


Returns

Boolean

No options available.
'42'.hasNumber() // true
'hello world'.hasNumber() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/has-uppercase.js#L14
# hasUppercase ≥ 0.1.0

Returns true if the element contains an uppercase.


Returns

Boolean

No options available.
'Hello'.hasUppercase() // true
'hello'.hasUppercase() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-array.js#L14
# isArray ≥ 0.1.0

Return true if the element is an array.


Returns

Boolean

No options available.
new Date().isArray() // false
[].isArray() // true
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-boolean.js#L14
# isBoolean ≥ 0.1.0

Returns true if the element is a boolean, else returns false.


Returns

Boolean

No options available.
(true).isBoolean() // true
(1).isBoolean() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-date.js#L14
# isDate ≥ 0.1.0

Returns true if the variable is a date, else returns false.


Returns

Boolean

No options available.
new Date('2018-01-01').isDate() // true
'2018-01-01'.isDate() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-lowercase.js#L14
# isLowercase ≥ 0.1.0

Returns true if the string is only composed of lowercases.


Returns

Boolean

No options available.
'hello'.isLowercase() // true
'HELLO'.isLowercase() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-number.js#L14
# isNumber ≥ 0.1.0

Return true if the element is a number, else returns false.


Returns

Boolean

No options available.
Number(42).isNumber() // true
[42].isNumber() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-object.js#L14
# isObject ≥ 0.1.0

Returns true if the element is an object, else returns false.


Returns

Boolean

No options available.
{}.isObject() // true
[].isObject() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-regexp.js#L14
# isRegexp ≥ 0.1.0

Returns true if the element is a RegExp, else returns false.


Returns

Boolean

No options available.
/[a-z]/.isRegexp() // true
'/[a-z]/'.isRegexp() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-string.js#L14
# isString ≥ 0.1.0

Returns true if the element is a string, else returns false.


Returns

Boolean

No options available.
"hello".isString() // true
["hello"].isString() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-uppercase.js#L14
# isUppercase ≥ 0.1.0

Returns true if the element is only composed of uppercases.


Returns

Boolean

No options available.
"HELLO".isUppercase() // true
"Hello".isUppercase() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-valid-date.js#L16
# isValidDate ≥ 0.1.0

Returns true if the element is a valid date, else returns false.


Returns

Boolean

No options available.
'2018-01-01'.isValidDate() // true
new Date('2018-01-01').isValidDate() // true
'test'.isValidDate() // false
new Date('test').isValidDate() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is-valid-number.js#L15
# isValidNumber ≥ 0.1.0

Returns true if the number is valid, else returns false.


Returns

Boolean

No options available.
(42).isValidNumber() // true
Number('test').isValidNumber() // false
"test".isValidNumber() // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/is.js#L15
# is ≥ 0.1.0

Check if the element is of the desired type.


Returns

Boolean

Type Name Default Description
* options.type type to check the element on
([1, 2]).is({ type: Array }) // true
([1, 2]).is({ type: Boolean }) // false
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/json.js#L13
# json ≥ 0.1.0

Returns the string representation of the variable turned into JSON


Returns

String

No options available.
{name: "John"}.json() // {"name": "John"}
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/keys.js#L14
# keys ≥ 0.1.0

Returns an array containing the keys of the element.


Returns

Array

No options available.
({a: 1, b: 2}).keys() // ['a', 'b']
({}).keys() // []
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/last.js#L15
# last ≥ 0.1.0

Returns the last element of the variable


Returns

*

No options available.
[1, 2, 3].last() // 3
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/log.js#L15
# log ≥ 0.1.0

Prompt to the console the element and returns the element.


Returns

*

No options available.
"hello".log()
[1, 2].log()
[1, 2].log().average() // chainable
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/map.js#L14
# map ≥ 0.1.0

Execute a function for each key-pairs.


Returns

undefined

Type Name Default Description
requestCallback callback function to apply for each key-pairs
{a: 1, b: 2, c: 3}.map(myFunction())
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/nl2br.js#L14
# nl2br ≥ 0.1.0

Turns any line return into HTML line return


Returns

*

Type Name Default Description
Boolean options.strict false when set to true, it will output strict HTML tag
"hello\r\nworld".nl2br() // "hello
world"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/only.js#L18
# only ≥ 0.1.0

Returns only the element you want from an array of keys.


Returns

*

Type Name Default Description
Array search array of keys (or values for an array) to filter with
['js', 'php', 'node'].only(['js', 'node']) // ['js', 'node']
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/parse-csv.js#L15
# parseCsv ≥ 0.1.0

Returns an array representing the CSV of the element.


Returns

Array

Type Name Default Description
String options.delimitedBy ',' character separating the cells
String options.quotedBy '"' quote character in case a cell contains any delimitedBy character
"Name,Age\nJohn,25".parseCsv() // [['Name', 'Age'],['John', '25]]
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/parse-date.js#L13
# parseDate ≥ 0.1.0

Returns a new date from the element.


Returns

Date

No options available.
'2018-01-01'.parseDate() // new Date('2018-01-01)
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/parse-int.js#L13
# parseInt ≥ 0.1.0

Parse the element and returns its integer counterpart.


Returns

Integer

No options available.
"42".parseInt() // 42
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/pass.js#L15
# pass ≥ 0.1.0

Returns true if the element passes the regexp check.


Returns

Boolean

Type Name Default Description
RegExp options.regexp /(?:)/ regular expression to test
"hello".pass(/[a-z]/g) // true
Number(34).pass(/^[3]/) // true
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/query-strings.js#L13
# queryStrings ≥ 0.1.0

Returns an object of the query string from the element.


Returns

Object

No options available.
'http://example.com/path/to/page?name=ferret&color=purple'.queryStrings() // { name: 'ferret', color: 'purple' }
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/shuffle.js#L14
# shuffle ≥ 0.1.0

Disorder the elements randomly.


Returns

*

No options available.
[1, 2, 3].shuffle() // [3, 1, 2]
"hello world".shuffle() // "lohel"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/sum.js#L13
# sum ≥ 0.1.0

Returns the sum of the elements.


Returns

Number

No options available.
[1, 2, 3].sum() // 6
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/to-camel-case.js#L13
# toCamelCase ≥ 0.1.0

Return the camel case version of the element.


Returns

String

No options available.
'hello world'.toCamelCase() // "helloWorld"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/to-csv.js#L15
# toCsv ≥ 0.1.0

Returns the CSV string representation of the element.


Returns

String

Type Name Default Description
String options.delimitedBy ',' string delimiter between cells
String options.quotedBy '"' character to add in case the delimitedBy is present in the cell
[['John', '25']].toCsv() // "John,25"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/to-kebab-case.js#L13
# toKebabCase ≥ 0.1.0

Returns the kebab-case version of the string.


Returns

String

No options available.
'hello world'.toKebabCase() // 'hello-world'
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/to-query-strings.js#L13
# toQueryStrings ≥ 0.1.0

Return a query string as a string from the element.


Returns

String

No options available.
({name: 'John', age: 21}).toQueryStrings() // name=John&age=21
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/to-separated.js#L15
# toSeparated ≥ 0.1.0

Separate the items relative to a separator and returns the separated string.


Returns

String

No options available.
['php', 'js', 'mysql'].toSeparated() // "php,js,mysql"
['php', 'js', 'mysql'].toSeparated({ separator: ', ' }) // "php, js, mysql"
['php', 'js', 'mysql'].toSeparated({ separator: ', ', finisher: ' and ' }) // "php, js and mysql"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/to-snake-case.js#L13
# toSnakeCase ≥ 0.1.0

Returns the string in snake_case format.


Returns

String

No options available.
'hello world'.toSnakeCase() // "hello_world"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/to-timestamp.js#L13
# toTimestamp ≥ 0.1.0

Return the timestamp from the element.


Returns

Integer

No options available.
new Date('2018-01-01T00:00:00+00:00').toTimestamp() // 1514764800
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/type.js#L14
# type ≥ 0.1.0

Returns the type of the element.


Returns

*

No options available.
[1, 2].type() // Array
[1, 2].type({ toString: true }) // "array"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/update.js#L15
# update ≥ 0.1.0

Update the values of the elements according to an object.


Returns

*

No options available.
({a: 1, b: 2}).update({ a: 3 }) // {a: 3, b: 2}
[1, 2, 3].update({ 0: 4 }) // [4, 2, 3]
"hello".update({ 0: 'y' }) // "yello"
full solution
javascript
web
https://github.com/stellar-labs/prototype-storm/blob/master/src/js/values.js#L14
# values ≥ 0.1.0

Returns an array of the values of the element.


Returns

Array

No options available.
({a: 1, b: 2}).values() // [1, 2]
({}).values() // []