@stdlib/dstructs-doubly-linked-list 0.1.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/lib/node.js ADDED
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2018 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
+ // MODULES //
22
+
23
+ var defineProperty = require( '@stdlib/utils-define-property' );
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * List node constructor.
30
+ *
31
+ * @private
32
+ * @constructor
33
+ * @param {*} value - node value
34
+ * @returns {Node} Node instance
35
+ *
36
+ * @example
37
+ * var node = new Node( 'foo' );
38
+ * // returns <Node>
39
+ */
40
+ function Node( value ) { // eslint-disable-line stdlib/no-redeclare
41
+ // Why getters? Because some of the list APIs will return the list "node", not the value. In which case, the node API is no longer private and we have to guard against users mucking about (deleting, updating, etc) with property values (in particular, the `next` and `prev` properties).
42
+ defineProperty( this, 'next', {
43
+ 'configurable': false,
44
+ 'enumerable': true,
45
+ 'get': function get() { // eslint-disable-line no-restricted-syntax
46
+ return this._next;
47
+ }
48
+ });
49
+ defineProperty( this, 'prev', {
50
+ 'configurable': false,
51
+ 'enumerable': true,
52
+ 'get': function get() { // eslint-disable-line no-restricted-syntax
53
+ return this._prev;
54
+ }
55
+ });
56
+ this.value = value;
57
+
58
+ defineProperty( this, '_next', {
59
+ 'configurable': false,
60
+ 'enumerable': false,
61
+ 'writable': true,
62
+ 'value': null
63
+ });
64
+ defineProperty( this, '_prev', {
65
+ 'configurable': false,
66
+ 'enumerable': false,
67
+ 'writable': true,
68
+ 'value': null
69
+ });
70
+
71
+ return this;
72
+ }
73
+
74
+
75
+ // EXPORTS //
76
+
77
+ module.exports = Node;
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@stdlib/dstructs-doubly-linked-list",
3
+ "version": "0.1.0",
4
+ "description": "Doubly linked list.",
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
+ "dist": "./dist"
21
+ },
22
+ "types": "./docs/types",
23
+ "scripts": {},
24
+ "homepage": "https://stdlib.io",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git://github.com/stdlib-js/dstructs-doubly-linked-list.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/stdlib-js/stdlib/issues"
31
+ },
32
+ "dependencies": {
33
+ "@stdlib/string-format": "^0.2.2",
34
+ "@stdlib/symbol-iterator": "^0.2.2",
35
+ "@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.2.3",
36
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
37
+ "@stdlib/utils-define-property": "^0.2.4",
38
+ "@stdlib/error-tools-fmtprodmsg": "^0.2.2"
39
+ },
40
+ "devDependencies": {},
41
+ "engines": {
42
+ "node": ">=0.10.0",
43
+ "npm": ">2.7.0"
44
+ },
45
+ "os": [
46
+ "aix",
47
+ "darwin",
48
+ "freebsd",
49
+ "linux",
50
+ "macos",
51
+ "openbsd",
52
+ "sunos",
53
+ "win32",
54
+ "windows"
55
+ ],
56
+ "keywords": [
57
+ "stdlib",
58
+ "data structures",
59
+ "data structure",
60
+ "data",
61
+ "structure",
62
+ "collection",
63
+ "doubly",
64
+ "linked",
65
+ "list",
66
+ "queue",
67
+ "sequence"
68
+ ],
69
+ "funding": {
70
+ "type": "opencollective",
71
+ "url": "https://opencollective.com/stdlib"
72
+ }
73
+ }