@ohos-ports/stdlib-function 0.0.0-stage → 0.4.1-beta.0
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/LICENSE +177 -0
- package/NOTICE +1 -0
- package/README.md +193 -2
- package/SECURITY.md +5 -0
- package/ctor/README.md +245 -0
- package/ctor/docs/repl.txt +143 -0
- package/ctor/docs/types/index.d.ts +43 -0
- package/ctor/docs/types/test.ts +29 -0
- package/ctor/lib/index.js +42 -0
- package/ctor/lib/main.js +44 -0
- package/ctor/package.json +58 -0
- package/docs/types/index.d.ts +113 -0
- package/lib/index.js +69 -0
- package/package.json +65 -4
- package/thunk/README.md +134 -0
- package/thunk/docs/repl.txt +28 -0
- package/thunk/docs/types/index.d.ts +45 -0
- package/thunk/docs/types/test.ts +58 -0
- package/thunk/lib/index.js +47 -0
- package/thunk/lib/main.js +68 -0
- package/thunk/package.json +68 -0
- package/to-string/README.md +153 -0
- package/to-string/docs/repl.txt +41 -0
- package/to-string/docs/types/index.d.ts +54 -0
- package/to-string/docs/types/test.ts +43 -0
- package/to-string/lib/index.js +44 -0
- package/to-string/lib/main.js +65 -0
- package/to-string/package.json +61 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
|
|
2
|
+
{{alias}}( [...argNames,] body )
|
|
3
|
+
Returns a Function object.
|
|
4
|
+
|
|
5
|
+
Argument names must be strings corresponding to valid JavaScript parameters
|
|
6
|
+
(i.e., a plain identifier, or, in environments supporting such parameters, a
|
|
7
|
+
rest parameter or destructured parameter, optionally with a default).
|
|
8
|
+
|
|
9
|
+
Parameters
|
|
10
|
+
----------
|
|
11
|
+
argNames: ...any (optional)
|
|
12
|
+
Parameter names.
|
|
13
|
+
|
|
14
|
+
body: string
|
|
15
|
+
Function body.
|
|
16
|
+
|
|
17
|
+
Returns
|
|
18
|
+
-------
|
|
19
|
+
fcn: Function
|
|
20
|
+
Function object.
|
|
21
|
+
|
|
22
|
+
Examples
|
|
23
|
+
--------
|
|
24
|
+
> var f = new {{alias}}( 'x', 'y', 'return x + y' );
|
|
25
|
+
> f( 1, 2 )
|
|
26
|
+
3
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
{{alias}}.prototype.apply( thisArg, args )
|
|
30
|
+
Calls a function with a given `this` value and arguments provided as an
|
|
31
|
+
array (or array-like object).
|
|
32
|
+
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
thisArg: any
|
|
36
|
+
Value to use as `this` when executing the function.
|
|
37
|
+
|
|
38
|
+
args: Array
|
|
39
|
+
Array of arguments to pass to the function.
|
|
40
|
+
|
|
41
|
+
Returns
|
|
42
|
+
-------
|
|
43
|
+
out: any
|
|
44
|
+
Function return value.
|
|
45
|
+
|
|
46
|
+
Examples
|
|
47
|
+
--------
|
|
48
|
+
> var f = new {{alias}}( 'x', 'y', 'return x + y' );
|
|
49
|
+
> f.apply( null, [ 1, 2 ] )
|
|
50
|
+
3
|
|
51
|
+
|
|
52
|
+
{{alias}}.prototype.call( thisArg, ...args )
|
|
53
|
+
Calls a function with a given `this` value and arguments provided
|
|
54
|
+
individually.
|
|
55
|
+
|
|
56
|
+
Parameters
|
|
57
|
+
----------
|
|
58
|
+
thisArg: any
|
|
59
|
+
Value to use as `this` when executing the function.
|
|
60
|
+
|
|
61
|
+
args: ...any
|
|
62
|
+
Arguments to pass to the function.
|
|
63
|
+
|
|
64
|
+
Returns
|
|
65
|
+
-------
|
|
66
|
+
out: any
|
|
67
|
+
Function return value.
|
|
68
|
+
|
|
69
|
+
Examples
|
|
70
|
+
--------
|
|
71
|
+
> var f = new {{alias}}( 'x', 'y', 'return x + y' );
|
|
72
|
+
> f.call( null, 1, 2 )
|
|
73
|
+
3
|
|
74
|
+
|
|
75
|
+
{{alias}}.prototype.bind( thisArg, ...args )
|
|
76
|
+
Creates a new function which, when called, has its `this` keyword set to the
|
|
77
|
+
provided value, with a given sequence of arguments preceding any provided
|
|
78
|
+
when the new function is called.
|
|
79
|
+
|
|
80
|
+
Parameters
|
|
81
|
+
----------
|
|
82
|
+
thisArg: any
|
|
83
|
+
Value to use as `this` when executing the function.
|
|
84
|
+
|
|
85
|
+
args: ...any
|
|
86
|
+
Arguments to pass to the function.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
fcn: Function
|
|
91
|
+
Bound function.
|
|
92
|
+
|
|
93
|
+
Examples
|
|
94
|
+
--------
|
|
95
|
+
> var f = new {{alias}}( 'x', 'y', 'return x + y' );
|
|
96
|
+
> var g = f.bind( null, 1 );
|
|
97
|
+
> g( 2 )
|
|
98
|
+
3
|
|
99
|
+
|
|
100
|
+
{{alias}}.prototype.toString()
|
|
101
|
+
Returns a string representation of the function.
|
|
102
|
+
|
|
103
|
+
Examples
|
|
104
|
+
--------
|
|
105
|
+
> var f = new {{alias}}( 'x', 'y', 'return x + y' );
|
|
106
|
+
> f.toString()
|
|
107
|
+
'function anonymous( x, y ) { return x + y; }'
|
|
108
|
+
|
|
109
|
+
{{alias}}.prototype.length
|
|
110
|
+
The number of arguments expected by the function.
|
|
111
|
+
|
|
112
|
+
Examples
|
|
113
|
+
--------
|
|
114
|
+
> var f = new {{alias}}( 'x', 'y', 'return x + y' );
|
|
115
|
+
> f.length
|
|
116
|
+
2
|
|
117
|
+
|
|
118
|
+
{{alias}}.prototype.name
|
|
119
|
+
The name of the function.
|
|
120
|
+
|
|
121
|
+
Examples
|
|
122
|
+
--------
|
|
123
|
+
> var f = new {{alias}}( 'x', 'y', 'return x + y' );
|
|
124
|
+
> f.name
|
|
125
|
+
'anonymous'
|
|
126
|
+
|
|
127
|
+
> var f = new {{alias}}( 'x', 'y', 'return x + y' );
|
|
128
|
+
> f.name = 'add';
|
|
129
|
+
> f.name
|
|
130
|
+
'add'
|
|
131
|
+
|
|
132
|
+
{{alias}}.prototype.prototype
|
|
133
|
+
The prototype of the function.
|
|
134
|
+
|
|
135
|
+
Examples
|
|
136
|
+
--------
|
|
137
|
+
> var f = new {{alias}}( 'x', 'y', 'return x + y' );
|
|
138
|
+
> f.prototype
|
|
139
|
+
{}
|
|
140
|
+
|
|
141
|
+
See Also
|
|
142
|
+
--------
|
|
143
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
// EXPORTS //
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns a Function object.
|
|
25
|
+
*
|
|
26
|
+
* ## Notes
|
|
27
|
+
*
|
|
28
|
+
* - Argument names must be strings corresponding to valid JavaScript parameters (i.e., a plain identifier, or, in environments supporting such parameters, a rest parameter or destructured parameter, optionally with a default).
|
|
29
|
+
* - Creating `Function` objects with the `Function` constructor is less efficient than declaring a function via a function expression or a function statement.
|
|
30
|
+
* - The `Function` constructor can be invoked without the `new` operator (using `new` and not using `new` both return a new `Function` object).
|
|
31
|
+
* - The `Function` constructor creates functions which execute in the **global scope**. Hence, created functions **cannot** access variables local to the scope in which functions were created.
|
|
32
|
+
*
|
|
33
|
+
* @param argNames - parameter names
|
|
34
|
+
* @param body - function body
|
|
35
|
+
* @returns function
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* var add = new Function( 'x', 'y', 'return x + y' );
|
|
39
|
+
*
|
|
40
|
+
* var v = add( 1, 2 );
|
|
41
|
+
* // returns 3
|
|
42
|
+
*/
|
|
43
|
+
export = Function;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
20
|
+
|
|
21
|
+
import Fcn = require( './index' );
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// TESTS //
|
|
25
|
+
|
|
26
|
+
// The function returns a function object...
|
|
27
|
+
{
|
|
28
|
+
new Fcn( 'x', 'y', 'return x + y' ); // $ExpectType Function
|
|
29
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Function constructor.
|
|
23
|
+
*
|
|
24
|
+
* @module @stdlib/function/ctor
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* var Function = require( '@ohos-ports/stdlib-function/ctor' );
|
|
28
|
+
*
|
|
29
|
+
* var add = new Function( 'x', 'y', 'return x + y' );
|
|
30
|
+
*
|
|
31
|
+
* var v = add( 1, 2 );
|
|
32
|
+
* // returns 3
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
// MODULES //
|
|
36
|
+
|
|
37
|
+
var main = require( './main.js' );
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// EXPORTS //
|
|
41
|
+
|
|
42
|
+
module.exports = main;
|
package/ctor/lib/main.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MAIN //
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns a Function object.
|
|
25
|
+
*
|
|
26
|
+
* @name Function
|
|
27
|
+
* @constructor
|
|
28
|
+
* @type {Function}
|
|
29
|
+
* @param {...*} [argNames] - parameters names
|
|
30
|
+
* @param {string} body - function body
|
|
31
|
+
* @returns {Function} function
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* var add = new Fcn( 'x', 'y', 'return x + y' );
|
|
35
|
+
*
|
|
36
|
+
* var v = add( 1, 2 );
|
|
37
|
+
* // returns 3
|
|
38
|
+
*/
|
|
39
|
+
var Fcn = Function; // eslint-disable-line stdlib/require-globals
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// EXPORTS //
|
|
43
|
+
|
|
44
|
+
module.exports = Fcn;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stdlib/function/ctor",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Function constructor.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "The Stdlib Authors",
|
|
8
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
9
|
+
},
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"name": "The Stdlib Authors",
|
|
13
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"main": "./lib",
|
|
17
|
+
"directories": {
|
|
18
|
+
"benchmark": "./benchmark",
|
|
19
|
+
"doc": "./docs",
|
|
20
|
+
"example": "./examples",
|
|
21
|
+
"lib": "./lib",
|
|
22
|
+
"test": "./test"
|
|
23
|
+
},
|
|
24
|
+
"types": "./docs/types",
|
|
25
|
+
"scripts": {},
|
|
26
|
+
"homepage": "https://github.com/stdlib-js/stdlib",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git://github.com/stdlib-js/stdlib.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {},
|
|
35
|
+
"devDependencies": {},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=0.10.0",
|
|
38
|
+
"npm": ">2.7.0"
|
|
39
|
+
},
|
|
40
|
+
"os": [
|
|
41
|
+
"aix",
|
|
42
|
+
"darwin",
|
|
43
|
+
"freebsd",
|
|
44
|
+
"linux",
|
|
45
|
+
"macos",
|
|
46
|
+
"openbsd",
|
|
47
|
+
"sunos",
|
|
48
|
+
"win32",
|
|
49
|
+
"windows"
|
|
50
|
+
],
|
|
51
|
+
"keywords": [
|
|
52
|
+
"stdlib",
|
|
53
|
+
"function",
|
|
54
|
+
"constructor",
|
|
55
|
+
"ctor"
|
|
56
|
+
],
|
|
57
|
+
"__stdlib__": {}
|
|
58
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/* eslint-disable max-lines */
|
|
22
|
+
|
|
23
|
+
import Function = require( './../../ctor' );
|
|
24
|
+
import thunk = require( './../../thunk' );
|
|
25
|
+
import function2string = require( './../../to-string' );
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Interface describing the `function` namespace.
|
|
29
|
+
*/
|
|
30
|
+
interface Namespace {
|
|
31
|
+
/**
|
|
32
|
+
* Returns a Function object.
|
|
33
|
+
*
|
|
34
|
+
* ## Notes
|
|
35
|
+
*
|
|
36
|
+
* - Argument names must be strings corresponding to valid JavaScript parameters (i.e., a plain identifier, or, in environments supporting such parameters, a rest parameter or destructured parameter, optionally with a default).
|
|
37
|
+
* - Creating `Function` objects with the `Function` constructor is less efficient than declaring a function via a function expression or a function statement.
|
|
38
|
+
* - The `Function` constructor can be invoked without the `new` operator (using `new` and not using `new` both return a new `Function` object).
|
|
39
|
+
* - The `Function` constructor creates functions which execute in the **global scope**. Hence, created functions **cannot** access variables local to the scope in which functions were created.
|
|
40
|
+
*
|
|
41
|
+
* @param argNames - parameter names
|
|
42
|
+
* @param body - function body
|
|
43
|
+
* @returns function
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* var add = new ns.Function( 'x', 'y', 'return x + y' );
|
|
47
|
+
*
|
|
48
|
+
* var v = add( 1, 2 );
|
|
49
|
+
* // returns 3
|
|
50
|
+
*/
|
|
51
|
+
Function: typeof Function;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Returns a thunk.
|
|
55
|
+
*
|
|
56
|
+
* @param fcn - function to convert to a thunk
|
|
57
|
+
* @param args - function args
|
|
58
|
+
* @returns thunk
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* var add = require( '@stdlib/number/float64/base/add' );
|
|
62
|
+
*
|
|
63
|
+
* var f = ns.thunk( add, 2, 3 );
|
|
64
|
+
* // returns <Function>
|
|
65
|
+
*
|
|
66
|
+
* // ...
|
|
67
|
+
*
|
|
68
|
+
* // Evaluate the ns.thunk:
|
|
69
|
+
* var v = f();
|
|
70
|
+
* // returns 5
|
|
71
|
+
*/
|
|
72
|
+
thunk: typeof thunk;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns a string representing the source code of a provided function.
|
|
76
|
+
*
|
|
77
|
+
* ## Notes
|
|
78
|
+
*
|
|
79
|
+
* - If called on built-in functions, functions created by `Function.prototype.bind()`, or other non-JavaScript functions, the function returns a "native" function string similar to the following:
|
|
80
|
+
*
|
|
81
|
+
* ```text
|
|
82
|
+
* "function foo() { [native code] }"
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* For intrinsic object methods and functions, `foo` is the initial name of the function.
|
|
86
|
+
*
|
|
87
|
+
* - If called on a function created by the `Function` constructor, the function returns the source code of a synthesized function declaration having the name "anonymous" and using the provided parameters and function body.
|
|
88
|
+
*
|
|
89
|
+
* - Starting in ES2018, the ECMAScript specification requires that the returned string contain the exact same source code as it was declared, including any whitespace and/or comments. If the host is unable to access the source code, the specification requires that the returned string be the native function string.
|
|
90
|
+
*
|
|
91
|
+
* @param fcn - input function
|
|
92
|
+
* @returns string representing function source code
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* function add( x, y ) {
|
|
96
|
+
* return x + y;
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* var str = ns.function2string( add );
|
|
100
|
+
* // e.g., returns 'function add( x, y ) {\n return x + y;\n}'
|
|
101
|
+
*/
|
|
102
|
+
function2string: typeof function2string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Function.
|
|
107
|
+
*/
|
|
108
|
+
declare var ns: Namespace;
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// EXPORTS //
|
|
112
|
+
|
|
113
|
+
export = ns;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 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
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
// MODULES //
|
|
26
|
+
|
|
27
|
+
var setReadOnly = require( '@ohos-ports/stdlib-utils/define-read-only-property' );
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
// MAIN //
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Top-level namespace.
|
|
34
|
+
*
|
|
35
|
+
* @namespace ns
|
|
36
|
+
*/
|
|
37
|
+
var ns = {};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @name Function
|
|
41
|
+
* @memberof ns
|
|
42
|
+
* @readonly
|
|
43
|
+
* @type {Function}
|
|
44
|
+
* @see {@link module:@stdlib/function/ctor}
|
|
45
|
+
*/
|
|
46
|
+
setReadOnly( ns, 'Function', require( './../ctor' ) );
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @name thunk
|
|
50
|
+
* @memberof ns
|
|
51
|
+
* @readonly
|
|
52
|
+
* @type {Function}
|
|
53
|
+
* @see {@link module:@stdlib/function/thunk}
|
|
54
|
+
*/
|
|
55
|
+
setReadOnly( ns, 'thunk', require( './../thunk' ) );
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @name function2string
|
|
59
|
+
* @memberof ns
|
|
60
|
+
* @readonly
|
|
61
|
+
* @type {Function}
|
|
62
|
+
* @see {@link module:@stdlib/function/to-string}
|
|
63
|
+
*/
|
|
64
|
+
setReadOnly( ns, 'function2string', require( './../to-string' ) );
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
// EXPORTS //
|
|
68
|
+
|
|
69
|
+
module.exports = ns;
|
package/package.json
CHANGED
|
@@ -1,6 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohos-ports/stdlib-function",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.4.1-beta.0",
|
|
4
|
+
"description": "Function.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "The Stdlib Authors",
|
|
8
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
9
|
+
},
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"name": "The Stdlib Authors",
|
|
13
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"main": "./lib",
|
|
17
|
+
"directories": {
|
|
18
|
+
"doc": "./docs",
|
|
19
|
+
"lib": "./lib"
|
|
20
|
+
},
|
|
21
|
+
"types": "./docs/types",
|
|
22
|
+
"scripts": {},
|
|
23
|
+
"homepage": "https://stdlib.io",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git://github.com/stdlib-js/function.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@ohos-ports/stdlib-assert": "^0.4.1-beta.2",
|
|
33
|
+
"@ohos-ports/stdlib-string": "^0.4.1-beta.2",
|
|
34
|
+
"@ohos-ports/stdlib-utils": "^0.4.1-beta.1"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=0.10.0",
|
|
39
|
+
"npm": ">2.7.0"
|
|
40
|
+
},
|
|
41
|
+
"os": [
|
|
42
|
+
"aix",
|
|
43
|
+
"darwin",
|
|
44
|
+
"freebsd",
|
|
45
|
+
"linux",
|
|
46
|
+
"macos",
|
|
47
|
+
"openbsd",
|
|
48
|
+
"sunos",
|
|
49
|
+
"win32",
|
|
50
|
+
"windows",
|
|
51
|
+
"openharmony"
|
|
52
|
+
],
|
|
53
|
+
"keywords": [
|
|
54
|
+
"stdlib",
|
|
55
|
+
"standard",
|
|
56
|
+
"library",
|
|
57
|
+
"std",
|
|
58
|
+
"lib",
|
|
59
|
+
"function",
|
|
60
|
+
"namespace",
|
|
61
|
+
"ns"
|
|
62
|
+
],
|
|
63
|
+
"funding": {
|
|
64
|
+
"type": "opencollective",
|
|
65
|
+
"url": "https://opencollective.com/stdlib"
|
|
66
|
+
}
|
|
67
|
+
}
|