@stdlib/utils-papply 0.0.10 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CITATION.cff ADDED
@@ -0,0 +1,30 @@
1
+ cff-version: 1.2.0
2
+ title: stdlib
3
+ message: >-
4
+ If you use this software, please cite it using the
5
+ metadata from this file.
6
+
7
+ type: software
8
+
9
+ authors:
10
+ - name: The Stdlib Authors
11
+ url: https://github.com/stdlib-js/stdlib/graphs/contributors
12
+
13
+ repository-code: https://github.com/stdlib-js/stdlib
14
+ url: https://stdlib.io
15
+
16
+ abstract: |
17
+ Standard library for JavaScript and Node.js.
18
+
19
+ keywords:
20
+ - JavaScript
21
+ - Node.js
22
+ - TypeScript
23
+ - standard library
24
+ - scientific computing
25
+ - numerical computing
26
+ - statistical computing
27
+
28
+ license: Apache-2.0 AND BSL-1.0
29
+
30
+ date-released: 2016
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2022 The Stdlib Authors.
1
+ Copyright (c) 2016-2023 The Stdlib Authors.
package/README.md CHANGED
@@ -18,6 +18,17 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # papply
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -142,7 +153,7 @@ for ( i = 0; i < 100; i++ ) {
142
153
 
143
154
  ## See Also
144
155
 
145
- - <span class="package-name">[`@stdlib/utils/papply-right`][@stdlib/utils/papply-right]</span><span class="delimiter">: </span><span class="description">partially apply function arguments from the right.</span>
156
+ - <span class="package-name">[`@stdlib/utils-papply-right`][@stdlib/utils/papply-right]</span><span class="delimiter">: </span><span class="description">partially apply function arguments from the right.</span>
146
157
 
147
158
  </section>
148
159
 
@@ -174,7 +185,7 @@ See [LICENSE][stdlib-license].
174
185
 
175
186
  ## Copyright
176
187
 
177
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
188
+ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
178
189
 
179
190
  </section>
180
191
 
@@ -187,8 +198,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
187
198
  [npm-image]: http://img.shields.io/npm/v/@stdlib/utils-papply.svg
188
199
  [npm-url]: https://npmjs.org/package/@stdlib/utils-papply
189
200
 
190
- [test-image]: https://github.com/stdlib-js/utils-papply/actions/workflows/test.yml/badge.svg?branch=v0.0.10
191
- [test-url]: https://github.com/stdlib-js/utils-papply/actions/workflows/test.yml?query=branch:v0.0.10
201
+ [test-image]: https://github.com/stdlib-js/utils-papply/actions/workflows/test.yml/badge.svg?branch=v0.1.1
202
+ [test-url]: https://github.com/stdlib-js/utils-papply/actions/workflows/test.yml?query=branch:v0.1.1
192
203
 
193
204
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/utils-papply/main.svg
194
205
  [coverage-url]: https://codecov.io/github/stdlib-js/utils-papply?branch=main
@@ -201,7 +212,7 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
201
212
  -->
202
213
 
203
214
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
204
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
215
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
205
216
 
206
217
  [stdlib]: https://github.com/stdlib-js/stdlib
207
218
 
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import papply from '../docs/types/index';
3
+ export = papply;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var p=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var s=p(function(c,u){
2
+ var g=require('@stdlib/assert-is-function/dist'),l=require('@stdlib/error-tools-fmtprodmsg/dist');function o(e){var r,t;if(!g(e))throw new TypeError(l('1WX3c',e));for(r=new Array(arguments.length-1),t=1;t<arguments.length;t++)r[t-1]=arguments[t];return i;function i(){var n,a;for(n=r.slice(),a=0;a<arguments.length;a++)n.push(arguments[a]);return e.apply(null,n)}}u.exports=o
3
+ });var m=s();module.exports=m;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns a function of smaller arity by partially applying arguments.\n*\n* @param {Function} fcn - function to partially apply\n* @param {...*} [args] - arguments to partially apply\n* @throws {TypeError} first argument must be a function\n* @returns {Function} partially applied function\n*\n* @example\n* function add( x, y ) {\n* return x + y;\n* }\n*\n* var add2 = papply( add, 2 );\n*\n* var sum = add2( 3 );\n* // returns 5\n*/\nfunction papply( fcn ) {\n\tvar pargs;\n\tvar i;\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tpargs = new Array( arguments.length-1 );\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\tpargs[ i-1 ] = arguments[ i ];\n\t}\n\treturn papplied;\n\n\t/**\n\t* Partially applied function.\n\t*\n\t* @private\n\t* @param {...*} [args] - function arguments\n\t* @returns {*} partially applied function result\n\t*/\n\tfunction papplied() {\n\t\tvar args;\n\t\tvar j;\n\t\targs = pargs.slice();\n\t\tfor ( j = 0; j < arguments.length; j++ ) {\n\t\t\targs.push( arguments[ j ] );\n\t\t}\n\t\treturn fcn.apply( null, args );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = papply;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Partially apply function arguments.\n*\n* @module @stdlib/utils-papply\n*\n* @example\n* var papply = require( '@stdlib/utils-papply' );\n*\n* function add( x, y ) {\n* return x + y;\n* }\n*\n* var add2 = papply( add, 2 );\n*\n* var sum = add2( 3 );\n* // returns 5\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EAuB9C,SAASC,EAAQC,EAAM,CACtB,IAAIC,EACAC,EACJ,GAAK,CAACL,EAAYG,CAAI,EACrB,MAAM,IAAI,UAAWF,EAAQ,oEAAqEE,CAAI,CAAE,EAGzG,IADAC,EAAQ,IAAI,MAAO,UAAU,OAAO,CAAE,EAChCC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAClCD,EAAOC,EAAE,CAAE,EAAI,UAAWA,CAAE,EAE7B,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EAEJ,IADAD,EAAOH,EAAM,MAAM,EACbI,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAClCD,EAAK,KAAM,UAAWC,CAAE,CAAE,EAE3B,OAAOL,EAAI,MAAO,KAAMI,CAAK,CAC9B,CACD,CAKAR,EAAO,QAAUG,ICvCjB,IAAIO,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "papply", "fcn", "pargs", "i", "papplied", "args", "j", "main"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /**
22
22
  * Partially applied function.
package/lib/index.js CHANGED
@@ -38,9 +38,9 @@
38
38
 
39
39
  // MODULES //
40
40
 
41
- var papply = require( './papply.js' );
41
+ var main = require( './main.js' );
42
42
 
43
43
 
44
44
  // EXPORTS //
45
45
 
46
- module.exports = papply;
46
+ module.exports = main;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/utils-papply",
3
- "version": "0.0.10",
3
+ "version": "0.1.1",
4
4
  "description": "Partially apply function arguments.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,17 +37,18 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/assert-is-function": "^0.0.x",
41
- "@stdlib/string-format": "^0.0.x"
40
+ "@stdlib/assert-is-function": "^0.1.1",
41
+ "@stdlib/string-format": "^0.1.1",
42
+ "@stdlib/error-tools-fmtprodmsg": "^0.1.0"
42
43
  },
43
44
  "devDependencies": {
44
- "@stdlib/bench": "^0.0.x",
45
- "@stdlib/math-base-special-floor": "^0.0.x",
46
- "@stdlib/math-base-special-pow": "^0.0.x",
47
- "@stdlib/random-base-randu": "^0.0.x",
45
+ "@stdlib/bench": "^0.1.0",
46
+ "@stdlib/math-base-special-floor": "^0.1.0",
47
+ "@stdlib/math-base-special-pow": "^0.1.0",
48
+ "@stdlib/random-base-randu": "^0.1.0",
48
49
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
49
50
  "istanbul": "^0.4.1",
50
- "tap-spec": "5.x.x"
51
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git"
51
52
  },
52
53
  "engines": {
53
54
  "node": ">=0.10.0",
@@ -85,7 +86,7 @@
85
86
  "transform"
86
87
  ],
87
88
  "funding": {
88
- "type": "patreon",
89
- "url": "https://www.patreon.com/athan"
89
+ "type": "opencollective",
90
+ "url": "https://opencollective.com/stdlib"
90
91
  }
91
92
  }
package/docs/repl.txt DELETED
@@ -1,32 +0,0 @@
1
-
2
- {{alias}}( fcn, ...args )
3
- Returns a function of smaller arity by partially applying arguments.
4
-
5
- The implementation does not set the `length` property of the returned
6
- function. Accordingly, the returned function `length` is always zero.
7
-
8
- The evaluation context is always `null`.
9
-
10
- Parameters
11
- ----------
12
- fcn: Function
13
- Function to partially apply.
14
-
15
- args: ...any
16
- Arguments to partially apply.
17
-
18
- Returns
19
- -------
20
- out: Function
21
- Partially applied function.
22
-
23
- Examples
24
- --------
25
- > function add( x, y ) { return x + y; };
26
- > var add2 = {{alias}}( add, 2 );
27
- > var sum = add2( 3 )
28
- 5
29
-
30
- See Also
31
- --------
32
-
@@ -1,37 +0,0 @@
1
- /*
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2019 The Stdlib Authors.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- import papply = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a partially applied function...
25
- {
26
- papply( ( x: number, y: number ): number => x + y, 3 ); // $ExpectType Closure
27
- papply( ( x: number, y: number, z: number ): number => x + y + z , 3, 4 ); // $ExpectType Closure
28
- }
29
-
30
- // The compiler throws an error if the function is provided a first argument which is not a function...
31
- {
32
- papply( {}, 3 ); // $ExpectError
33
- papply( [], 1 ); // $ExpectError
34
- papply( 'abc', 2 ); // $ExpectError
35
- papply( 2, 3 ); // $ExpectError
36
- papply( true, 3 ); // $ExpectError
37
- }
File without changes