{"id":17726703,"url":"https://github.com/sergeysova/nonstandard.js","last_synced_at":"2026-06-09T16:02:55.086Z","repository":{"id":57312050,"uuid":"46584761","full_name":"sergeysova/nonstandard.js","owner":"sergeysova","description":"Non standard JavaScript features","archived":false,"fork":false,"pushed_at":"2016-05-01T11:27:40.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-07T02:13:01.270Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nonstandard","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sergeysova.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-20T20:22:09.000Z","updated_at":"2020-05-07T21:46:13.000Z","dependencies_parsed_at":"2022-09-16T02:51:22.338Z","dependency_job_id":null,"html_url":"https://github.com/sergeysova/nonstandard.js","commit_stats":null,"previous_names":["lestad/nonstandard.js"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/sergeysova/nonstandard.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeysova%2Fnonstandard.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeysova%2Fnonstandard.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeysova%2Fnonstandard.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeysova%2Fnonstandard.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergeysova","download_url":"https://codeload.github.com/sergeysova/nonstandard.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeysova%2Fnonstandard.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34114437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-25T17:06:36.890Z","updated_at":"2026-06-09T16:02:55.069Z","avatar_url":"https://github.com/sergeysova.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Readme\n\n [![NPM](https://nodei.co/npm/nonstandard.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/nonstandard/)\n\n [![Build Status](https://travis-ci.org/LestaD/nonstandard.js.svg?branch=master)](https://travis-ci.org/LestaD/nonstandard.js)\n ![Dependencies](https://david-dm.org/lestad/nonstandard.js.svg)\n [![npm version](https://badge.fury.io/js/nonstandard.svg?new)](https://npmjs.com/nonstandard)\n [![Code Climate](https://codeclimate.com/github/LestaD/nonstandard.js/badges/gpa.svg)](https://codeclimate.com/github/LestaD/nonstandard.js)\n [![Test Coverage](https://codeclimate.com/github/LestaD/nonstandard.js/badges/coverage.svg)](https://codeclimate.com/github/LestaD/nonstandard.js/coverage)\n [![bitHound Overalll Score](https://www.bithound.io/github/LestaD/nonstandard.js/badges/score.svg)](https://www.bithound.io/github/LestaD/nonstandard.js)\n [![Downloads](https://img.shields.io/npm/dm/nonstandard.svg)](https://www.npmjs.com/package/nonstandard)\n\nSome non standard JavaScript features.\n\n\u003e from Node.js \u003e 0.12.0\n\n### Usage\n\n```js\nrequire('nonstandard'); // Install all features\n\n// install specified function\nrequire('nonstandard/src/array/contains').Install();\n[1, 2, 3].contains(2); // true\n\n// Install some module\nrequire('nonstandard/src/array').Install();\nrequire('nonstandard/src/console').Install();\nrequire('nonstandard/src/number').Install();\nrequire('nonstandard/src/object').Install();\nrequire('nonstandard/src/string').Install();\n```\n\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Contents**\n\n- [console.pipe](#consolepipe)\n- [console.[log, info, warn, error].pipe](#consolelog-info-warn-errorpipe)\n- [Array.empty](#arrayempty)\n- [Array.present](#arraypresent)\n- [Array.prototype.first](#arrayprototypefirst)\n- [Array.prototype.second](#arrayprototypesecond)\n- [Array.prototype.last](#arrayprototypelast)\n- [Array.prototype.clean](#arrayprototypeclean)\n- [Array.prototype.contains](#arrayprototypecontains)\n- [Array.prototype.clone](#arrayprototypeclone)\n- [Object.clone](#objectclone)\n- [Object.empty](#objectempty)\n- [Object.present](#objectpresent)\n- [Number.range](#numberrange)\n- [Number.prototype.times](#numberprototypetimes)\n- [String.random](#stringrandom)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\n## console.pipe\n\nLog value to console and pass value\nFirst value was passed next.\n\n```ts\nconsole.pipe(returnValue: any, logValue1: any, logValue2: any, logValueN: any) : any;\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/console').Install();\n```\n\n```js\n// write `123` to console with `console.log`\nvar a = console.pipe(123);\n\n// write:\n// hello world\n// hello\n//\nconsole.log(console.pipe('hello', 'world'));\n```\n\n\n\n## console.[log, info, warn, error].pipe\n\n```ts\nconsole.log.pipe(value: any, ...values: any[]) : any;\nconsole.info.pipe(value: any, ...values: any[]) : any;\nconsole.warn.pipe(value: any, ...values: any[]) : any;\nconsole.error.pipe(value: any, ...values: any[]) : any;\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/console').Install();\n```\n\n```js\nexecuteFunction(console.log.pipe({ some: 'data' }, \"that string has been logged only\")); // value was shown in console, and passed to function `executeFunction`\n\nfunction actionLogin(user) {\n  return login(user.credentials)\n  .then(function(resp) {\n    return console.info.pipe(resp.data);\n  })\n  .catch(function(error) {\n    throw console.error.pipe(error); // in promise throwns was catched by next then/catch pair\n  });\n}\n```\n\n## Array.empty\n\nCheck if array has not elements\n\n```ts\nArray.empty(target: array) : boolean;\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/array/empty').Install();\n```\n\n```js\nArray.empty([]) // true\nArray.empty([1, 2, 3]) // false\n```\n\n\n## Array.present\n\nCheck if array has some elements\n\n```ts\nArray.present(target: array) : boolean;\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/array/present').Install();\n```\n\n```js\nArray.present([]) // false\nArray.present([1, 2, 3]) // true\n```\n\n\n## Array.prototype.first\n\nFirst element in array\n\n```ts\n[].first\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/array/properties').Install();\n```\n\n```js\nvar arr = [5, 9, 14];\n\narr.first // 5\n\narr.first = 2;\n\narr // [2, 9, 14]\n```\n\n## Array.prototype.second\n\nSecond element in array\n\n```ts\n[].second\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/array/properties').Install();\n```\n\n```js\nvar arr = [1, 8, 10];\n\narr.second // 8\n\n[].second // undefined\n\n[].second = 2 // equals:  [][1] = 2\n```\n\n## Array.prototype.last\n\nLatest element in array\n\n\n```ts\n[].last\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/array/properties').Install();\n```\n\n```js\nvar arr = [12, 34, 56, 78, 90];\n\narr.last // 90\n\narr.last == arr[arr.length - 1] // true\n\n[].last = 1; // nothing changed\n```\n\n## Array.prototype.clean\n\nClear array\n\n\n```ts\n[].clean()\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/array/clean').Install();\n```\n\n```js\nvar arr = [1, 2, 3, 45, 67];\n\narr.clean();\n\narr // now `[]`\n```\n\nIf as argument function passed, `.clean` call it on every value and clean if callback return not false, 0, null or undefined\n\n```js\nvar arr = [1, 2, 3, 4, 5, 6];\narr.clean(function(e){\n  return e % 2;\n});\narr; // [2, 4, 6]\n```\n\n## Array.prototype.contains\n\nCheck elements exists in array\n\n\n```ts\n[].contains(any[]) : boolean\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/array/contains').Install();\n```\n\n```js\nvar arr = [\"a\", \"b\", \"c\"];\n\narr.contains(['a', 'b']); // true\n\narr.contains('c'); // true\n\narr.contains('d'); // false\n```\n\n## Array.prototype.clone\n\nFull clone array.\n\n```ts\n[].clone() : any[]\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/array/clone').Install();\n```\n\n```js\nvar arr = [1, 5].clone();\n\n// its simple\narr // [1, 5]\n```\n\n## Object.clone\n\nDeep clone object\n\n```ts\nObject.clone(target: object) : object;\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/object/clone').Install();\n```\n\n```js\nvar oob = { name: \"Foo\", test: \"bar\", cool: { yeah: true } };\n\nvar wob = Object.clone(oob);\n// Object `wob` is full copy of `oob` without links in memory\n```\n\n\n## Object.empty\n\nCheck if object has not keys\n\n```ts\nObject.empty(target: object) : boolean;\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/object/empty').Install();\n```\n\n```js\nObject.empty({}) // true\nObject.empty({ a: 2 }) // false\nObject.empty(window) // false\n```\n\n## Object.present\n\nCheck if object has keys\n\n```ts\nObject.present(target: object) : boolean;\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/object/present').Install();\n```\n\n```js\nObject.present({}) // false\nObject.present({ a: 2 }) // true\nObject.present(window) // true\n```\n\n\n## Number.range\n\nCreate array of numbers\n\n```ts\nNumber.range(min: number, max: number, step: number = 1) : number[];\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/number/present').Install();\n```\n\n```js\nconsole.log(Number.range(1, 10))\n/*\n  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n*/\n\nconsole.log(Number.range(2, 8, 2))\n/*\n  [2, 4, 6, 8]\n*/\n```\n\n## Number.prototype.times\n\nRun callback n times\n\n```ts\n(5).times(function(index: number) { return index + 1; }) : any[]\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/number/times').Install();\n```\n\n```js\nvar result = (5).times(function(index) { return ++index * 2; });\nresult // [ 2, 4, 6, 8, 10 ]\n```\n\n## String.random\n\nGenerate random string with custom length\n\n```ts\nString.random(length: string = 10) : string;\n```\n\nInstall:\n\n```js\nrequire('nonstandard/src/string/random').Install();\n```\n\n```js\nString.random() // \"778fx0hmc0\"\nString.random(5) // \"u5ojh\"\nString.random(64) // \"ww5z8kar8m6l4ichouw221n307xiec1wt6584qf4bib2rbsa4b379hoblsd42h3e\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeysova%2Fnonstandard.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergeysova%2Fnonstandard.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeysova%2Fnonstandard.js/lists"}